抑制/禁用/解决Visual Studio构建警告 [英] Supress/Disable/Solve Visual Studio Build Warning
问题描述
我正在使用clickonce作为Windows窗体应用程序。我必须部署一些资源程序集。这些程序集在我的项目中的一个文件夹中(不作为参考)。它们被标记为BuildAction = content和CopyToOutputDir =如果较新,则复制。使用此配置,我收到警告: MSB3178:Assembly未正确指定为文件。
I am using clickonce for a windows forms application. I have to deploy some resource assemblies. These assemblies are in a folder in my project (not as a reference). They are marked BuildAction = content and CopyToOutputDir = Copy If Newer. With this configuration I'm getting the warning MSB3178: Assembly '' is incorrectly specified as a file.
当我将BuildAction设置为none时,警告消失,但必须部署的程序集不会出现在ClickOnce应用程序文件中。
When I set the BuildAction to none, the warnings disappear, but the assemblies that must deploy not appear in ClickOnce Application Files.
我想在没有此警告的Clickonce的发布中添加这些程序集(有很多),而不将这些dll添加为项目中的引用。我研究了很多,找不到解决方案来禁用警告。
I would like to add these assemblies (there are many) in the publication of clickonce without this warning and without adding these dlls as references in the project. I researched a lot and could not find a solution to disable the warning.
编辑:
仅当在项目/属性/安全性选项卡中设置启用Clickonce安全设置=True时,才会显示警告。
The warning appears only when I set "Enable Clickonce Security Settings" = "True" in "Project / Properties / Security Tab"
样品项目:
只需建立并检查警告。
推荐答案
MSBuild警告是不可能的。
Suppressing MSBuild warnings is still not possible.
使用MSB前缀的警告由MSBuild抛出。目前,我们不能禁止MSBuild警告。
Warnings with MSB prefix are thrown by MSBuild. Currently, we can't suppress MSBuild warnings.
有几个可以在.csproj文件的PropertyGroup中禁止,例如:
There are a few you can suppress in the PropertyGroup of your .csproj file, for example:
< ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch> None< / ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
然而, >不正确地指定为文件警告。
However none exist for the incorrectly specified as a file warning.
由于您无法修复MSB3178的根本原因,因为文件扩展名第三方DLL,您有理由忽略该特定警告。
Since you cant fix the root cause of the MSB3178 due to the file extension of a 3rd party DLL, you have justification to ignore that particular warning.
Related SO threads here and here and on MSDN. The exact same question on MSDN.
这篇关于抑制/禁用/解决Visual Studio构建警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!