Figuring out the right System.Runtime package version


#1

I am trying to write a simple dotnet class library project using the netstandard1.3 TFM. This exercise was to see whether this library could be used with a Full .NET project and also as a netstandardapp.

I was trying to add the package System.Runtime, but I wasn’t really sure which versions of this package I should use. For example, VS intellisense gave me the options of 4.0.0, 4.0.10, 4.0.20, 4.0.21, 4.1.0 etc.

I tried using each version one by one to figure out if I can compile the app and use it in both full .net and in a netstandard app. I finally was able to use the 4.0.21 version.

Questions:

  • I was under the impression that all these versions should be compatible with netstandard1.3. Not sure why I wasn’t able to use them.
  • How can I easily figure out if a package is supported for a netstandard (probably there is a planned tooling experience?)

##project.json

{                                 
  "version": "1.0.0-*",           
  "dependencies": {               
    "System.Runtime": "4.0.21-*"  
  },                              
  "frameworks": {                 
    "netstandard1.3": {           
    }                             
  }                               
}                                 

##Code

using System;                                
                                             
namespace SampleApp                          
{                                            
    public class Calculator                  
    {                                        
        public double Add(double x, double y)
        {                                    
                return x + y;                
        }                                    
    }                                        
}                                            

##Nuget.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <!--To inherit the global NuGet package sources remove the <clear/> line below -->
    <clear />
    <add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
    <add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
  </packageSources>
</configuration>

.NET Foundation Website | Blog | Projects | Code of Conduct