Supress/Disable/Solve Visual Studio Build Warning

£可爱£侵袭症+ 提交于 2020-01-10 19:11:45

问题


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.

When I set the BuildAction to none, the warnings disappear, but the assemblies that must deploy not appear in ClickOnce Application Files.

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.

Edit:

The warning appears only when I set "Enable Clickonce Security Settings" = "True" in "Project / Properties / Security Tab"

SAMPLE PROJECT:

Click to download the sample project

Just build and check the Warnings.


回答1:


Suppressing MSBuild warnings is still not possible.

Warnings with MSB prefix are thrown by MSBuild. Currently, we can't suppress MSBuild warnings.

Ref: https://social.msdn.microsoft.com/Forums/vstudio/en-US/96b3ea2e-92ed-4483-bbfe-a4dda3231eb9/suppress-msb4126?forum=tfsbuild

There are a few you can suppress in the PropertyGroup of your .csproj file, for example:

<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>

However none exist for the incorrectly specified as a file warning.


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.



来源:https://stackoverflow.com/questions/38993872/supress-disable-solve-visual-studio-build-warning

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!