I am using .NET Core to build a cross platform class library. Depending on the operating system that the C# .NET Core project is built for using a .csproj file, I need to copy a native library to the project's output directory. E.g., for OS X I want to copy a .dylib file, for Windows I want to copy a .DLL file, for Linux I want to copy a .so file.
How can I do this with a Condition clause in a .csproj ItemGroup?
<ItemGroup>
<Content Include="libNative.dylib" Condition=" '$(Configuration)|$(Platform)' == 'Debug|OSX' ">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
$(Platform)
does not seem to work. Is there a different variable I can use?
Platform=AnyCPU
but that's the same for Windows and Linux builds. – Gavette