OLD | NEW |
| (Empty) |
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 ·· | |
14 <PropertyGroup Condition="'$(TargetFrameworkIdentifier)' != 'Silverlight'"> | |
15 <!--· | |
16 Workaround MSBuild issue that prevents System.Runtime 2.5 and System.Threa
ding.Tasks 2.5 from | |
17 satisfying indirect dependencies on System.Runtime 1.5 and System.Threadin
g.Tasks 1.5 respectively.·· | |
18 --> | |
19 <AutoUnifyAssemblyReferences>false</AutoUnifyAssemblyReferences> | |
20 | |
21 <!-- MSBuild by default doesn't pass the Web.Config ResolveAssemblyReference
, in which case, set it so that it sees binding redirects --> | |
22 <AppConfig Condition="'$(AppConfig)' == '' And '$(WebProjectOutputDir)' != '
' And Exists('$(ProjectConfigFileName)')">$(ProjectConfigFileName)</AppConfig> | |
23 </PropertyGroup> | |
24 | |
25 <!-- Workaround issue that incorrectly unifies references not in the current p
rofile to the version in the superset of all profiles. --> | |
26 <Target Name="_BclBuildSetFullFrameworkFolderToProfile" AfterTargets="GetRefer
enceAssemblyPaths" Condition="'$(TargetFrameworkIdentifier)' == '.NETPortable'"> | |
27 <PropertyGroup> | |
28 <_FullFrameworkReferenceAssemblyPaths>$(TargetFrameworkDirectory)</_FullFr
ameworkReferenceAssemblyPaths> | |
29 </PropertyGroup> | |
30 </Target> | |
31 | |
32 <!-- | |
33 ****************************************************************************
*************************************** | |
34 ****************************************************************************
*************************************** | |
35
EnsureBindingRedirects Section | |
36 ****************************************************************************
*************************************** | |
37 ****************************************************************************
*************************************** | |
38 --> | |
39 <PropertyGroup> | |
40 <__IntermediateAppConfig>$(IntermediateOutputPath)$(MSBuildProjectFile).App.
config</__IntermediateAppConfig> | |
41 </PropertyGroup> | |
42 | |
43 <UsingTask TaskName="EnsureBindingRedirects" AssemblyFile="$(MSBuildThisFileDi
rectory)Microsoft.Bcl.Build.Tasks.dll" /> | |
44 | |
45 <!--· | |
46 ============================================================================
======================================= | |
47
BclBuildDetermineReferencesToRedirect | |
48 ······························ | |
49 Determine which references are opted in for binding redirects | |
50 ============================================================================
======================================= | |
51 --> | |
52 <Target Name="BclBuildDetermineReferencesToRedirect" BeforeTargets="BclBuildEn
sureBindingRedirects"> | |
53 <!-- Convention is a file next to the reference with name "ensureRedirect.xm
l" --> | |
54 <ItemGroup> | |
55 <_EnsureBindingRedirectReference Include="@(Reference)" | |
56 Condition="'%(Reference.HintPath)' != ''
and Exists('$([System.IO.Path]::GetDirectoryName("%(Reference.HintPath)&quo
t;))\\ensureRedirect.xml')" /> | |
57 </ItemGroup> | |
58 </Target> | |
59 | |
60 <!--· | |
61 ============================================================================
======================================= | |
62
BclBuildEnsureBindingRedirects | |
63 ······························ | |
64 Generate a new app.config with merged binding redirects if we have binding r
edirects to ensure and it's out of date | |
65 ============================================================================
======================================= | |
66 --> | |
67 <Target Name="BclBuildEnsureBindingRedirects" | |
68 DependsOnTargets="BclBuildDetermineReferencesToRedirect" | |
69 BeforeTargets="ResolveAssemblyReferences" | |
70 Condition="'@(_EnsureBindingRedirectReference)' != ''" | |
71 Inputs="$(MSBuildAllProjects);$(AppConfig);@(_EnsureBindingRedirectRef
erence->'%(HintPath)')" | |
72 Outputs="$(__IntermediateAppConfig)"> | |
73 | |
74 <EnsureBindingRedirects References="@(_EnsureBindingRedirectReference->'%(Hi
ntPath)')" | |
75 SourceAppConfigPath="$(AppConfig)" | |
76 DestinationAppConfigPath="$(__IntermediateAppConfig)
"> | |
77 <Output TaskParameter="DestinationAppConfigPath" ItemName="FileWrites"/> | |
78 </EnsureBindingRedirects> | |
79 </Target> | |
80 | |
81 <!--· | |
82 ============================================================================
======================================= | |
83
BclBuildUpdateAppConfigWithTargetPath | |
84 ······························ | |
85 Update project properties to point to the generated app.config | |
86 ============================================================================
======================================= | |
87 --> | |
88 <Target Name="BclBuildUpdateAppConfigWithTargetPath" | |
89 DependsOnTargets="BclBuildDetermineReferencesToRedirect;BclBuildEnsure
BindingRedirects" | |
90 BeforeTargets="ResolveAssemblyReferences" | |
91 Condition="'@(_EnsureBindingRedirectReference)' != ''"> | |
92 <PropertyGroup> | |
93 <AppConfig>$(__IntermediateAppConfig)</AppConfig> | |
94 </PropertyGroup> | |
95 <ItemGroup> | |
96 <AppConfigWithTargetPath Remove="@(AppConfigWithTargetPath)" /> | |
97 <AppConfigWithTargetPath Include="$(AppConfig)"> | |
98 <TargetPath>$(TargetFileName).config</TargetPath> | |
99 </AppConfigWithTargetPath> | |
100 </ItemGroup> | |
101 </Target> | |
102 | |
103 | |
104 <!-- | |
105 ****************************************************************************
*************************************** | |
106 ****************************************************************************
*************************************** | |
107
ValidatePackageReferences Section | |
108 ···· | |
109 This group of targets enables validation of nuget package references when bu
ilding inside VisualStudio. | |
110 ****************************************************************************
*************************************** | |
111 ****************************************************************************
*************************************** | |
112 --> | |
113 | |
114 <!--· | |
115 ============================================================================
======================================= | |
116
BclBuildAddProjectReferenceProperties | |
117 ······························ | |
118 Adds properties to be set when resolving project references. The properties
ensure that the references get built | |
119 in the context of the referencer (by changing the set of properties used to
build the project) and pass down the | |
120 context needed to validate the referencing project. | |
121 ============================================================================
======================================= | |
122 --> | |
123 <Target Name="BclBuildAddProjectReferenceProperties" | |
124 BeforeTargets="AssignProjectConfiguration" | |
125 Condition="'$(BuildingInsideVisualStudio)' == 'true'"> | |
126 <PropertyGroup> | |
127 <_BclBuildProjectReferenceProperties>BclBuildReferencingProject=$(MSBuildP
rojectFullPath);BclBuildReferencingProjectConfig=$(MSBuildProjectDirectory)\pack
ages.config</_BclBuildProjectReferenceProperties> | |
128 <_BclBuildProjectReferenceProperties Condition="'$(SkipValidatePackageRefe
rences)' != ''">$(_BclBuildProjectReferenceProperties);SkipValidatePackageRefere
nces=$(SkipValidatePackageReferences)</_BclBuildProjectReferenceProperties> | |
129 </PropertyGroup> | |
130 | |
131 <ItemGroup> | |
132 <ProjectReference> | |
133 <AdditionalProperties>$(_BclBuildProjectReferenceProperties);%(ProjectRe
ference.AdditionalProperties)</AdditionalProperties> | |
134 </ProjectReference> | |
135 </ItemGroup> | |
136 </Target> | |
137 | |
138 <!--· | |
139 ============================================================================
======================================= | |
140
BclBuildSetRunningFullBuild | |
141 ······························ | |
142 Determines when a full build is running as opposed to a single target. | |
143 ============================================================================
======================================= | |
144 --> | |
145 <Target Name="BclBuildSetRunningFullBuild" | |
146 BeforeTargets="BuildOnlySettings"> | |
147 <PropertyGroup> | |
148 <BclBuildRunningFullBuild>true</BclBuildRunningFullBuild> | |
149 </PropertyGroup> | |
150 </Target> | |
151 | |
152 <!--· | |
153 ============================================================================
======================================= | |
154
GetTargetPath/BclBuildGetTargetPath | |
155 ······························ | |
156 MSBuild will only build a target once for a given set of properties. | |
157 ···· | |
158 We need that single build of GetTargetPath to run during project reference r
esolution, so that we can detect a· | |
159 referencing project that doesn't have Bcl.Build. | |
160 ···· | |
161 To accomplish this we replace GetTargetPath with BclBuildGetTargetPath when
running a full build. | |
162 ============================================================================
======================================= | |
163 --> | |
164 <Target | |
165 Name="GetTargetPath" | |
166 Condition="'$(BclBuildRunningFullBuild)' != 'true'" | |
167 DependsOnTargets="$(GetTargetPathDependsOn)" | |
168 Returns="$(TargetPath)"/> | |
169 | |
170 <Target | |
171 Name="BclBuildGetTargetPath" | |
172 Condition="'$(BclBuildRunningFullBuild)' == 'true'" | |
173 AfterTargets="GetTargetPath" | |
174 Returns="$(TargetPath)"> | |
175 <PropertyGroup> | |
176 <!-- Reset BclBuildRunningFullBuild, it will be set again when doing a ful
l build. --> | |
177 <BclBuildRunningFullBuild>false</BclBuildRunningFullBuild> | |
178 </PropertyGroup> | |
179 </Target> | |
180 | |
181 <!--· | |
182 ============================================================================
======================================= | |
183
BclBuildValidateNugetPackageReferences | |
184 ······························ | |
185 This target validates that any Nuget packages installed in the current proje
ct are also installed in projects· | |
186 referencing the current project. | |
187 ···· | |
188 This is necessary because Nuget packages contain more than just simple refer
ences. Installing the package ensures | |
189 1. The right set of references for the target framework are added | |
190 2. Config file transforms are applied | |
191 3. Project installation scripts are run | |
192 ······· | |
193 For all packages listed as installed for the current project in packages con
fig, if the package ID matches one | |
194 specified in @(ValidatePackages), ensure that the same package is installed
in the referencing project.· | |
195 ···· | |
196 This target can be disabled for a project reference by setting SkipValidateP
ackageReferences=true for the reference: | |
197 <ProjectReference Include="..\pcl\pcl.csproj"> | |
198 <Project>{664a9e98-fac7-4567-a046-0dde95fddb48}</Project> | |
199 <Name>pcl</Name> | |
200 <Properties>SkipValidatePackageReferences=true</Properties> | |
201 </ProjectReference> | |
202 ···· | |
203 This target can be disabled for all references to a project by adding the fo
llowing: | |
204 <PropertyGroup> | |
205 <SkipValidatePackageReferences>true</SkipValidatePackageReferences> | |
206 </PropertyGroup> | |
207 ============================================================================
======================================= | |
208 --> | |
209 <UsingTask TaskName="ValidatePackageReferences" AssemblyFile="$(MSBuildThisFil
eDirectory)Microsoft.Bcl.Build.Tasks.dll" /> | |
210 <Target Name="BclBuildValidateNugetPackageReferences" | |
211 Condition="'$(BclBuildRunningFullBuild)' != 'true' AND '$(SkipValidate
PackageReferences)' != 'true' AND '$(BuildingInsideVisualStudio)' == 'true'" | |
212 BeforeTargets="GetTargetPath"> | |
213 <ItemGroup> | |
214 <ValidatePackages Include="Microsoft.Bcl"/> | |
215 <ValidatePackages Include="Microsoft.Bcl.Async"/> | |
216 <ValidatePackages Include="Microsoft.Bcl.Compression"/> | |
217 <ValidatePackages Include="Microsoft.Net.Http"/> | |
218 </ItemGroup> | |
219 | |
220 <ValidatePackageReferences Packages="@(ValidatePackages)" | |
221 ReferencingProject="$(BclBuildReferencingProject)
" | |
222 ReferencingProjectPackagesConfig="$(BclBuildRefer
encingProjectConfig)" | |
223 ReferencedProject="$(MSBuildProjectFullPath)" | |
224 ReferencedProjectPackagesConfig="$(MSBuildProject
Directory)\packages.config" | |
225 TreatWarningsAsErrors="$(TreatWarningsAsErrors)"
/> | |
226 </Target> | |
227 </Project> | |
OLD | NEW |