How to get rid of msbuild MSB3644 warning

When you create a web project on a computer on which the SDK is not installed, you receive this warning:

warning MSB3644: reference assemblies for the ".NETFramework, Version = v4.0" framework were not found. To solve this problem, install the SDK or Targeting Pack for this version of the framework or reconfigure the application to the version of the framework for which you have an SDK or targeting package. Please note that assemblies will be allowed from the Global Cache (GAC) and will be used instead of control assemblies. Therefore, your assembly may not be designed correctly for the framework that you plan to use.

Obviously, one way to get rid of the warning is to install the SDK. However, in this case, I just want to suppress this warning (which is safe in most cases) from the assembly exit without changing the state of the machine in any other way.

I tried passing / p: NoWarn = 3644 to msbuild (based on other messages like how can I suppress all compiler and code analysis warnings from msbuild on the command line? ), But that did not affect.

+7
source share
1 answer

NoWarn applies to compilation warnings generated by Csc and Vbc .

MSB warnings * are the main warnings of MSBuild. To suppress the warning MSB3644, skip the explicit TargetFrameworkMoniker :

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

A list of possible inputs can be found 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 has a new flag, IgnoreVersionForFrameworkReferences , which can come in handy in these warnings.

+3
source

All Articles