Skip to content

Instantly share code, notes, and snippets.

@dcagnetta
Created August 16, 2022 13:34
Show Gist options
  • Save dcagnetta/b66c0ab25a14dc159775e074488870f6 to your computer and use it in GitHub Desktop.
Save dcagnetta/b66c0ab25a14dc159775e074488870f6 to your computer and use it in GitHub Desktop.
Directory.Build Files
<Project>
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<PropertyGroup Label="Settings">
<!--produce an assembly whose byte-for-byte output is identical across compilations for identical inputs.-->
<Deterministic>true</Deterministic>
<DebugSymbols>true</DebugSymbols>
<!--Emit debugging information into the .dll-->
<DebugType>embedded</DebugType>
<IsPackable>true</IsPackable>
</PropertyGroup>
<PropertyGroup Label="Source Link">
<!-- Optional: Declare that the Repository URL can be published to NuSpec -->
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<!-- Optional: Embed source files that are not tracked by the source control manager to the PDB -->
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<!-- Optional: Include PDB in the built .nupkg -->
<AllowedOutputExtensionsInPackageBuildOutputFolder>.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
<!-- Optional: Build symbol package (.snupkg) to distribute the PDB containing Source Link -->
<IncludeSymbols>true</IncludeSymbols>
<!-- <SymbolPackageFormat>snupkg</SymbolPackageFormat> -->
</PropertyGroup>
<ItemGroup Label="Package References">
<PackageReference Include="MinVer" PrivateAssets="All" Version="3.1.0" />
<!-- Provided first-class source debugging experiences for binaries -->
<PackageReference Include="Microsoft.SourceLink.Bitbucket.Git" Version="1.1.1" PrivateAssets="All"/>
<PackageReference Include="Common.Logging" Version="3.4.1" />
<PackageReference Include="Common.Logging.Core" Version="3.4.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>
</Project>
<Project>
<Target Name="Versioning" BeforeTargets="MinVer">
<PropertyGroup Label="Build">
<MinVerDefaultPreReleasePhase>preview</MinVerDefaultPreReleasePhase>
<!-- Tag your repository with the semantic version e.g. '1.0.0' to version all NuGet packages. If you have
multiple NuGet packages in your solution and want to version them separately, then uncomment this line
and tag your repository with the name of the package followed by the semantic version e.g.
'PackageName-1.0.0'. -->
<!-- <MinVerTagPrefix>$(PackageId).</MinVerTagPrefix> -->
<MinVerSkip Condition="'$(Configuration)' == 'Debug'">true</MinVerSkip>
<MinVerVerbosity>normal</MinVerVerbosity>
</PropertyGroup>
</Target>
<!-- Production -->
<Target Name="MyTarget" AfterTargets="MinVer" Condition="'$(BITBUCKET_TAG)' != '' " >
<PropertyGroup>
<FileVersion>$(MinVerMajor).$(MinVerMinor).$(MinVerPatch).$(BITBUCKET_BUILD_NUMBER)</FileVersion>
<PackageVersion>$(MinVerMajor).$(MinVerMinor).$(MinVerPatch)</PackageVersion>
<Version>$(PackageVersion)</Version>
</PropertyGroup>
</Target>
<!-- Preview -->
<Target Name="MyTarget" AfterTargets="MinVer" Condition="'$(BITBUCKET_TAG)' == '' " >
<PropertyGroup>
<FileVersion>$(MinVerMajor).$(MinVerMinor).$(MinVerPatch).$(BITBUCKET_BUILD_NUMBER)</FileVersion>
</PropertyGroup>
</Target>
</Project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment