在我的Visual Studio项目中,我有我希望包含在输出中的文件,但没有编译或嵌入.
我知道有两种方法可以实现这一目标.
有人能告诉我有什么区别,哪种情况适合哪种选择?
Visual Studio 中的内容构建操作有何作用?它看起来并没有做任何事情.
MSDN上的文件属性文章(不再存在)说:
内容 - 文件未编译,但包含在"内容"输出组中.例如,此设置是.htm或其他类型的Web文件的默认值.
但我不知道"内容输出组"的含义.
这是关于部署的吗?这意味着,在构建时,动作没有实际效果,但只有在部署后才能实现?
Azure错误是:
.Net Core:应用程序启动异常:System.IO.FileNotFoundException:找不到配置文件'appsettings.json',它不是可选的.
所以这有点模糊.我似乎无法解决这个问题.我正在尝试将一个.Net Core Web API项目部署到Azure,我收到此错误:
:(糟糕.500内部服务器错误启动应用程序时出错.
我已经部署了普通的.Net WebAPI,他们已经工作了.我已经按照在线教程进行了操作.但不知何故,我的项目已经破产.在Web.config上启用stdoutLogEnabled并查看Azure Streaming Logs给出了以下信息:
2016-08-26T02:55:12 Welcome, you are now connected to log-streaming service.
Application startup exception: System.IO.FileNotFoundException: The configuration file 'appsettings.json' was not found and is not optional.
at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load(Boolean reload)
at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load()
at Microsoft.Extensions.Configuration.ConfigurationRoot..ctor(IList`1 providers)
at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build()
at Quanta.API.Startup..ctor(IHostingEnvironment env) in D:\Source\Workspaces\Quanta\src\Quanta.API\Startup.cs:line 50
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.Extensions.Internal.ActivatorUtilities.ConstructorMatcher.CreateInstance(IServiceProvider provider)
at Microsoft.Extensions.Internal.ActivatorUtilities.CreateInstance(IServiceProvider provider, Type instanceType, Object[] parameters)
at Microsoft.Extensions.Internal.ActivatorUtilities.GetServiceOrCreateInstance(IServiceProvider provider, …Run Code Online (Sandbox Code Playgroud) azure azure-web-sites .net-core asp.net-core asp.net-core-webapi
我在App.xaml主程序集中有一个合并的资源字典,它结合了来自不同程序集的各种资源字典:Common和PresentationLayer.
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Common;component/Themes/Button.xaml"/>
<ResourceDictionary Source="/PresentationLayer;component/DataTemplates/AppointmentsDataTemplates.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
Run Code Online (Sandbox Code Playgroud)
在运行时,资源字典中的样式将正确应用于控件.但是,在设计时不会应用样式,Visual Studio 2012会不断出现以下错误:
An error occurred while finding the resource dictionary "/Common;component/Themes/Button.xaml".
Run Code Online (Sandbox Code Playgroud)
并警告:
The resource "BannerButton" could not be resolved.
Run Code Online (Sandbox Code Playgroud)
我遇到过这篇文章,但问题仍然存在,尽管Build Action设置为Resource.此外,我在Visual Studio 2010或Expression Blend 4下运行时没有遇到此问题.主程序集肯定包含对Common程序集的引用,我没有更改Pack URI.
在csproj文件中,我们可以使用None或者Content元素包含一个文件.从MSDN,它说:
无 - 文件未包含在项目输出组中,并且未在构建过程中编译.一个示例是包含文档的文本文件,例如自述文件.
内容 - 文件未编译,但包含在"内容"输出组中.例如,此设置是.htm或其他类型的Web文件的默认值.
但由于其中一个元素None或Content元素都可以包含一个CopyToOutputDirectory元素,因此我想知道我是否设置了这个,是Always不是行为None和Content相同?
起初我只是在寻找资源和嵌入式资源之间的区别; 然后我注意到所有这些其他Build Action类型:Compile,Content,Embedded Resource,ApplicationDefinition,Page,Resource,SplashScreen和EntityDeploy.
我理解其中的一些,但有些更模糊,除了你可能使用每个的一些例子之外,清晰的定义会有所帮助.
谢谢,
compiler-construction resources build-process embedded-resource visual-studio
我有一个带有徽标的"上传"文件夹.我希望VS2012一键发布包含此文件夹.目前它不是.
我怎样才能做到这一点?
谢谢你的帮助.
不同的构建操作在Web API项目中做了什么(也可能适用于其他类型)?
我看到:无,编译,内容,嵌入式资源,AdditionalFiles,CodeAnalysisDictionary,ApplicationDefinition,Page,Resource,SplashScreen,DesignData,DesignDataWithDesignTimeCreatableTypes,EntityDeploy,XamlAppDef,Fakes
我在StackOverflow上发现了类似的问题,但它们没有链接到任何Microsoft文档或包含所有项目.即,AdditionalFiles或Fakes做什么?
"Visual Studio项目属性中的各种"构建操作"设置是什么?它们做了什么?" 有一个不完整的清单.
是的,我确实看过,在文档中找不到它.
我有一个用ASP.NET开发的网站.我正在使用Visual Studio 2015.当我右键单击并点击发布网站时,该网站会正确发布,但我的资源文件夹会被遗忘.下面是Visual Studio中解决方案资源管理器的样子
但是我在这里发布之后是放在Azure上的文件(通过FileZilla访问)
如何告诉Visual Studio将Resources文件夹与网站的其余部分一起发布?
虽然我可以在Web上找到(在网上)有关Visual Studio 2012数据库项目中的SQL脚本PreDeploy和PostDeploy 构建操作的大量信息,但我知道在部署时不编译或包含脚本,请任何人明确建议或指导我的一篇文章,它明确定义的细微之处和?NoneBuildCompile
我粗略的假设是这两个都将针对模式进行编译,但只会Build部署.它是否正确?
我想要的是正确的设置,以针对当前架构验证我的种子脚本(并导致无效架构结构上的构建错误),但不部署数据库发布或显示在架构比较会话中.
database-project sql-scripts buildaction visual-studio sql-server-data-tools
buildaction ×3
c# ×3
azure ×2
msbuild ×2
.net ×1
.net-core ×1
asp.net ×1
asp.net-core ×1
asp.net-mvc ×1
build ×1
resources ×1
sql-scripts ×1
wpf ×1