禁止/禁用/解决 Visual Studio 构建警告 [英] Supress/Disable/Solve Visual Studio Build Warning

查看:59
本文介绍了禁止/禁用/解决 Visual Studio 构建警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将 clickonce 用于 Windows 窗体应用程序.我必须部署一些资源程序集.这些程序集位于我的项目中的文件夹中(不作为参考).它们被标记为 BuildAction = content 和 CopyToOutputDir = Copy If Newer.使用此配置,我收到警告 MSB3178:程序集 '' 被错误地指定为文件.

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.

MSBuild 会抛出带有 MSB 前缀的警告.目前,我们无法取消 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 中隐藏一些内容,例如:

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

<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>无</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>

<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>

然而,错误地指定为文件警告不存在.

<小时>由于第 3 方 DLL 的文件扩展名,您无法修复 MSB3178 的根本原因,因此您有理由忽略该特定警告.


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.

相关 SO 线程此处此处MSDN.关于 MSDN.

Related SO threads here and here and on MSDN. The exact same question on MSDN.

这篇关于禁止/禁用/解决 Visual Studio 构建警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆