markus / packages / Microsoft.Bcl.Build.1.0.21 / build / Microsoft.Bcl.Build.targets @ f6cecf63
이력 | 보기 | 이력해설 | 다운로드 (14.6 KB)
1 |
<!-- |
---|---|
2 |
*********************************************************************************************** |
3 |
Microsoft.Bcl.targets |
4 |
|
5 |
WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have |
6 |
created a backup copy. Incorrect changes to this file will make it |
7 |
impossible to load or build your projects from the command-line or the IDE. |
8 |
|
9 |
Copyright (C) Microsoft Corporation. All rights reserved. |
10 |
*********************************************************************************************** |
11 |
--> |
12 |
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
13 |
<PropertyGroup> |
14 |
<BclBuildImported>true</BclBuildImported> |
15 |
</PropertyGroup> |
16 |
|
17 |
<PropertyGroup Condition="'$(TargetFrameworkIdentifier)' != 'Silverlight' and '$(OutputType)' != 'AppContainerExe'"> |
18 |
<!-- |
19 |
Workaround MSBuild issue that prevents System.Runtime 2.5 and System.Threading.Tasks 2.5 from |
20 |
satisfying indirect dependencies on System.Runtime 1.5 and System.Threading.Tasks 1.5 respectively. |
21 |
--> |
22 |
<AutoUnifyAssemblyReferences>false</AutoUnifyAssemblyReferences> |
23 |
|
24 |
<!-- MSBuild by default doesn't pass the Web.Config ResolveAssemblyReference, in which case, set it so that it sees binding redirects --> |
25 |
<AppConfig Condition="'$(AppConfig)' == '' And '$(WebProjectOutputDir)' != '' And Exists('$(ProjectConfigFileName)')">$(ProjectConfigFileName)</AppConfig> |
26 |
</PropertyGroup> |
27 |
|
28 |
<!-- Workaround issue that incorrectly unifies references not in the current profile to the version in the superset of all profiles. --> |
29 |
<Target Name="_BclBuildSetFullFrameworkFolderToProfile" AfterTargets="GetReferenceAssemblyPaths" Condition="'$(TargetFrameworkIdentifier)' == '.NETPortable'"> |
30 |
<PropertyGroup> |
31 |
<_FullFrameworkReferenceAssemblyPaths>$(TargetFrameworkDirectory)</_FullFrameworkReferenceAssemblyPaths> |
32 |
</PropertyGroup> |
33 |
</Target> |
34 |
|
35 |
<!-- |
36 |
******************************************************************************************************************* |
37 |
******************************************************************************************************************* |
38 |
EnsureBindingRedirects Section |
39 |
******************************************************************************************************************* |
40 |
******************************************************************************************************************* |
41 |
--> |
42 |
<PropertyGroup> |
43 |
<__IntermediateAppConfig>$(IntermediateOutputPath)$(MSBuildProjectFile).App.config</__IntermediateAppConfig> |
44 |
<SkipEnsureBindingRedirects Condition="'$(TargetFrameworkIdentifier)' == 'Silverlight' or '$(OutputType)' == 'AppContainerExe'">true</SkipEnsureBindingRedirects> |
45 |
|
46 |
<!-- Default logic is to use existing Bcl.Build code for any binding redirects which are not now supported by the |
47 |
framework functionality which is controlled by existing MSBUILD properties, that were added in Dev12 |
48 |
|
49 |
Supported Dev12 scenarios are: |
50 |
Project Output Type exe, winexe |
51 |
<AutoGenerateBindingRedirects> in project file set to true |
52 |
|
53 |
All others outside of this should continue to use existing mechanism in BCL.Build to ensure behavioural compatbility |
54 |
for output types. --> |
55 |
|
56 |
<SkipEnsureBindingRedirects Condition="'$(SkipEnsureBindingRedirects)' == ''">false</SkipEnsureBindingRedirects> |
57 |
<SkipEnsureBindingRedirects Condition="'$(AutoGenerateBindingRedirects)' =='true' and '$(GenerateBindingRedirectsOutputType)' == 'true'">true</SkipEnsureBindingRedirects> |
58 |
</PropertyGroup> |
59 |
|
60 |
<!-- we haven't already been told to skip binding redirects, the project supports bindingredirect generation, and hasn't yet opted-in, force the opt in and disable our own bindingRedirect generation. --> |
61 |
<PropertyGroup Condition="'$(SkipEnsureBindingRedirects)' != 'true' and ('$(AutoGenerateBindingRedirects)' =='' and '$(GenerateBindingRedirectsOutputType)' == 'true')"> |
62 |
<SkipEnsureBindingRedirects>true</SkipEnsureBindingRedirects> |
63 |
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> |
64 |
</PropertyGroup> |
65 |
|
66 |
<UsingTask TaskName="EnsureBindingRedirects" AssemblyFile="$(MSBuildThisFileDirectory)Microsoft.Bcl.Build.Tasks.dll" /> |
67 |
|
68 |
<!-- |
69 |
=================================================================================================================== |
70 |
BclBuildDetermineReferencesToRedirect |
71 |
|
72 |
Determine which references are opted in for binding redirects |
73 |
=================================================================================================================== |
74 |
--> |
75 |
<Target Name="BclBuildDetermineReferencesToRedirect" BeforeTargets="BclBuildEnsureBindingRedirects" Condition="'$(SkipEnsureBindingRedirects)' != 'true'"> |
76 |
<!-- Convention is a file next to the reference with name "ensureRedirect.xml" --> |
77 |
<ItemGroup> |
78 |
<_EnsureBindingRedirectReference Include="@(Reference)" |
79 |
Condition="'%(Reference.HintPath)' != '' and Exists('$([System.IO.Path]::GetDirectoryName("%(Reference.HintPath)"))\\ensureRedirect.xml')" /> |
80 |
</ItemGroup> |
81 |
</Target> |
82 |
|
83 |
<!-- |
84 |
=================================================================================================================== |
85 |
BclBuildEnsureBindingRedirects |
86 |
|
87 |
Generate a new app.config with merged binding redirects if we have binding redirects to ensure and it's out of date |
88 |
=================================================================================================================== |
89 |
--> |
90 |
<Target Name="BclBuildEnsureBindingRedirects" |
91 |
DependsOnTargets="BclBuildDetermineReferencesToRedirect" |
92 |
BeforeTargets="ResolveAssemblyReferences" |
93 |
Condition="'@(_EnsureBindingRedirectReference)' != '' and '$(SkipEnsureBindingRedirects)' != 'true'" |
94 |
Inputs="$(MSBuildAllProjects);$(AppConfig);@(_EnsureBindingRedirectReference->'%(HintPath)')" |
95 |
Outputs="$(__IntermediateAppConfig)"> |
96 |
|
97 |
<EnsureBindingRedirects References="@(_EnsureBindingRedirectReference->'%(HintPath)')" |
98 |
SourceAppConfigPath="$(AppConfig)" |
99 |
DestinationAppConfigPath="$(__IntermediateAppConfig)"> |
100 |
<Output TaskParameter="DestinationAppConfigPath" ItemName="FileWrites"/> |
101 |
</EnsureBindingRedirects> |
102 |
</Target> |
103 |
|
104 |
<!-- |
105 |
=================================================================================================================== |
106 |
BclBuildUpdateAppConfigWithTargetPath |
107 |
|
108 |
Update project properties to point to the generated app.config |
109 |
=================================================================================================================== |
110 |
--> |
111 |
<Target Name="BclBuildUpdateAppConfigWithTargetPath" |
112 |
DependsOnTargets="BclBuildDetermineReferencesToRedirect;BclBuildEnsureBindingRedirects" |
113 |
BeforeTargets="ResolveAssemblyReferences" |
114 |
Condition="'@(_EnsureBindingRedirectReference)' != '' and '$(SkipEnsureBindingRedirects)' != 'true'"> |
115 |
<PropertyGroup> |
116 |
<AppConfig>$(__IntermediateAppConfig)</AppConfig> |
117 |
</PropertyGroup> |
118 |
<ItemGroup> |
119 |
<AppConfigWithTargetPath Remove="@(AppConfigWithTargetPath)" /> |
120 |
<AppConfigWithTargetPath Include="$(AppConfig)"> |
121 |
<TargetPath>$(TargetFileName).config</TargetPath> |
122 |
</AppConfigWithTargetPath> |
123 |
</ItemGroup> |
124 |
</Target> |
125 |
|
126 |
|
127 |
<!-- |
128 |
******************************************************************************************************************* |
129 |
******************************************************************************************************************* |
130 |
ValidatePackageReferences Section |
131 |
|
132 |
This group of targets enables validation of nuget package references when building inside VisualStudio. |
133 |
******************************************************************************************************************* |
134 |
******************************************************************************************************************* |
135 |
--> |
136 |
|
137 |
<!-- |
138 |
=================================================================================================================== |
139 |
BclBuildAddProjectReferenceProperties |
140 |
|
141 |
Adds properties to be set when resolving project references. The properties ensure that the references get built |
142 |
in the context of the referencer (by changing the set of properties used to build the project) and pass down the |
143 |
context needed to validate the referencing project. |
144 |
=================================================================================================================== |
145 |
--> |
146 |
<Target Name="BclBuildAddProjectReferenceProperties" |
147 |
BeforeTargets="AssignProjectConfiguration" |
148 |
Condition="'$(BuildingInsideVisualStudio)' == 'true'"> |
149 |
<PropertyGroup> |
150 |
<_BclBuildProjectReferenceProperties>BclBuildReferencingProject=$(MSBuildProjectFullPath);BclBuildReferencingProjectConfig=$(MSBuildProjectDirectory)\packages.config</_BclBuildProjectReferenceProperties> |
151 |
<_BclBuildProjectReferenceProperties Condition="'$(SkipValidatePackageReferences)' != ''">$(_BclBuildProjectReferenceProperties);SkipValidatePackageReferences=$(SkipValidatePackageReferences)</_BclBuildProjectReferenceProperties> |
152 |
</PropertyGroup> |
153 |
|
154 |
<ItemGroup> |
155 |
<ProjectReference> |
156 |
<AdditionalProperties>$(_BclBuildProjectReferenceProperties);%(ProjectReference.AdditionalProperties)</AdditionalProperties> |
157 |
</ProjectReference> |
158 |
</ItemGroup> |
159 |
</Target> |
160 |
|
161 |
<!-- |
162 |
=================================================================================================================== |
163 |
BclBuildSetRunningFullBuild |
164 |
|
165 |
Determines when a full build is running as opposed to a single target. |
166 |
=================================================================================================================== |
167 |
--> |
168 |
<Target Name="BclBuildSetRunningFullBuild" |
169 |
BeforeTargets="BuildOnlySettings"> |
170 |
<PropertyGroup> |
171 |
<BclBuildRunningFullBuild>true</BclBuildRunningFullBuild> |
172 |
</PropertyGroup> |
173 |
</Target> |
174 |
|
175 |
<!-- |
176 |
=================================================================================================================== |
177 |
GetTargetPath/BclBuildGetTargetPath |
178 |
|
179 |
MSBuild will only build a target once for a given set of properties. |
180 |
|
181 |
We need that single build of GetTargetPath to run during project reference resolution, so that we can detect a |
182 |
referencing project that doesn't have Bcl.Build. |
183 |
|
184 |
To accomplish this we replace GetTargetPath with BclBuildGetTargetPath when running a full build. |
185 |
=================================================================================================================== |
186 |
--> |
187 |
<Target |
188 |
Name="GetTargetPath" |
189 |
Condition="'$(BclBuildRunningFullBuild)' != 'true'" |
190 |
DependsOnTargets="$(GetTargetPathDependsOn)" |
191 |
Returns="$(TargetPath)"/> |
192 |
|
193 |
<Target |
194 |
Name="BclBuildGetTargetPath" |
195 |
Condition="'$(BclBuildRunningFullBuild)' == 'true'" |
196 |
AfterTargets="GetTargetPath" |
197 |
Returns="$(TargetPath)"> |
198 |
<PropertyGroup> |
199 |
<!-- Reset BclBuildRunningFullBuild, it will be set again when doing a full build. --> |
200 |
<BclBuildRunningFullBuild>false</BclBuildRunningFullBuild> |
201 |
</PropertyGroup> |
202 |
</Target> |
203 |
|
204 |
<!-- |
205 |
=================================================================================================================== |
206 |
BclBuildValidateNugetPackageReferences |
207 |
|
208 |
This target validates that any Nuget packages installed in the current project are also installed in projects |
209 |
referencing the current project. |
210 |
|
211 |
This is necessary because Nuget packages contain more than just simple references. Installing the package ensures |
212 |
1. The right set of references for the target framework are added |
213 |
2. Config file transforms are applied |
214 |
3. Project installation scripts are run |
215 |
|
216 |
For all packages listed as installed for the current project in packages config, if the package ID matches one |
217 |
specified in @(ValidatePackages), ensure that the same package is installed in the referencing project. |
218 |
|
219 |
This target can be disabled for a project reference by setting SkipValidatePackageReferences=true for the reference: |
220 |
<ProjectReference Include="..\pcl\pcl.csproj"> |
221 |
<Project>{664a9e98-fac7-4567-a046-0dde95fddb48}</Project> |
222 |
<Name>pcl</Name> |
223 |
<Properties>SkipValidatePackageReferences=true</Properties> |
224 |
</ProjectReference> |
225 |
|
226 |
This target can be disabled for all references to a project by adding the following: |
227 |
<PropertyGroup> |
228 |
<SkipValidatePackageReferences>true</SkipValidatePackageReferences> |
229 |
</PropertyGroup> |
230 |
=================================================================================================================== |
231 |
--> |
232 |
<UsingTask TaskName="ValidatePackageReferences" AssemblyFile="$(MSBuildThisFileDirectory)Microsoft.Bcl.Build.Tasks.dll" /> |
233 |
<Target Name="BclBuildValidateNugetPackageReferences" |
234 |
Condition="'$(BclBuildRunningFullBuild)' != 'true' AND '$(SkipValidatePackageReferences)' != 'true' AND '$(BuildingInsideVisualStudio)' == 'true'" |
235 |
BeforeTargets="GetTargetPath"> |
236 |
<ItemGroup> |
237 |
<ValidatePackages Include="Microsoft.Bcl"/> |
238 |
<ValidatePackages Include="Microsoft.Bcl.Async"/> |
239 |
<ValidatePackages Include="Microsoft.Bcl.Compression"/> |
240 |
<ValidatePackages Include="Microsoft.Net.Http"/> |
241 |
</ItemGroup> |
242 |
|
243 |
<ValidatePackageReferences Packages="@(ValidatePackages)" |
244 |
ReferencingProject="$(BclBuildReferencingProject)" |
245 |
ReferencingProjectPackagesConfig="$(BclBuildReferencingProjectConfig)" |
246 |
ReferencedProject="$(MSBuildProjectFullPath)" |
247 |
ReferencedProjectPackagesConfig="$(MSBuildProjectDirectory)\packages.config" |
248 |
TreatWarningsAsErrors="$(TreatWarningsAsErrors)" /> |
249 |
</Target> |
250 |
</Project> |