glumesc

December 14, 2009

Setting assembly search paths depending on an environment variable

Filed under: Development — Tags: , — steve @ 10:27 pm

In the previous post, I mentioned an edit that can be made to the csproj file to change the assembly search paths based on an environment variable.  This is the relevant XML snippet:


  <Target Name="BeforeResolveReferences">
    <CreateProperty Value="$(MySearchPath);$(AssemblySearchPaths)">
      <Output TaskParameter="Value" PropertyName="AssemblySearchPaths" />
    </CreateProperty>
  </Target>


Alternatively, the following may also work, although I haven’t tried it:


  <Target Name="BeforeResolveReferences">
    <CreateProperty Value="$(Myx64SearchPath);$(AssemblySearchPaths)" Condition="('$(Platform)' == 'x64')">
      <Output TaskParameter="Value" PropertyName="AssemblySearchPaths" />
    </CreateProperty>
    <CreateProperty Value="$(Myx86SearchPath);$(AssemblySearchPaths)" Condition="('$(Platform)' == 'x86')">
      <Output TaskParameter="Value" PropertyName="AssemblySearchPaths" />
    </CreateProperty>
  </Target>


As I said previously, this didn’t prove useful to me, however it may be of interest in the future.

Theme: Silver is the New Black. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.