4

For some reason when Building my application with TeamCity it insists on trying to install "System.Runtime 4.0.20".

I then get the following error:

[update] WARNING: Package 'System.Runtime 4.0.20' does not exist in project 'AkkaNeat.Tests.csproj' [20:04:08][update] Removed package 'System.Resources.ResourceManager 4.0.0' from 'packages.config' [20:04:08][update] Removed package 'System.Linq 4.0.0' from 'packages.config' [20:04:08][update] For adding package 'System.Runtime 4.0.10' to project 'AkkaNeat.Tests.csproj' that targets 'net45'. [20:04:08][update] Could not install package 'System.Runtime 4.0.20'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.5', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author. [20:04:08][update] Process exited with code 1 [20:04:09][Step 2/4] Step Restore NuGet packages (NuGet Installer) failed

I can't understand why it's insisting on adding the package. Everything builds fine on the agent machine in both Xamarin and Visual Studio.

I have spent two full days trying to figure this out. I have even tried explicitly adding a reference to a different version of System.Runtime to the packages.json file. Nuget still insists on the specified version.

Frank Bryce
  • 8,076
  • 4
  • 38
  • 56
K-Dawg
  • 3,013
  • 2
  • 34
  • 52

1 Answers1

4

Your package that you are trying to install it doesn't support the version of .Net that your project is targeting. To fix this, update the .Net version that your project targets to the .Net version that is supported by the package System.Runtime 4.0.20 (which isn't shown in your output provided).

Step 1: find the version of .Net that the package supports.

You can find out the version that you need for your nuget package by looking at the folder that it's installed under. If it's in folder /path/to/lib/net46 or path/to/lib/net451 then those would mean .Net 4.6 or .Net 4.5.1, respectively.

Step 2: change your project's .Net version

Frank Bryce
  • 8,076
  • 4
  • 38
  • 56