.csproj multiple hint paths for an assembly

后端 未结 6 1202
天涯浪人
天涯浪人 2020-12-04 12:42

I\'m packaging example code for an SDK distribution. In the distribution, the relative path from code to the SDK assemblies is different from the build machine. For exampl

6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-04 13:23

    The simplest way since only ONE HintPath can be used is to use the all-so-nice Condition attribute like this:

    
        ..\My\Assembly\Path\TheAssembly.dll
        ..\..\My\Assembly\Path\TheAssembly.dll
        ..\..\..\My\Assembly\Path\TheAssembly.dll
        ..\..\..\..\My\Assembly\Path\TheAssembly.dll
        ..\..\..\..\..\My\Assembly\Path\TheAssembly.dll
        ..\..\..\..\..\..\My\Assembly\Path\TheAssembly.dll
        ..\..\..\..\..\..\..\My\Assembly\Path\TheAssembly.dll
        etc...
    
    

    So the answer to the question would be this:

    
        ..\..\csharp\bin\assembly.dll
        ..\..\..\..\foo\sdk\csharp\bin\assembly.dll
    
    

    If multiple conditions matches, the last one will be used.

提交回复
热议问题