Supress/Disable/Solve Visual Studio 生成警告

Supress/Disable/Solve Visual Studio Build Warning

我正在为 windows 表单应用程序使用 clickonce。我必须部署一些资源程序集。这些程序集位于我项目的一个文件夹中(不作为参考)。它们被标记为 BuildAction = content 和 CopyToOutputDir = Copy If Newer。使用此配置,我收到警告 MSB3178: Assembly '' is incorrectly specified as a file.

当我将 BuildAction 设置为 none 时,警告消失,但必须部署的程序集不会出现在 ClickOnce 应用程序文件中。

我想在 clickonce 的发布中添加这些程序集(有很多),没有这个警告,也没有将这些 dll 作为引用添加到项目中。我研究了很多,但找不到禁用警告的解决方案。

编辑:

只有当我在"Project / Properties / Security Tab"

中设置"Enable Clickonce Security Settings" = "True"时才会出现警告

示例项目:

Click to download the sample project

只需构建并检查警告。

抑制 MSBuild 警告仍然不可能。

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

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

您可以在 .csproj 文件的 PropertyGroup 中隐藏一些内容,例如:

None

然而 none 存在 错误指定为文件 警告。


由于第三方 DLL 的文件扩展名导致您无法修复 MSB3178 的根本原因,因此您有理由忽略该特定警告。

相关 SO 线程 here and here and on MSDN. The exact same question on MSDN