NuGet: references to assemblies in runtimes folder not added

后端 未结 6 1894
孤独总比滥情好
孤独总比滥情好 2021-01-01 15:23

I have a project that targets two different operating systems/frameworks:

  1. net461 on Windows and
  2. netcoreapp2.0 on OSX
  3. <
6条回答
  •  感情败类
    2021-01-01 16:20

    I'm trying to solve the same problem. The solution proposed by you works fine, but there is one question ... The case of Win and net46 is clear. And now I need to add a reference to the assembly in the project for a netcoreapp for the Win and for Linux. The problem is that this is a DIFFERENT assembly with the SAME name. Those my package looks like this:

    /lib/net461/myassembly1.dll                       (net461/Windows Compile and Runtime)
    /runtimes/ubuntu/lib/netcoreapp2.0/myassembly2.dll   (netcore/Ubuntu Runtime)
    /runtimes/win/lib/netcoreapp2.0/myassembly1.dll   (netcore/Win Runtime)
    /ref/netcoreapp2.0/???
    

    Update: Actually, the myassembly1.dll and myassembly2.dll are both called myassembly.dll. But to show that one is assembled for Windows, and the second one for Linux, I will leave here such a name.

    The most interesting thing is that I tried to put any assembly in the folder ref, and it works on both Windows and Linux. This version works on both systems

    /lib/net461/myassembly1.dll   
    /runtimes/ubuntu/lib/netcoreapp2.0/myassembly2.dll 
    /runtimes/win/lib/netcoreapp2.0/myassembly1.dll  
    /ref/netcoreapp2.0/myassembly1.dll
    

    And this too

    /lib/net461/myassembly1.dll   
    /runtimes/ubuntu/lib/netcoreapp2.0/myassembly2.dll 
    /runtimes/win/lib/netcoreapp2.0/myassembly1.dll  
    /ref/netcoreapp2.0/myassembly2.dll
    

    But I think this is not right and I was wrong somewhere.

提交回复
热议问题