Using .net standard 1.5 lib in .net 4.6.2 misses System.Runtime 4.1.0.0

后端 未结 2 1168
难免孤独
难免孤独 2020-12-03 15:09

I\'ve some problem when using .net standard in .net framework 4.6.2 consoleapps.

I could reduce the problem to this: Given:

I create a .net standard 1.5 clie

2条回答
  •  悲&欢浪女
    2020-12-03 15:55

    I found that adding the NETStandard.Library did not work for me, but ensuring that binding redirects were generated on build did the trick. For that you should ensure that you have

    
        true
    
    

    somewhere in your project file. This should work for console or web apps. If you're having problems running unit tests, you can use this:

    
        true
        true
    
    

    The GenerateBindingRedirectsOutputType is necessary as the unit tests are contained in a class library which doesn't have executable output by default, so this forces any redirect configuration to be written into the build artifacts, ready to be used when the tests are executing.

    You can find more details of the issues involved here: https://github.com/dotnet/announcements/issues/31

提交回复
热议问题