forked from microsoft/dotnet-apiport
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dir.targets
96 lines (88 loc) · 4.44 KB
/
dir.targets
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
<?xml version="1.0" encoding="utf-8"?>
<Project>
<!-- Depending on whether it is a VSIX or MSIL, choose the correct certificate.
1) By default, the VSIX project just packages the contents, so
CopyBuildOutputToOutputDirectory/IncludeAssemblyInVSIXContainer will be
false. But if you have a VSIX that builds a DLL as well, it will have both
properties set as true.
2) When conditions are chosen from top-down... so if multiple ones are true,
the first one it encounters is the type it chooses.
-->
<Choose>
<When Condition="'$(TargetVsixContainerName)' != '' AND '$(CopyBuildOutputToOutputDirectory)' == 'false' AND '$(IncludeAssemblyInVSIXContainer)' == 'false'">
<ItemGroup>
<FilesToSign Include="$(TargetVsixContainer)">
<Authenticode>VsixSHA2</Authenticode>
</FilesToSign>
</ItemGroup>
</When>
<When Condition="'$(OutputType)' == 'Exe' OR '$(OutputType)' == 'Library'">
<ItemGroup>
<FilesToSign Include="$(OutDir)\$(TargetName)$(TargetExt)">
<Authenticode>Microsoft</Authenticode>
</FilesToSign>
</ItemGroup>
</When>
<Otherwise>
<ItemGroup>
<FilesToSign Include="$(OutDir)\$(TargetName)$(TargetExt)">
<Authenticode>MicrosoftSHA1</Authenticode>
</FilesToSign>
</ItemGroup>
</Otherwise>
</Choose>
<PropertyGroup>
<!-- When building from a dev machine, the BuildNumber won't be set, so set it to 0.1 to indicate this is a private build -->
<BuildVersion>0</BuildVersion>
<!-- Get build number from TFS if in automated build -->
<!-- Use TF_BUILD_BUILDNUMBER for old XAML style builds -->
<BuildVersion Condition=" '$(BUILD_BUILDNUMBER)' != '' ">$(BUILD_BUILDNUMBER.Split('.')[1].TrimStart('0'))</BuildVersion>
<BuildVersion>$(BuildVersion.PadLeft(5,"0"))</BuildVersion>
<!-- Get version info from file -->
<VersionFile>$(MSBuildProjectDirectory)\Properties\version.txt</VersionFile>
<VersionData>1.0.0</VersionData>
<VersionData Condition="Exists('$(VersionFile)')">$([System.IO.File]::ReadAllText($(VersionFile)).Trim())</VersionData>
<!-- Set informational version -->
<InformationVersion>$(VersionData)</InformationVersion>
<InformationVersion Condition=" '$(VersionSuffix)' != '' ">$(InformationVersion)-$(VersionSuffix)-$(BuildVersion)</InformationVersion>
</PropertyGroup>
<ItemGroup>
<AssemblyVersionAttribute Include="System.Reflection.AssemblyVersionAttribute">
<_Parameter1>$(VersionData)</_Parameter1>
</AssemblyVersionAttribute>
<AssemblyVersionAttribute Include="System.Reflection.AssemblyFileVersionAttribute">
<_Parameter1>$(VersionData)</_Parameter1>
</AssemblyVersionAttribute>
<AssemblyVersionAttribute Include="System.Reflection.AssemblyInformationalVersionAttribute">
<_Parameter1>$(InformationVersion)</_Parameter1>
</AssemblyVersionAttribute>
<AssemblyVersionAttribute Include="System.Reflection.AssemblyTitle">
<_Parameter1>$(AssemblyName)</_Parameter1>
</AssemblyVersionAttribute>
<AssemblyVersionAttribute Include="System.Reflection.AssemblyProduct">
<_Parameter1>$(AssemblyName)</_Parameter1>
</AssemblyVersionAttribute>
<AssemblyVersionAttribute Include="System.Reflection.AssemblyCopyright">
<_Parameter1>Copyright 2016</_Parameter1>
</AssemblyVersionAttribute>
<AssemblyVersionAttribute Include="System.Reflection.AssemblyCompany">
<_Parameter1>Microsoft</_Parameter1>
</AssemblyVersionAttribute>
</ItemGroup>
<Target Name="GenerateAssemblyInfoFile" BeforeTargets="BeforeBuild">
<MakeDir Directories="$(IntermediateOutputPath)" Condition="!Exists('$(IntermediateOutputPath)')" />
<WriteCodeFragment AssemblyAttributes="@(AssemblyVersionAttribute)" Language="C#" OutputFile="$(IntermediateOutputPath)\_GlobalAssemblyInfo.g.cs">
<Output TaskParameter="OutputFile" ItemName="Compile" />
<Output TaskParameter="OutputFile" ItemName="FileWrites" />
</WriteCodeFragment>
</Target>
<!-- In .NET Core SDK 1.0-rc3, all *.cs files are implicitly added for compiled. This includes the test files we embed as resources.
We explicitly remove them here so that they are not compiled.
BUG: https://github.com/dotnet/sdk/issues/977 -->
<Target Name="RemoveEmbeddedResources"
BeforeTargets="CoreCompile">
<ItemGroup>
<Compile Remove="@(EmbeddedResource-> '%(Identity)')" />
</ItemGroup>
</Target>
</Project>