- Switch to explicit "3.2.0" next-version in GitVersion.yml - Update NuGet packages and set assembly name to "ImageCatalog" - Add MSBuild target to rename published exe with year and version - Add AppVersion property to DataModel, set via IVersionProvider - Replace static version label with data-bound versionLabel in UI - Remove manual version label logic from MainForm - Update DI to inject IVersionProvider into DataModel - Ensures UI always shows correct version and builds are versioned
123 lines
No EOL
5.7 KiB
XML
123 lines
No EOL
5.7 KiB
XML
<Project Sdk="Microsoft.NET.Sdk">
|
|
<PropertyGroup>
|
|
<OutputType>WinExe</OutputType>
|
|
<TargetFramework>net10.0-windows</TargetFramework>
|
|
<Nullable>enable</Nullable>
|
|
<ImplicitUsings>enable</ImplicitUsings>
|
|
<UseWindowsForms>true</UseWindowsForms>
|
|
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
|
<AssemblyVersion>3.1.2.0</AssemblyVersion>
|
|
<FileVersion>3.1.2.0</FileVersion>
|
|
<InformationalVersion>3.1.2</InformationalVersion>
|
|
<Version>3.1.2</Version>
|
|
<!-- Default assembly name for regular builds -->
|
|
<AssemblyName>ImageCatalog</AssemblyName>
|
|
<LangVersion>default</LangVersion>
|
|
<ApplicationIcon>Logo.ico</ApplicationIcon>
|
|
</PropertyGroup>
|
|
<PropertyGroup>
|
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
|
</PropertyGroup>
|
|
<PropertyGroup>
|
|
<UpdateVersionProperties>true</UpdateVersionProperties>
|
|
</PropertyGroup>
|
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
|
<DebugType>embedded</DebugType>
|
|
</PropertyGroup>
|
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
|
<DebugType>embedded</DebugType>
|
|
</PropertyGroup>
|
|
<ItemGroup>
|
|
<None Update="Properties\Settings.settings">
|
|
<Generator>SettingsSingleFileGenerator</Generator>
|
|
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
|
</None>
|
|
</ItemGroup>
|
|
<ItemGroup>
|
|
<Folder Include="Sorgenti\" />
|
|
</ItemGroup>
|
|
<ItemGroup>
|
|
<ProjectReference Include="..\MaddoShared\MaddoShared.csproj" />
|
|
</ItemGroup>
|
|
<ItemGroup>
|
|
<PackageReference Include="AutoMapper" Version="16.0.0" />
|
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.3" />
|
|
<PackageReference Include="Microsoft.Extensions.Logging" Version="10.0.3" />
|
|
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="10.0.3" />
|
|
<PackageReference Include="GitVersion.MsBuild" Version="6.5.1" PrivateAssets="all" />
|
|
<PackageReference Include="Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers" Version="0.4.421302">
|
|
<PrivateAssets>all</PrivateAssets>
|
|
</PackageReference>
|
|
</ItemGroup>
|
|
<ItemGroup>
|
|
<Compile Update="Properties\Settings.Designer.cs">
|
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
|
<AutoGen>True</AutoGen>
|
|
<DependentUpon>Settings.settings</DependentUpon>
|
|
</Compile>
|
|
</ItemGroup>
|
|
<ItemGroup>
|
|
<EmbeddedResource Update="MainForm.resx">
|
|
<DependentUpon>MainForm.cs</DependentUpon>
|
|
</EmbeddedResource>
|
|
</ItemGroup>
|
|
<PropertyGroup />
|
|
|
|
<!-- After publish, rename the produced executable to ImageCatalog.<year>.<major>.<minor>.<build>.<revision>.<ext>
|
|
The destination extension is taken from the actual produced file (exe or dll).
|
|
-->
|
|
<Target Name="RenamePublishedExeWithYearAndVersion" AfterTargets="Publish" Condition="'$(PublishDir)' != ''">
|
|
<PropertyGroup>
|
|
<_PublishYear>$([System.DateTime]::Now.ToString("yyyy"))</_PublishYear>
|
|
<!-- Prefer FileVersion (four-part) then AssemblyVersion -->
|
|
<_Ver>$(FileVersion)</_Ver>
|
|
<_Ver Condition="'$(_Ver)' == ''">$(AssemblyVersion)</_Ver>
|
|
|
|
<!-- Normalize to avoid plus signs and spaces -->
|
|
<_VerSanitized>$([System.String]::Copy('$(_Ver)'))</_VerSanitized>
|
|
<_VerSanitized>$([System.String]::Copy('$(_VerSanitized)').Replace('+', '.'))</_VerSanitized>
|
|
<_VerSanitized>$([System.String]::Copy('$(_VerSanitized)').Replace(' ', '_'))</_VerSanitized>
|
|
|
|
<_NewExeNameBase>ImageCatalog.$(_PublishYear).$(_VerSanitized)</_NewExeNameBase>
|
|
</PropertyGroup>
|
|
|
|
<Message Text="Attempting to find published assembly to rename to $(_NewExeNameBase).* in $(PublishDir)" Importance="High" />
|
|
|
|
<!-- Candidate locations in order of likelihood -->
|
|
<PropertyGroup>
|
|
<_Candidate1>$(PublishDir)$(TargetFileName)</_Candidate1>
|
|
<_Candidate2>$(PublishDir)$(TargetName)$(TargetExt)</_Candidate2>
|
|
<_Candidate3>$(PublishDir)$(TargetName).exe</_Candidate3>
|
|
<_Candidate4>$(PublishDir)$(AssemblyName)$(TargetExt)</_Candidate4>
|
|
<_Candidate5>$(PublishDir)$(AssemblyName).exe</_Candidate5>
|
|
</PropertyGroup>
|
|
|
|
<!-- Pick the first existing candidate and compute destination using its extension -->
|
|
<PropertyGroup Condition="Exists('$(_Candidate1)') and '$(_CandidateFound)' == ''">
|
|
<_CandidateFound>$(_Candidate1)</_CandidateFound>
|
|
</PropertyGroup>
|
|
<PropertyGroup Condition="Exists('$(_Candidate2)') and '$(_CandidateFound)' == ''">
|
|
<_CandidateFound>$(_Candidate2)</_CandidateFound>
|
|
</PropertyGroup>
|
|
<PropertyGroup Condition="Exists('$(_Candidate3)') and '$(_CandidateFound)' == ''">
|
|
<_CandidateFound>$(_Candidate3)</_CandidateFound>
|
|
</PropertyGroup>
|
|
<PropertyGroup Condition="Exists('$(_Candidate4)') and '$(_CandidateFound)' == ''">
|
|
<_CandidateFound>$(_Candidate4)</_CandidateFound>
|
|
</PropertyGroup>
|
|
<PropertyGroup Condition="Exists('$(_Candidate5)') and '$(_CandidateFound)' == ''">
|
|
<_CandidateFound>$(_Candidate5)</_CandidateFound>
|
|
</PropertyGroup>
|
|
|
|
<!-- If a candidate was found, compute destination using its extension and perform copy/delete -->
|
|
<PropertyGroup Condition="'$(_CandidateFound)' != ''">
|
|
<_FoundExt>$([System.IO.Path]::GetExtension('$(_CandidateFound)'))</_FoundExt>
|
|
<_DestExe>$(PublishDir)$(_NewExeNameBase)$(_FoundExt)</_DestExe>
|
|
</PropertyGroup>
|
|
|
|
<Message Text="Found candidate: $(_CandidateFound). Renaming to $(_DestExe)" Importance="High" Condition="'$(_CandidateFound)' != ''" />
|
|
|
|
<Copy SourceFiles="$(_CandidateFound)" DestinationFiles="$(_DestExe)" SkipUnchangedFiles="false" Condition="'$(_CandidateFound)' != ''" />
|
|
<Delete Files="$(_CandidateFound)" Condition="'$(_CandidateFound)' != ''" />
|
|
</Target>
|
|
</Project> |