-
Notifications
You must be signed in to change notification settings - Fork 67
Expand file tree
/
Copy pathAfter.Common.targets
More file actions
105 lines (84 loc) · 5.05 KB
/
After.Common.targets
File metadata and controls
105 lines (84 loc) · 5.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<!--
This file defines the common targets before the build.
This file might be updated by automation.
-->
<Project>
<!-- Ensures that if this file changes it forces a rebuild -->
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>
<PropertyGroup>
<BuildDependsOn>
GenerateAssemblyAttributeFile;
ExcludeAssemblyFilesFromSourceAnalysis;
$(BuildDependsOn);
</BuildDependsOn>
</PropertyGroup>
<Target Name="AfterBuild" DependsOnTargets="$(AfterBuildDependsOn)"/>
<!-- ********************************************************************************************* -->
<!-- ********************************************************************************************* -->
<!-- *** Exclude certain files globally from source analysis. In previous build system, these files-->
<!-- *** were globally excluded in a edit to StyleCop.targets. This replicates the same behavior. -->
<!-- ********************************************************************************************* -->
<Target Name="ExcludeAssemblyFilesFromSourceAnalysis">
<ItemGroup>
<Compile Condition="'%(Filename)%(Extension)'=='OpenApiODataAssemblyAttributes.cs'
or '%(Filename)%(Extension)'=='AssemblyRefs.cs'
or '%(Filename)%(Extension)'=='.NETFramework,Version=v4.0.AssemblyAttributes.cs'
or '%(Filename)%(Extension)'=='PlatformHelper.cs'
or '%(Filename)%(Extension)'=='VersionConstants.cs'
or '%(Filename)%(Extension)'=='AssemblyMetadataAttribute.cs'">
<ExcludeFromStyleCop>true</ExcludeFromStyleCop>
</Compile>
</ItemGroup>
</Target>
<!-- ********************************************************************************************* -->
<!-- ********************************************************************************************* -->
<!-- *** Generate a file with assembly attributes and hook it into the build -->
<!-- ********************************************************************************************* -->
<Target Name="GenerateAssemblyAttributeFile"
Inputs="$(MSBuildProjectFile);$(EnlistToolPath)\versioning.props"
Outputs="$(IntermediateOutputPath.TrimEnd('\'))\OpenApiODataAssemblyAttributes$(DefaultLanguageSourceExtension)"
Condition="'$(ShouldGenerateAssemblyAttributeFile)' == 'true'">
<PropertyGroup>
<!--Add more templates if we generate AssemblyAttribute files for other project types.-->
<GenerateAssemblyAttributeTemplate>UNDEFINED_GenerateAssemblyAttributeTemplate</GenerateAssemblyAttributeTemplate>
<GenerateAssemblyAttributeTemplateCSharp>
using System.Reflection;
using System.Resources;
[assembly: AssemblyDescription("%AssemblyNameFull%")]
[assembly: AssemblyTitle("%AssemblyNameFull%")]
[assembly: AssemblyDefaultAlias("%AssemblyNameFull%")]
[assembly: AssemblyFileVersion("%VersionFull%")]
[assembly: AssemblyInformationalVersion("%VersionFull%")]
[assembly: AssemblyVersion("%VersionFullSemantic%")]
[assembly: SatelliteContractVersion("%VersionFull%")]
[assembly: AssemblyMetadata("Serviceable", "True")]
</GenerateAssemblyAttributeTemplateCSharp>
</PropertyGroup>
<PropertyGroup>
<GenerateAssemblyAttributeTemplate>$(GenerateAssemblyAttributeTemplateCSharp)</GenerateAssemblyAttributeTemplate>
</PropertyGroup>
<PropertyGroup>
<AssemblyAttributeOutputFile>$(IntermediateOutputPath.TrimEnd("\\"))\OpenApiODataAssemblyAttributes$(DefaultLanguageSourceExtension)</AssemblyAttributeOutputFile>
<AssemblyNameFull>$(AssemblyName)$(TargetExt)</AssemblyNameFull>
<AssemblyAttributeFileContentsTransformed>$([System.String]::Copy('$(GenerateAssemblyAttributeTemplate)').Replace("%25AssemblyNameFull%25",$(AssemblyNameFull)).Replace("%25VersionFull%25",$(VersionFull)).Replace("%25VersionFullSemantic%25",$(VersionFullSemantic)))</AssemblyAttributeFileContentsTransformed>
</PropertyGroup>
<Message Text="GenerateAssemblyAttributeFile: Generating $(AssemblyAttributeOutputFile)" Importance="high" Condition="'$(DebugMessages)' == 'true'"/>
<MakeDir Directories="$(IntermediateOutputPath)" Condition="!Exists($(IntermediateOutputPath))"/>
<WriteLinesToFile
File="$(AssemblyAttributeOutputFile)"
Lines="$(AssemblyAttributeFileContentsTransformed)"
Overwrite="true"
Encoding="Unicode"
ContinueOnError="false"/>
<ItemGroup>
<Compile Include="$(AssemblyAttributeOutputFile)" />
</ItemGroup>
</Target>
<!-- ********************************************************************************************* -->
<!-- Execute StyleCop for each project -->
<Import Project="$(StyleCopTargets)" Condition="Exists('$(StyleCopTargets)') and '$(RunStyleCop)' == 'true' and '$(EnableStyleCop)' == 'true'"/>
<!-- Chain into the defaults from the toolset -->
<Import Condition="'$(DefaultCustomAfterMicrosoftCommonTargets)' != ''" Project="$(DefaultCustomAfterMicrosoftCommonTargets)" />
</Project>