StampAssemblyInfo

This commit is contained in:
tian-lt 2021-07-07 12:45:06 +08:00
commit 8915ce1105
3 changed files with 30 additions and 17 deletions

View file

@ -139,12 +139,6 @@
<PropertyGroup>
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
</PropertyGroup>
<PropertyGroup>
<AppVersion Condition="'$(AppVersion)' == ''">0.0.0.0</AppVersion>
</PropertyGroup>
<ItemGroup>
<ResourceCompile Include="Calculator.rc" PreprocessorDefinitions="%(PreprocessorDefinitions);APP_VERSION_MAJOR=$(AppVersion.Split(`.`)[0]);APP_VERSION_MINOR=$(AppVersion.Split(`.`)[1]);APP_VERSION_BUILD=$(AppVersion.Split(`.`)[2]);APP_VERSION_REVISION=$(AppVersion.Split(`.`)[3])" />
</ItemGroup>
<ItemGroup>
<Compile Include="AboutFlyout.xaml.cs">
<DependentUpon>AboutFlyout.xaml</DependentUpon>
@ -835,6 +829,7 @@
</ItemGroup>
</Target>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<Import Project="$(SolutionDir)build\Calculator.StampAssemblyInfo.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">

View file

@ -1,11 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// CSHARP_MIGRATION: TODO:
#define APP_FILE_NAME "Calculator"
#define APP_FILE_IS_EXE
#define APP_PRODUCT_NAME "Microsoft Calculator"
#define APP_COMPANY_NAME "Microsoft Corporation"
#define APP_COPYRIGHT "\251 Microsoft Corporation. All rights reserved."
#include "../build/appversion.rc"

View file

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8" ?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--
For .NET Core SDK-style projects, the "Version" MSBuild property is written into assembly files
automatically. This target provides the same feature in non-SDK-style projects using a
generated file.
-->
<PropertyGroup Condition="'$(Version)' != ''">
<CompileDependsOn>StampAssemblyInfo;$(CompileDependsOn)</CompileDependsOn>
</PropertyGroup>
<Target Name="StampAssemblyInfo">
<ItemGroup>
<AssemblyAttributes Include="AssemblyVersion">
<_Parameter1>$(Version)</_Parameter1>
</AssemblyAttributes>
</ItemGroup>
<WriteCodeFragment AssemblyAttributes="@(AssemblyAttributes)"
Language="C#"
OutputDirectory="$(IntermediateOutputPath)"
OutputFile="GeneratedAssemblyInfo.cs">
<Output TaskParameter="OutputFile" ItemName="Compile" />
<Output TaskParameter="OutputFile" ItemName="FileWrites" />
</WriteCodeFragment>
</Target>
</Project>