If you always use Azure from a 64-bit machine, you can modify the project file to copy the desired DLL to the bin folder during build based on the processor type of the machine that builds. This works great for us because we are deploying Azure from a 64-bit build server. If this seems like a good solution, follow these steps:
1 - Create an external lib folder containing two subfolders named 32 and 64.
2 - Place the 32-bit version of the DLL in the 32-bit folder and the 64-bit version in the 64 folder.
3 - Open the project file with a violation in a text editor.
4 - Add the following node file to the project file immediately after the ItemGroup, which links the link elements. This will copy the correct DLL based on the system environment variables:
<ItemGroup> <DllToCopy Condition=" '$(PROCESSOR_ARCHITECTURE)' == 'x86' And '$(PROCESSOR_ARCHITEW6432)' == '' " Include="..\ext-lib\32\mydll.dll" /> <DllToCopy Condition=" '$(PROCESSOR_ARCHITECTURE)' == 'AMD64' Or '$(PROCESSOR_ARCHITEW6432)' == 'AMD64' " Include="..\ext-lib\64\mydll.dll" /> </ItemGroup>
5 - Finally, modify the BeforeBuild target as follows:
<Target Name="BeforeBuild"> <Copy SourceFiles="@(DllToCopy)" DestinationFolder="$(OutputPath)" /> </Target>
Another option is to copy the correct DLL to the bin folder based on the build configuration (less than ideal). For example, if you had an assembly configuration called Production, you would follow the steps above, except that step 4 would contain the following:
<ItemGroup> <DllToCopy Condition=" '$(Configuration)' != 'Production' " Include="..\ext-lib\32\mydll.dll" /> <DllToCopy Condition=" '$(Configuration)' == 'Production' Include="..\ext-lib\64\mydll.dll" /> </ItemGroup>
Another (and even less ideal) option would be to copy the 64-bit version of the DLL to the bin folder using the Azure startup task.
Hope this helps.
source share