Reputation: 2569
I have some native dlls that come in 2 flavors - built for x86 and x64. Based on my project platform configuration, I would like to copy the right dlls into the folder.
What I tried
<ItemGroup>
<_nativex86 Include="native\myNativex86folder\*.*" />
<_nativex64 Include="native\myNativex64folder\*.* />
</ItemGroup>
<Target Name="AfterBuild">
<Copy Condition="$(Platform) == x86"
SourceFiles = "$(_nativex86)"
DestinationFolder = "$(OutputPath)native" />
<Copy Condition="$(Platform) == x64"
SourceFiles = "$(_nativex64)"
DestinationFolder = "$(OutputPath)native" />
</Target>
However, nothing gets copied. What could I do?
Upvotes: 1
Views: 1148
Reputation: 14059
Try the following:
<ItemGroup>
<_nativex86 Include="native\myNativex86folder\*.*" />
<_nativex64 Include="native\myNativex64folder\*.* />
</ItemGroup>
<Target Name="AfterBuild">
<Copy Condition=" '$(Platform)' == 'x86' "
SourceFiles = "$(_nativex86)"
DestinationFolder = "$(TargetDir)native" />
<Copy Condition=" '$(Platform)' == 'x64' "
SourceFiles = "$(_nativex64)"
DestinationFolder = "$(TargetDir)native" />
</Target>
I added quotes for values in the Condition
s.
You can try also prepend "native" paths with $(SolutionDir)
(or $(ProjectDir)
, $(OutputPath)
etc depending on where the files are located) to make them full paths.
Upvotes: 1