Reputation: 8836
Suppose I build my project these ways.
dotnet publish -r win-x86
dotnet publish -r linux-musl-x64
Is there a way in my .csproj
file to automatically include a native DLL based on the chosen RID?
Upvotes: 7
Views: 1996
Reputation: 119076
You just need a Condition
on the element you want to control in the csproj file. For example:
<PackageReference Include="MyLibrary.Linux" Version="1.0.0"
Condition="'$(RuntimeIdentifier)'=='linux-x64'" />
<PackageReference Include="MyLibrary.Windows" Version="1.0.0"
Condition="'$(RuntimeIdentifier)'=='win-x64'" />
Upvotes: 13