简体   繁体   English

如何使用项目(.csproj)文件隐藏C#警告

[英]How to hide C# warning using project(.csproj) file

One of C# project uses multiple C++ DLLs. 其中一个C#项目使用多个C ++ DLL。 I need to hide this warning the same project. 我需要在同一个项目中隐藏此警告。

ALINK : warning AL1073: Referenced assembly 'mscorlib.dll' targets a different processor

I know it can be use C# code to do this using project file. 我知道可以使用C#代码使用项目文件来完成此操作。 But in my case I need to use project file to do this. 但在我的情况下,我需要使用项目文件来执行此操作。

In C++ project file, It can be do by 在C ++项目文件中,它可以通过

<Link>
    <AdditionalOptions> /ignore:xxxx %(AdditionalOptions)</AdditionalOptions>
</Link>

I'm no so familiar with C#. 我不熟悉C#。 Is there anyway to do this? 反正有没有这样做?

In the .csproj file 在.csproj文件中
Add the tag <NoWarn>1073</NoWarn> to the desired build configuration in a <PropertyGroup> tag. 将标记<NoWarn>1073</NoWarn><PropertyGroup>标记中的所需构建配置。 Suppress multiple warnings by inserting a ; 插入一个;禁止多个警告 .

In Visual Studio 在Visual Studio中
Right click the project -> property -> build tab 右键单击项目 - >属性 - >构建选项卡 在此输入图像描述

You can explicitly specify the warning you would like to hide or lower the warning level to do that. 您可以明确指定要隐藏的警告或降低警告级别来执行此操作。

Please see the two posts below for reference: 请参阅以下两个帖子以供参考:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM