gpt4 book ai didi

.net - 如何摆脱 msbuild 警告 MSB3644

转载 作者:行者123 更新时间:2023-12-04 12:42:36 29 4
gpt4 key购买 nike

在未安装 SDK 的机器上构建 Web 项目时,您会收到以下警告:

warning MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.0" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend.



显然,摆脱警告的一种方法是安装 SDK。但是,在这种情况下,我只是希望在不以任何其他方式更改机器状态的情况下,从构建输出中抑制此警告(通常是无害的)。

我尝试将/p:NoWarn=3644 传递给 msbuild(基于 how can i suppress all compiler and code analysis warnings from msbuild at the command line? 等其他帖子),但这没有任何影响。

最佳答案

NoWarn适用于 Csc 抛出的编译警告和 Vbc任务。

MSB* 警告是核心 MSBuild 警告。
要抑制 MSB3644 警告,请通过显式 TargetFrameworkMoniker :

msbuild your.csproj /t:Rebuild /p:TargetFrameworkMoniker=".NETFramework,Version=v4.0"

可以找到可能的输入列表 here .
v1.1.4322
v2.0.50727
Client
v4.0
v4.0.30319
.NET Framework, Version=v4.0, Profile=Client
.NET Framework, Version=v4.0
.NET Framework, Version=v4.0.1, Profile=Client
.NET Framework, Version=v4.0.1
.NET Framework, Version=v4.0.2, Profile=Client
.NET Framework, Version=v4.0.2
.NET Framework, Version=v4.0.3, Profile=Client
.NET Framework, Version=v4.0.3
.NET Framework, Version=v4.5

在 MSBuild 4.5 中有一个新标志 - IgnoreVersionForFrameworkReferences 这些警告可能会派上用场。

关于.net - 如何摆脱 msbuild 警告 MSB3644,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10006012/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com