Reputation: 473
We have a new Windows 2012 server that I have been using as our Jenkins build server. My app has been building on there successfully with .NET framework 4.5 but when we upgraded to .NET 4.6 the builds have stopped working.
Looking down the log I see this error:
RateCalculator.cs(49,13): error CS0012: The type 'System.Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
I don't have a Web.config in my app, only an Application.config file. I have tried adding this:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" />
</dependentAssembly>
</assemblyBinding>
</runtime>
However it has not resolved the error.
We have double checked that .NET framework 4.6 is installed correctly, both by checking the Windows Updates and in the registry.
On my local dev environment it builds correctly with me compiling on Visual Studio 2015 running on Windows 7. The Jenkins build server has Visual Studio 2012 on the Windows 2012 server and that's where the errors appear.
Upvotes: 1
Views: 1645
Reputation: 473
So I have solved this by installing the .NET Framework 4.6 Targeting pack on my Windows 2012 server.
If you are using Visual Studio 2012 and want to use .NET 4.6 then you need to download and install the .NET Framework 4.6 prior to installing the targeting pack.
Thanks to Hans Passant and others for their assistance in pointing me to the targeting pack.
I installed it from: https://www.microsoft.com/en-us/download/details.aspx?id=48136
Upvotes: 1