Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jnm2/94ff56a2cbc95279d155ec542fd6f0ed to your computer and use it in GitHub Desktop.
Save jnm2/94ff56a2cbc95279d155ec542fd6f0ed to your computer and use it in GitHub Desktop.
For when you need refout rather than refonly two produce two artifacts: a ref assembly NuGet package, and a non-NuGet distribution mechanism for the lib assembly.
<Project Sdk="Microsoft.NET.Sdk">
<!-- ... -->
<!-- Ref assembly NuGet packaging -->
<PropertyGroup>
<ProduceReferenceAssembly>true</ProduceReferenceAssembly>
<BuildOutputTargetFolder>ref</BuildOutputTargetFolder>
<TargetsForTfmSpecificBuildOutput>$(TargetsForTfmSpecificBuildOutput);UseRefAssemblyAsBuildOutputInPackage</TargetsForTfmSpecificBuildOutput>
</PropertyGroup>
<Target Name="UseRefAssemblyAsBuildOutputInPackage">
<ItemGroup>
<BuiltProjectOutputGroupOutput Remove="@(BuiltProjectOutputGroupOutput)" />
<BuildOutputInPackage Include="@(IntermediateRefAssembly)" />
</ItemGroup>
</Target>
</Project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment