Referencing a .NET Standard library from a Windows Class Library

后端 未结 3 1335
鱼传尺愫
鱼传尺愫 2020-12-14 08:57

There are two projects in my solution currently: a Windows Class Library (targeting .NET Framework 4.6.1) and another class library that targets .NE

3条回答
  •  眼角桃花
    2020-12-14 09:30

    Referencing .NET Standard in a project that targets the full framework does not work correctly yet. Instead, your project must target multiple frameworks.

    If you are using the new tooling (with VS 2017), i.e. the csproj project format, you can set multiple target in the TargetFrameworks tag:

    
      
        netstandard1.3;net46
      
    
    

    If you need to, you can set different dependencies for each target:

    
      
        netstandard1.3;net46
      
    
      
        
        
        
      
    
      
        
      
    
    

    By default the NETStandard.Library is automatically added. If you want to remove it, use PackageReference Remove="NETStandard.Library"/>.

提交回复
热议问题