-
Notifications
You must be signed in to change notification settings - Fork 69
/
Copy pathEnvironment.props
128 lines (108 loc) · 5.46 KB
/
Environment.props
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
<?xml version="1.0" encoding="utf-8"?>
<!--
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
-->
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!-- Repository root -->
<RepositoryRoot>$(MSBuildThisFileDirectory)</RepositoryRoot>
<!-- Default Configuration -->
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<!-- Default Platform -->
<Platform Condition=" '$(Platform)' == '' ">x64</Platform>
<!-- Target .NET framework (default) -->
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
<!-- Generate binding redirect automatically across projects -->
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<!-- Make sure we generate redirects for libraries (dll) as well (by default, it's only exe) -->
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
<!-- Disable Visual Studio hosting process -->
<UseVSHostingProcess>false</UseVSHostingProcess>
<!-- Generate [AssemblyName].BuildInfo.config with SourceControl and Build info -->
<GenerateBuildInfoConfigFile>true</GenerateBuildInfoConfigFile>
<IncludeServerNameInBuildInfo>true</IncludeServerNameInBuildInfo>
<WebProjectOutputDir Condition="'$(WebProjectOutputDir)' == ''">.</WebProjectOutputDir>
</PropertyGroup>
<!-- Import (generated) NuGet package properties -->
<Import Project="$(RepositoryRoot)\.packages\Packages.props"
Condition="Exists('$(RepositoryRoot)\.packages\Packages.props')"/>
<!-- Import repository custom properties (if any) -->
<Import Project="$(RepositoryRoot)\Environment.Custom.props"
Condition="Exists('$(RepositoryRoot)\Environment.Custom.props')"/>
<!-- NuGet package restore verification task/target -->
<UsingTask TaskName="CheckNuGetPackagesUpToDateTask"
TaskFactory="CodeTaskFactory"
AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll"
>
<ParameterGroup>
<RepositoryRoot ParameterType="System.String" Required="true" />
<NuGetPackagesUpToDate ParameterType="System.Boolean" Output="true" />
</ParameterGroup>
<Task>
<Using Namespace="System.Security.Cryptography" />
<Code Type="Method" Language="cs">
<![CDATA[
public override bool Execute()
{
// Load the current fingerprint, if any
var fpFileName = Path.Combine(RepositoryRoot, @".packages\.fingerprint");
var fpCurrent = string.Empty;
if (File.Exists(fpFileName))
{
fpCurrent = File.ReadAllText(fpFileName);
}
// Obtain the finderprint of packages.config and compare it with the current FP
var packageConfigFileName = Path.Combine(RepositoryRoot, @".init\packages.config");
using (var md5 = MD5.Create())
{
var fpPackageConfig = BitConverter.ToString(md5.ComputeHash(
File.ReadAllBytes(packageConfigFileName))).Replace("-", "");
if (fpPackageConfig == fpCurrent)
{
NuGetPackagesUpToDate = true;
}
}
return true;
}
]]>
</Code>
</Task>
</UsingTask>
<Target Name="EnsureNuGetPackagesUpToDate" BeforeTargets="BeforeBuild">
<PropertyGroup>
<ErrorText>NuGet packages have not been restored or they are not up-to-date. Please run '$(RepositoryRoot)init.cmd' and reopen/rebuild your solution/projects. </ErrorText>
</PropertyGroup>
<CheckNuGetPackagesUpToDateTask RepositoryRoot="$(RepositoryRoot)">
<Output PropertyName="NuGetPackagesUpToDate" TaskParameter="NuGetPackagesUpToDate" />
</CheckNuGetPackagesUpToDateTask>
<Error Condition="$(NuGetPackagesUpToDate) != 'true'" Text="$(ErrorText)" />
</Target>
<!--
Hook up a Release build target (in Debug configuration) in case
we want to build both Debug and Release configurations - we always
start with Debug configuration and then proceed to Release if build
(in Debug) was successful. Note that the technique used here should
also cover building solutions - not just individual projects.
-->
<Target Name="BuildRelease" AfterTargets="AfterBuild"
Condition="'$(BuildRelease)' != '' and '$(Configuration)' == 'Debug'">
<ItemGroup>
<ProjectToBuild Include="$(MSBuildProjectFile)">
<Properties>Configuration=Release</Properties>
</ProjectToBuild>
</ItemGroup>
<Message Text="Building release configuration for project [@(ProjectToBuild)] ..." />
<MSBuild Projects="@(ProjectToBuild)" BuildInParallel="true" />
</Target>
<Target Name="CleanRelease" AfterTargets="AfterClean"
Condition="'$(BuildRelease)' != '' and '$(Configuration)' == 'Debug'">
<ItemGroup>
<ProjectToBuild Include="$(MSBuildProjectFile)">
<Properties>Configuration=Release</Properties>
</ProjectToBuild>
</ItemGroup>
<Message Text="Cleaning release configuration for project [@(ProjectToBuild)] ..." />
<MSBuild Projects="@(ProjectToBuild)" BuildInParallel="true" Targets="Clean"/>
</Target>
</Project>