Skip to content

Instantly share code, notes, and snippets.

@dcagnetta
Last active May 4, 2022 11:48
Show Gist options
  • Save dcagnetta/ae2e3b7541a747969eb7dd8d56a87d56 to your computer and use it in GitHub Desktop.
Save dcagnetta/ae2e3b7541a747969eb7dd8d56a87d56 to your computer and use it in GitHub Desktop.
<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>
<MinVerSkip Condition="'$(Configuration)' == 'Debug'">true</MinVerSkip>
<MinVerVerbosity>detailed</MinVerVerbosity>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup Label="Versioning">
<PackageReference Include="MinVer" PrivateAssets="All" Version="3.1.0" />
</ItemGroup>
<ItemGroup>
<Compile Include="Microsoft.Extensions.Caching.Abstractions.cs" />
<Compile Include="Microsoft.Extensions.Caching.Abstractions.net6.0.cs" Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net6.0'))" />
<Compile Include="Microsoft.Extensions.Caching.Abstractions.Typeforwards.netcoreapp.cs" Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'"/>
<Compile Include="$(CoreLibSharedDir)System\Runtime\CompilerServices\IsExternalInit.cs" Condition="'$(TargetFrameworkIdentifier)' != '.NETCoreApp'"
Link="Common\System\Runtime\CompilerServices\IsExternalInit.cs" />
</ItemGroup>
internal class Program
{
static void Main(string[] args)
{
var assemVersion = typeof(LibraryClass).Assembly.GetName().Version;
Console.WriteLine($"Assembly Version: {assemVersion}");
var versInfo = FileVersionInfo.GetVersionInfo(typeof(DateUtility).Assembly.Location);
string fileVersionFull = versInfo.FileVersion;
string fileVersionSemantic = $"{versInfo.FileMajorPart}.{versInfo.FileMinorPart}.{versInfo.FileBuildPart}";
string fileVersionFull2 = $"{versInfo.FileMajorPart}.{versInfo.FileMinorPart}.{versInfo.FileBuildPart}.{versInfo.FilePrivatePart}";
Console.WriteLine($"fileVersionFull: {fileVersionFull}");
Console.WriteLine($"fileVersionSemantic: {fileVersionSemantic}");
Console.WriteLine($"fileVersionFull2: {fileVersionFull2}");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment