1
0
Fork 0
mirror of https://github.com/VSadov/Satori.git synced 2025-06-09 17:44:48 +09:00
Satori/eng/versioning.targets
Jan Kotas ab7ef9b292
CoreCLR versions cleanup (#35327)
- Use current version numbers everywhere
- Use product version (e.g. 5.0.0) for all user facing versions
- Use file version (e.g. 5.0.20.21010) only when the exact version information is required
- Reduce number of layers of version macro definitions
2020-04-25 05:32:49 -07:00

134 lines
6.6 KiB
XML

<Project>
<PropertyGroup>
<GenerateAssemblyInfo Condition="'$(GenerateAssemblyInfo)'==''">true</GenerateAssemblyInfo>
</PropertyGroup>
<PropertyGroup Condition="'$(GenerateAssemblyInfo)'=='true'">
<AssemblyInfoFile Condition="'$(MSBuildProjectExtension)' == '.csproj'">$(IntermediateOutputPath)_AssemblyInfo.cs</AssemblyInfoFile>
<AssemblyInfoFile Condition="'$(MSBuildProjectExtension)' == '.vbproj'">$(IntermediateOutputPath)_AssemblyInfo.vb</AssemblyInfoFile>
</PropertyGroup>
<!-- Assembly metadata indicating that an assembly is a framework (as opposed to user) assembly:
Test projects need to not have this because of the way "IsFrameworkAssembly" APIs work to check this. -->
<ItemGroup Condition="'$(IsTestProject)' != 'true'" >
<AssemblyMetadata Include=".NETFrameworkAssembly">
<Value></Value>
</AssemblyMetadata>
<AssemblyMetadata Include="Serviceable">
<Value>True</Value>
</AssemblyMetadata>
<AssemblyMetadata Include="PreferInbox">
<Value>True</Value>
</AssemblyMetadata>
</ItemGroup>
<Target Name="DecideIfWeNeedToIncludeDllSafeSearchPathAttribute"
Condition="'$(IsDotNetFrameworkProductAssembly)' == 'true' and '$(IsTestProject)' != 'true'">
<!-- We want to apply the IncludeDllSafeSearchPathAttribute on all DotNet assemblies (non test) that have a reference to System.Runtime.InteropServices -->
<PropertyGroup Condition="'$(IncludeDllSafeSearchPathAttribute)'==''">
<IncludeDllSafeSearchPathAttribute>false</IncludeDllSafeSearchPathAttribute> <!-- We don't need to include it by default. -->
<IncludeDllSafeSearchPathAttribute Condition="'%(ProjectReference.Filename)'=='System.Runtime.InteropServices'">true</IncludeDllSafeSearchPathAttribute>
<IncludeDllSafeSearchPathAttribute Condition="'%(Reference.Identity)'=='System.Runtime.InteropServices'">true</IncludeDllSafeSearchPathAttribute>
</PropertyGroup>
</Target>
<PropertyGroup>
<!-- corefx has never generated these attributes so don't let the SDK generate them -->
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateNeutralResourcesLanguageAttribute>false</GenerateNeutralResourcesLanguageAttribute>
<!-- corefx has always added a description set to assembly name so include that here -->
<Description Condition="'$(Description)' == ''">$(AssemblyName)</Description>
<!-- SDK sets product to assembly but we want it to be our product name -->
<Product>Microsoft%AE .NET</Product>
<!-- Use the .NET product branding version for informational version description -->
<InformationalVersion>$(ProductVersion)</InformationalVersion>
<InformationalVersion Condition="'$(VersionSuffix)' != ''">$(InformationalVersion)-$(VersionSuffix)</InformationalVersion>
</PropertyGroup>
<Target Name="_ComputeBuildToolsAssemblyInfoAttributes"
DependsOnTargets="DecideIfWeNeedToIncludeDllSafeSearchPathAttribute"
BeforeTargets="GetAssemblyAttributes">
<ItemGroup>
<AssemblyAttribute Include="System.Reflection.AssemblyDefaultAliasAttribute">
<_Parameter1>$(AssemblyName)</_Parameter1>
</AssemblyAttribute>
<AssemblyAttribute Include="System.Reflection.AssemblyMetadata"
Condition="'$(SkipFrameworkAssemblyMetadata)' != 'true' and '@(AssemblyMetadata)' != ''">
<_Parameter1>%(AssemblyMetadata.Identity)</_Parameter1>
<_Parameter2>%(AssemblyMetadata.Value)</_Parameter2>
</AssemblyAttribute>
</ItemGroup>
</Target>
<!-- Work around https://github.com/Microsoft/msbuild/issues/3412 by writing the non-string assembly attributes manually -->
<!-- Note: ReferenceAssemblies.targets still uses @(AssemblyInfoLines) as well. So if you remove this, those need to migrate too. -->
<Target Name="_WriteNonStringAssemblyInfoAttributes"
AfterTargets="CoreGenerateAssemblyInfo"
BeforeTargets="BeforeCompile;CoreCompile"
Inputs="$(MSBuildProjectFile)"
Outputs="$(AssemblyInfoFile)">
<ItemGroup Condition="'$(MSBuildProjectExtension)' == '.csproj'">
<AssemblyInfoLines Condition="'$(CLSCompliant)'=='true'" Include="[assembly:System.CLSCompliant(true)]" />
<AssemblyInfoLines Condition="'$(IncludeDllSafeSearchPathAttribute)'=='true'"
Include="[assembly: System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute(System.Runtime.InteropServices.DllImportSearchPath.AssemblyDirectory | System.Runtime.InteropServices.DllImportSearchPath.System32)]" />
</ItemGroup>
<ItemGroup Condition="'$(MSBuildProjectExtension)' == '.vbproj'">
<AssemblyInfoLines Condition="'$(CLSCompliant)'=='true'" Include="&lt;Assembly:System.CLSCompliant(True)&gt;" />
<AssemblyInfoLines Condition="'$(IncludeDllSafeSearchPathAttribute)'=='true'"
Include="&lt;Assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute(System.Runtime.InteropServices.DllImportSearchPath.AssemblyDirectory Or System.Runtime.InteropServices.DllImportSearchPath.System32)&gt;" />
</ItemGroup>
<WriteLinesToFile File="$(AssemblyInfoFile)"
Lines="@(AssemblyInfoLines)"
Condition="'@(AssemblyInfoLines)' != ''"
Overwrite="true" />
<ItemGroup Condition="'@(AssemblyInfoLines)' != ''">
<Compile Include="$(AssemblyInfoFile)" />
<FileWrites Include="$(AssemblyInfoFile)" />
</ItemGroup>
</Target>
<Target Name="GenerateRuntimeVersionFile"
DependsOnTargets="GenerateNativeVersionFile">
<PropertyGroup>
<RuntimeVersionFile Condition="'$(RuntimeVersionFile)' == ''">$(ArtifactsObjDir)runtime_version.h</RuntimeVersionFile>
<_RuntimeVersionFileContents>
<![CDATA[
#define RuntimeAssemblyMajorVersion $(MajorVersion)
#define RuntimeAssemblyMinorVersion $(MinorVersion)
#define RuntimeFileMajorVersion $(FileVersion.Split('.')[0])
#define RuntimeFileMinorVersion $(FileVersion.Split('.')[1])
#define RuntimeFileBuildVersion $(FileVersion.Split('.')[2])
#define RuntimeFileRevisionVersion $(FileVersion.Split('.')[3])
#define RuntimeProductMajorVersion $(Version.Split(".-")[0])
#define RuntimeProductMinorVersion $(Version.Split(".-")[1])
#define RuntimeProductPatchVersion $(Version.Split(".-")[2])
#define RuntimeProductVersion $(Version)
]]>
</_RuntimeVersionFileContents>
</PropertyGroup>
<MakeDir Directories="$([System.IO.Path]::GetDirectoryName($(RuntimeVersionFile)))" />
<WriteLinesToFile
File="$(RuntimeVersionFile)"
Lines="$(_RuntimeVersionFileContents)"
Overwrite="true" />
</Target>
</Project>