How to conditionally reference a DLL based on a compilation symbol?

后端 未结 1 1626
清酒与你
清酒与你 2020-12-29 10:05

Visual Studio 2013.

I have an external DLL which I am referencing like this in the csproj file:

  
    

        
相关标签:
1条回答
  • 2020-12-29 10:19

    The conditional compilation symbols are in the DefineConstants MSBuild property. Check that this contains your symbol:

    <Reference Include="NameOfDll" Condition="$(DefineConstants.Contains('Fred'))">
      <HintPath>Path\To\Dll\NameOfDll.dll</HintPath>
    </Reference>
    

    Pick a distinctive name for the symbol. Not something that could be a substring of another constant like Debug or Trace.

    0 讨论(0)
提交回复
热议问题