forked from webappsuk/CoreLibraries
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCommon.proj
209 lines (185 loc) · 12.1 KB
/
Common.proj
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Standard common properties -->
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<AppDesignerFolder>Properties</AppDesignerFolder>
<FileAlignment>512</FileAlignment>
<OldToolsVersion>4.0</OldToolsVersion>
<RestorePackages>true</RestorePackages>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">12.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<!-- Force the solution directory to the same as the file -->
<SlnDir>$(MSBuildThisFileDirectory)</SlnDir>
<SlnDir Condition="!HasTrailingSlash('$(SlnDir)')">$(SlnDir)\</SlnDir>
<SolutionDir>$(SlnDir)</SolutionDir>
<ResourcesPath>$(SlnDir)Utilities\Resources\</ResourcesPath>
</PropertyGroup>
<!-- Configuration specific properties -->
<PropertyGroup Condition=" '$(CustomPlatforms)' != 'true' AND '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<DefineConstants>TRACE;DEBUG;$(DefineConstants)</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>AnyCPU</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
<RunSignTool>false</RunSignTool>
</PropertyGroup>
<PropertyGroup Condition=" '$(CustomPlatforms)' != 'true' AND '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<DefineConstants>TRACE;$(DefineConstants)</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>AnyCPU</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
<IsRelease>true</IsRelease>
<RunSignTool>true</RunSignTool>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'NuGet'">
<BuildPackage>true</BuildPackage>
<PackageOutputDir>$(SlnDir)nugets</PackageOutputDir>
<IsRelease>true</IsRelease>
<RunSignTool>true</RunSignTool>
</PropertyGroup>
<PropertyGroup Condition=" '$(CustomPlatforms)' != 'true' AND '$(Configuration)' == 'NuGet' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<DefineConstants>TRACE;$(DefineConstants)</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>AnyCPU</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(CustomPlatforms)' != 'true'">
<OutputPath>bin\$(Configuration)\$(Platform)\</OutputPath>
<DocumentationFile>bin\$(Configuration)\$(Platform)\$(AssemblyName).xml</DocumentationFile>
</PropertyGroup>
<!-- Include common attributes -->
<ItemGroup>
<Compile Include="$(SlnDir)CommonAttributes.cs" />
</ItemGroup>
<!-- Gets the key file if present, otherwise builds projects unsigned -->
<PropertyGroup Condition="Exists('$(SlnDir)..\Web Applications UK.snk')">
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile Condition="Exists('$(SlnDir)..\Web Applications UK.snk')">$(SlnDir)..\Web Applications UK.snk</AssemblyOriginatorKeyFile>
<DefineConstants>SIGNED;$(DefineConstants)</DefineConstants>
</PropertyGroup>
<!-- Gets the path to sn.exe -->
<Target Name="GetSNPath" BeforeTargets="BuildPackage;VerifyStrongName" Condition="'$(SignAssembly)' == 'true'">
<GetFrameworkSdkPath>
<Output TaskParameter="Path" PropertyName="WindowsSdkPath" />
</GetFrameworkSdkPath>
<Exec Command="WHERE /r "$(WindowsSdkPath.TrimEnd('\\'))" sn > sn-path.txt" />
<ReadLinesFromFile File="sn-path.txt">
<Output TaskParameter="Lines" PropertyName="SNPath" />
</ReadLinesFromFile>
<Delete Files="sn-path.txt" />
<PropertyGroup>
<SNPath>$([System.Text.RegularExpressions.Regex]::Replace('$(SNPath)', ';.*', ''))</SNPath>
</PropertyGroup>
</Target>
<!-- Ensures that packages have a strong name -->
<Target Name="VerifyStrongName" Condition="'$(SignAssembly)' == 'true'" BeforeTargets="BuildPackage">
<Exec Command=""$(SNPath)" /v "$(TargetPath)"" />
</Target>
<!-- Standard includes -->
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- NuGet package restore -->
<Import Project="$(SlnDir).nuget\NuGet.targets" Condition="Exists('$(SlnDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SlnDir).nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SlnDir).nuget\NuGet.targets'))" />
</Target>
<!-- Import utilities if Utilities is defined -->
<PropertyGroup Condition="$(DefineConstants.Contains('Utilities'))">
<UtilityBuildTasks>$(SlnDir)Utilities\BuildTasks\bin\Release\AnyCPU\WebApplications.Utilities.BuildTasks.dll</UtilityBuildTasks>
</PropertyGroup>
<ItemGroup Condition="'$(UtilityBuildTasks)'!='' AND !Exists('$(UtilityBuildTasks)')">
<ProjectsToBuild Include="$(SlnDir)Utilities\BuildTasks\WebApplications.Utilities.BuildTasks.csproj">
<Properties>Configuration=Release;Platform=AnyCPU</Properties>
</ProjectsToBuild>
</ItemGroup>
<Import Project="$(SlnDir)Utilities\WebApplications.Utilities.targets" Condition="$(DefineConstants.Contains('Utilities'))" />
<!-- Import ILMerge if ILMerge is defined -->
<PropertyGroup Condition="$(DefineConstants.Contains('ILMerge'))">
<ILMergeBuildTask>$(SlnDir)ILMerge\bin\Release\AnyCPU\ILMerge.Build.Task.dll</ILMergeBuildTask>
<ILMergeTool>$(SlnDir)ILMerge\bin\Release\AnyCPU\ILMerge.exe</ILMergeTool>
</PropertyGroup>
<ItemGroup Condition="'$(ILMergeBuildTask)'!='' AND !Exists('$(ILMergeBuildTask)')">
<ProjectsToBuild Include="$(SlnDir)ILMerge\ILMerge.Build.Task.csproj">
<Properties>Configuration=Release;Platform=AnyCPU</Properties>
</ProjectsToBuild>
</ItemGroup>
<Import Project="$(SlnDir)ILMerge\ILMerge.targets" Condition="$(DefineConstants.Contains('ILMerge'))" />
<!-- Import module initializer if ModuleInitializer is defined -->
<PropertyGroup Condition="$(DefineConstants.Contains('ModuleInitializer'))">
<InjectModuleInitializerTool>$(SlnDir)Initializer\bin\Release\AnyCPU\Merged\WebApplications.Utilities.Initializer.dll</InjectModuleInitializerTool>
</PropertyGroup>
<ItemGroup Condition="'$(InjectModuleInitializerTool)'!='' AND !Exists('$(InjectModuleInitializerTool)')">
<ProjectsToBuild Include="$(SlnDir)Initializer\WebApplications.Utilities.Initializer.csproj">
<Properties>Configuration=Release;Platform=AnyCPU</Properties>
</ProjectsToBuild>
</ItemGroup>
<Import Project="$(SlnDir)Initializer\InjectModuleInitializer.targets" Condition="$(DefineConstants.Contains('ModuleInitializer'))" />
<!-- Import PerfSetup if the PerfSetup constant is defined -->
<PropertyGroup Condition="$(DefineConstants.Contains('PerfSetup'))">
<PerfSetupTool>$(SlnDir)Performance\PerfSetup\bin\Release\Merged\PerfSetup32.exe</PerfSetupTool>
<PerfSetupTool64>$(SlnDir)Performance\PerfSetup\bin\Release\Merged\PerfSetup32.exe</PerfSetupTool64>
</PropertyGroup>
<ItemGroup Condition="'$(PerfSetupTool)'!='' AND !Exists('$(PerfSetupTool)')">
<ProjectsToBuild Include="$(SlnDir)Performance\PerfSetup\WebApplications.Utilities.Performance.Tools.PerfSetup.csproj">
<Properties>Configuration=Release;Platform=x86</Properties>
</ProjectsToBuild>
</ItemGroup>
<ItemGroup Condition="'$(PerfSetupTool64)'!='' AND !Exists('$(PerfSetupTool64)')">
<ProjectsToBuild Include="$(SlnDir)Performance\PerfSetup\WebApplications.Utilities.Performance.Tools.PerfSetup.csproj">
<Properties>Configuration=Release;Platform=x64</Properties>
</ProjectsToBuild>
</ItemGroup>
<Import Project="$(SlnDir)Performance\WebApplications.Utilities.Performance.targets" Condition="$(DefineConstants.Contains('PerfSetup'))" />
<!-- Copy resources if CopyResources is defined -->
<ItemGroup Condition="$(DefineConstants.Contains('CopyResources'))">
<ResourceFiles Include="$(SlnDir)Utilities\Resources\**\*" />
</ItemGroup>
<!-- When running from internal build server, this will digitally sign dlls -->
<Import Project="$(SlnDir)..\WebApplicationsSignature.targets" Condition="Exists('$(SlnDir)..\WebApplicationsSignature.targets')" />
<Target Name="CopyResources" AfterTargets="AfterBuild" Condition="$(DefineConstants.Contains('CopyResources'))">
<Copy SourceFiles="@(ResourceFiles)" DestinationFolder="$(OutputPath)Resources\%(RecursiveDir)" />
</Target>
<!-- Setup nugets folder -->
<Target Name="SetupNuGetsDirTarget" Condition="'$(Configuration)' == 'NuGet'" BeforeTargets="BuildPackage">
<!-- Ensure we have a nugets folder -->
<MakeDir Directories="$(SlnDir)nugets" Condition="!Exists('$(SlnDir)nugets')" />
<!-- Check for existing packages matching this one and delete -->
<ItemGroup>
<DeletePackage Include="$(SlnDir)nugets\$([System.IO.Path]::GetFileNameWithoutExtension('$(ProjectPath)'))*.nupkg" />
</ItemGroup>
<Delete Files="@(DeletePackage)" Condition="'@(DeletePackage)' != ''" />
</Target>
<!-- Build any dependencies-->
<Target Name="BuildDependencies" Condition="'@(ProjectsToBuild)' != ''" AfterTargets="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<Message Text="Building dependencies." />
<MSBuild Projects="@(ProjectsToBuild)" />
<!-- Reset tool locations -->
<PropertyGroup>
<UtilityBuildTasks Condition="$(DefineConstants.Contains('Utilities'))">$(SlnDir)Utilities\BuildTasks\bin\Release\AnyCPU\WebApplications.Utilities.BuildTasks.dll</UtilityBuildTasks>
<ILMergeBuildTask Condition="$(DefineConstants.Contains('ILMerge'))">$(SlnDir)ILMerge\bin\Release\AnyCPU\ILMerge.Build.Task.dll</ILMergeBuildTask>
<InjectModuleInitializerTool Condition="$(DefineConstants.Contains('ModuleInitializer'))">$(SlnDir)Initializer\bin\Release\AnyCPU\Merged\WebApplications.Utilities.Initializer.dll</InjectModuleInitializerTool>
<PerfSetupTool Condition="$(DefineConstants.Contains('PerfSetup'))">$(SlnDir)Performance\PerfSetup\bin\Release\Merged\PerfSetup32.exe</PerfSetupTool>
<PerfSetupTool64 Condition="$(DefineConstants.Contains('PerfSetup'))">$(SlnDir)Performance\PerfSetup\bin\Release\Merged\PerfSetup64.exe</PerfSetupTool64>
</PropertyGroup>
<!-- Verify pre-requisits -->
<Error Text="Failed to find or build the Utilities Build Tasks ('$(UtilityBuildTasks)')." Condition="'$(UtilityBuildTasks)'!='' AND !Exists('$(UtilityBuildTasks)')" />
<Error Text="Failed to find or build the ILMerge Build Task ('$(ILMergeBuildTask)')." Condition="'$(ILMergeBuildTask)'!='' AND !Exists('$(ILMergeBuildTask)')" />
<Error Text="Failed to find or build the Module initializer tool ('$(InjectModuleInitializerTool)')." Condition="'$(InjectModuleInitializerTool)'!='' AND !Exists('$(InjectModuleInitializerTool)')" />
<Error Text="Failed to find or build the PerfSetup tool ('$(PerfSetupTool)')." Condition="'$(PerfSetupTool)'!='' AND !Exists('$(PerfSetupTool)')" />
<Error Text="Failed to find or build the 64-bit PerfSetup tool ('$(PerfSetupTool64)')." Condition="'$(PerfSetupTool64)'!='' AND !Exists('$(PerfSetupTool64)')" />
</Target>
</Project>