Closed mkaring closed 6 years ago
Let me look into this...
Just Announced @github + @Microsoft at $7.5B
I have looked into this, it can be fixed. I'll see what I can do on the NuGet Restore Target side.
For now use versioned TargetFramework
, i.e. use net45;net40-client
instead of net;net-client
.
After you fixed your project file, you should see two warnings when you Rebuild:
Warning MSB3267: The primary reference "System.Net.Http", which is a framework assembly, could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.0,Profile=Client". To resolve this problem, either remove the reference "System.Net.Http" or retarget your application to a framework version which contains "System.Net.Http".
Warning MSB3052: The parameter to the compiler is invalid, '/define:NET40-CLIENT' will be ignored.
You can fix both the warnings by adding these to your project file.
Fix for MSB3267
<ItemGroup>
<Reference Remove="System.Net.Http">
<ItemGroup>
Fix for MSB3052
<PropertyGroup Condition="$(TargetFramework.EndsWith('-client'))">
<ImplicitFrameworkDefine>$(TargetFramework.Replace('-','_').ToUpperInvariant())</ImplicitFrameworkDefine>
<DisableImplicitFrameworkDefines>true</DisableImplicitFrameworkDefines>
</PropertyGroup>
Will issue a fix later this week along with some planned features: v1.2.0
Hello,
I noticed that any function that relies on changing the
<TargetFramework>
property is not working when using multi-targeting.If you write in the .proj file something like: `net;net-client it should resolve to .NET Framework 4.5 and .NET 4.0 - Client, but it fails all together.
The reason for this is the way MSBuild is called, when using multi targeting. The
<MSBuild>
gets theTargetFramework
using theProperties
attribute. It seems this launches MSBuild providing this parameter as command line parameter and those command line parameters can't be simply overwritten.