Supress/Disable/Solve Visual Studio Build Warning

2019-02-13 06:10发布

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条回答
We Are One
2楼-- · 2019-02-13 07:09

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.

查看更多
登录 后发表回答