[Tizen] Add BuildTools 2.1.0-rc1-02804-05
[platform/upstream/coreclr.git] / Tools / Microsoft.Common.CurrentVersion.targets
1 <!--
2 ***********************************************************************************************
3 Microsoft.Common.CurrentVersion.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 This file defines the steps in the standard build process for .NET projects.  It
10 contains all the steps that are common among the different .NET languages, such as
11 Visual Basic, and Visual C#.
12
13 Copyright (C) Microsoft Corporation. All rights reserved.
14 ***********************************************************************************************
15 -->
16
17 <Project DefaultTargets="Build" TreatAsLocalProperty="OutDir" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
18
19   <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="'$(MicrosoftCommonPropsHasBeenImported)' != 'true' and Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
20
21   <PropertyGroup>
22     <ImportByWildcardBeforeMicrosoftCommonTargets Condition="'$(ImportByWildcardBeforeMicrosoftCommonTargets)' == ''">true</ImportByWildcardBeforeMicrosoftCommonTargets>
23     <ImportByWildcardAfterMicrosoftCommonTargets Condition="'$(ImportByWildcardAfterMicrosoftCommonTargets)' == ''">true</ImportByWildcardAfterMicrosoftCommonTargets>
24     <ImportUserLocationsByWildcardBeforeMicrosoftCommonTargets Condition="'$(ImportUserLocationsByWildcardBeforeMicrosoftCommonTargets)' == ''">true</ImportUserLocationsByWildcardBeforeMicrosoftCommonTargets>
25     <ImportUserLocationsByWildcardAfterMicrosoftCommonTargets Condition="'$(ImportUserLocationsByWildcardAfterMicrosoftCommonTargets)' == ''">true</ImportUserLocationsByWildcardAfterMicrosoftCommonTargets>
26   </PropertyGroup>
27
28   <Import Project="$(MSBuildUserExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.targets\ImportBefore\*" Condition="'$(ImportUserLocationsByWildcardBeforeMicrosoftCommonTargets)' == 'true' and exists('$(MSBuildUserExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.targets\ImportBefore')"/>
29   <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.targets\ImportBefore\*" Condition="'$(ImportByWildcardBeforeMicrosoftCommonTargets)' == 'true' and exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.targets\ImportBefore')"/>
30
31   <Import Project="$(MSBuildProjectFullPath).user" Condition="Exists('$(MSBuildProjectFullPath).user')"/>
32
33
34   <!-- VS10 without SP1 and without VS11 will not have VisualStudioVersion set, so do that here -->
35   <PropertyGroup>
36     <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
37   </PropertyGroup>
38
39   <PropertyGroup>
40     <CustomBeforeMicrosoftCommonTargets Condition="'$(CustomBeforeMicrosoftCommonTargets)'==''">$(MSBuildExtensionsPath)\v$(MSBuildToolsVersion)\Custom.Before.Microsoft.Common.targets</CustomBeforeMicrosoftCommonTargets>
41     <CustomAfterMicrosoftCommonTargets Condition="'$(CustomAfterMicrosoftCommonTargets)'==''">$(MSBuildExtensionsPath)\v$(MSBuildToolsVersion)\Custom.After.Microsoft.Common.targets</CustomAfterMicrosoftCommonTargets>
42     <ReportingServicesTargets Condition="'$(ReportingServicesTargets)'==''">$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\ReportingServices\Microsoft.ReportingServices.targets</ReportingServicesTargets>
43   </PropertyGroup>
44
45   <Import Project="$(CustomBeforeMicrosoftCommonTargets)" Condition="'$(CustomBeforeMicrosoftCommonTargets)' != '' and Exists('$(CustomBeforeMicrosoftCommonTargets)')"/>
46
47   <!-- By default, we are creating a managed app because .NET 2.0 projects did not have this property. -->
48   <PropertyGroup Condition="'$(TargetRuntime)' == ''">
49     <TargetRuntime>Managed</TargetRuntime>
50   </PropertyGroup>
51
52   <!-- Because .NET 2.0 apps did not set TargetFrameworkIdentifier, we need to set it for them here by default.  If
53        the runtime is set to Managed, we also need to set these.  Otherwise they should be blank (for instance Javascript or
54        Native apps) because they do not target a .NET Framework. -->
55   <PropertyGroup Condition="'$(TargetRuntime)' == 'Managed'">
56     <TargetFrameworkIdentifier Condition="'$(TargetFrameworkIdentifier)' == ''">.NETFramework</TargetFrameworkIdentifier>
57     <TargetFrameworkVersion Condition=" '$(TargetFrameworkVersion)' == '' ">v4.0</TargetFrameworkVersion>
58   </PropertyGroup>
59
60   <!-- AvailablePlatforms is the list of platform targets available. -->
61   <PropertyGroup>
62     <AvailablePlatforms Condition="'$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == ''">Any CPU,x86,x64,Itanium</AvailablePlatforms>
63     <AvailablePlatforms Condition="'$(VisualStudioVersion)' != '' and '$(VisualStudioVersion)' > '10.0'">Any CPU,x86,x64</AvailablePlatforms>
64   </PropertyGroup>
65
66   <!-- Import does NOT apply to .NETCore -->
67   <Import Project="Microsoft.NETFramework.props" Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework' or '$(TargetFrameworkIdentifier)' == 'Silverlight'"/>
68
69   <PropertyGroup>
70     <!-- Yield optimization properties -->
71     <YieldDuringToolExecution Condition="'$(YieldDuringToolExecution)' == ''">true</YieldDuringToolExecution>
72   </PropertyGroup>
73
74   <PropertyGroup Condition="'$(TargetFrameworkIdentifier)' != '' and '$(TargetFrameworkVersion)' != ''">
75     <TargetFrameworkMoniker Condition="'$(TargetFrameworkMoniker)' == '' and '$(TargetFrameworkProfile)' != ''">$(TargetFrameworkIdentifier),Version=$(TargetFrameworkVersion),Profile=$(TargetFrameworkProfile)</TargetFrameworkMoniker>
76     <TargetFrameworkMoniker Condition="'$(TargetFrameworkMoniker)' == ''">$(TargetFrameworkIdentifier),Version=$(TargetFrameworkVersion)</TargetFrameworkMoniker>
77
78     <!-- The FrameworkPathOverride is required for the inproc visual basic compiler to initialize when targeting target frameworks less than 4.0. If .net 2.0 is not installed then the property value above will not provide the location
79              of mscorlib. This is also true if the build author overrides this property to some other directory which does not contain mscorlib.dll. In the case we cannot find mscorlib.dll at the correct location
80              we need to find a directory which does contain mscorlib to allow the inproc compiler to initialize and give us the chance to show certain dialogs in the IDE (which only happen after initialization).-->
81     <FrameworkPathOverride Condition="'$(FrameworkPathOverride)' == ''">$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPathToStandardLibraries($(TargetFrameworkIdentifier), $(TargetFrameworkVersion), $(TargetFrameworkProfile), $(PlatformTarget), $(TargetFrameworkRootPath)))</FrameworkPathOverride>
82     <FrameworkPathOverride Condition="!Exists('$(FrameworkPathOverride)\mscorlib.dll')">$(MSBuildFrameworkToolsPath)</FrameworkPathOverride>
83   </PropertyGroup>
84
85   <PropertyGroup>
86     <TargetPlatformIdentifier Condition="'$(TargetPlatformIdentifier)' == ''">Windows</TargetPlatformIdentifier>
87     <TargetPlatformVersion Condition="'$(TargetPlatformVersion)' == ''">7.0</TargetPlatformVersion>
88     <TargetPlatformSdkPath Condition="'$(TargetPlatformSdkPath)' == '' and '$(TargetPlatformSdkRootOverride)' != ''">$(TargetPlatformSdkRootOverride)\</TargetPlatformSdkPath>
89     <TargetPlatformSdkPath Condition="'$(TargetPlatformSdkPath)' == '' and '$(TargetPlatformIdentifier)' == 'Windows' and '$(OS)' == 'Windows_NT' and '$(MSBuildRuntimeType)' != 'Core'">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\Software\Microsoft\Microsoft SDKs\Windows\v$(TargetPlatformVersion)', InstallationFolder, null, RegistryView.Registry32, RegistryView.Default))</TargetPlatformSdkPath>
90     <TargetPlatformSdkPath Condition="'$(TargetPlatformSdkPath)' == ''">$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformSDKLocation($(TargetPlatformIdentifier), $(TargetPlatformVersion)))</TargetPlatformSdkPath>
91     <TargetPlatformSdkMetadataLocation Condition="'$(TargetPlatformSdkMetadataLocation)' == '' and Exists('$(TargetPlatformSdkPath)')">$(TargetPlatformSdkPath)Windows Metadata</TargetPlatformSdkMetadataLocation>
92     <TargetPlatformSdkMetadataLocation Condition="Exists('$(TargetPlatformSdkPath)') and ('$(TargetPlatformSdkMetadataLocation)' == '' or !Exists('$(TargetPlatformSdkMetadataLocation)'))">$(TargetPlatformSdkPath)References\CommonConfiguration\Neutral</TargetPlatformSdkMetadataLocation>
93     <TargetPlatformWinMDLocation Condition="'$(TargetPlatformWinMDLocation)' == '' and Exists('$(TargetPlatformSdkMetadataLocation)')">$(TargetPlatformSdkMetadataLocation)</TargetPlatformWinMDLocation>
94     <UseOSWinMdReferences Condition="'$(UseOSWinMdReferences)' == '' and ('$(TargetPlatformWinMDLocation)' == '' and '$(TargetPlatformIdentifier)' == 'Windows' and '$(TargetPlatformVersion)' &gt; '7.0')">true</UseOSWinMdReferences>
95     <TargetPlatformWinMDLocation Condition="'$(UseOsWinMdReferences)' == 'true'">$(WinDir)\System32\WinMetadata</TargetPlatformWinMDLocation>
96     <TargetPlatformMoniker Condition="'$(TargetPlatformMoniker)' == ''">$(TargetPlatformIdentifier),Version=$(TargetPlatformVersion)</TargetPlatformMoniker>
97     <TargetPlatformDisplayName Condition="'$(TargetPlatformDisplayName)' == ''">$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformSDKDisplayName($(TargetPlatformIdentifier), $(TargetPlatformVersion)))</TargetPlatformDisplayName>
98   </PropertyGroup>
99
100   <!--
101     Several properties must be set in the main project file, before using this .TARGETS file.
102     However, if the properties are not set, we pick some defaults.
103
104     OutDir:
105     Indicates the final output location for the project or solution. When building a solution,
106     OutDir can be used to gather multiple project outputs in one location. In addition,
107     OutDir is included in AssemblySearchPaths used for resolving references.
108
109     OutputPath:
110     This property is usually specified in the project file and is used to initialize OutDir.
111     OutDir and OutputPath are distinguished for legacy reasons, and OutDir should be used if at all possible.
112
113     BaseIntermediateOutputPath:
114     This is the top level folder where all configuration specific intermediate output folders will be created.
115     Default value is obj\
116
117     IntermediateOutputPath:
118     This is the full intermediate Output Path, and is derived from BaseIntermediateOutputPath, if none specified
119     (eg. obj\debug). If this property is overridden, then setting BaseIntermediateOutputPath has no effect.
120     -->
121
122   <PropertyGroup>
123     <!-- Ensure any OutputPath has a trailing slash, so it can be concatenated -->
124     <OutputPath Condition="'$(OutputPath)' != '' and !HasTrailingSlash('$(OutputPath)')">$(OutputPath)\</OutputPath>
125     <AssemblyName Condition=" '$(AssemblyName)'=='' ">$(MSBuildProjectName)</AssemblyName>
126     <!--
127         Be careful not to give OutputPath a default value in the case of an invalid Configuration/Platform.
128         We use OutputPath specifically to check for invalid configurations/platforms.
129         -->
130     <OutputPath Condition=" '$(Platform)'=='' and '$(Configuration)'=='' and '$(OutputPath)'=='' ">bin\Debug\</OutputPath>
131     <_OriginalConfiguration>$(Configuration)</_OriginalConfiguration>
132     <_OriginalPlatform>$(Platform)</_OriginalPlatform>
133     <Configuration Condition=" '$(Configuration)'=='' ">Debug</Configuration>
134     <ConfigurationName Condition=" '$(ConfigurationName)' == '' ">$(Configuration)</ConfigurationName>
135     <!-- Example, Debug -->
136     <Platform Condition=" '$(Platform)'=='' ">AnyCPU</Platform>
137
138     <OutputType Condition=" '$(TargetType)' != ''">$(TargetType)</OutputType>
139     <OutputType Condition=" '$(TargetType)' == 'Container' or '$(TargetType)' == 'DocumentContainer' ">library</OutputType>
140     <OutputType Condition=" '$(OutputType)' == '' ">exe</OutputType>
141
142     <DebugSymbols Condition=" '$(ConfigurationName)' == 'Debug' and '$(DebugSymbols)' == '' and '$(DebugType)'==''">true</DebugSymbols>
143
144     <!-- Whether or not a .pdb file is produced. -->
145     <_DebugSymbolsProduced>false</_DebugSymbolsProduced>
146     <_DebugSymbolsProduced Condition="'$(DebugSymbols)'=='true'">true</_DebugSymbolsProduced>
147     <_DebugSymbolsProduced Condition="'$(DebugType)'=='none'">false</_DebugSymbolsProduced>
148     <_DebugSymbolsProduced Condition="'$(DebugType)'=='pdbonly'">true</_DebugSymbolsProduced>
149     <_DebugSymbolsProduced Condition="'$(DebugType)'=='full'">true</_DebugSymbolsProduced>
150     <_DebugSymbolsProduced Condition="'$(DebugType)'=='portable'">true</_DebugSymbolsProduced>
151     <_DebugSymbolsProduced Condition="'$(DebugType)'=='embedded'">false</_DebugSymbolsProduced>
152
153     <!-- Whether or not a .xml file is produced. -->
154     <_DocumentationFileProduced>true</_DocumentationFileProduced>
155     <_DocumentationFileProduced Condition="'$(DocumentationFile)'==''">false</_DocumentationFileProduced>
156
157     <!-- Whether or not a reference assembly is produced. -->
158     <ProduceReferenceAssembly Condition="'$(ProduceReferenceAssembly)' == ''">false</ProduceReferenceAssembly>
159   </PropertyGroup>
160
161   <PropertyGroup Condition=" '$(OutputPath)' == '' ">
162     <!--
163         A blank OutputPath at this point means that the user passed in an invalid Configuration/Platform
164         combination.  Whether this is considered an error or a warning depends on the value of
165         $(SkipInvalidConfigurations).
166         -->
167     <_InvalidConfigurationError Condition=" '$(SkipInvalidConfigurations)' != 'true' ">true</_InvalidConfigurationError>
168     <_InvalidConfigurationWarning Condition=" '$(SkipInvalidConfigurations)' == 'true' ">true</_InvalidConfigurationWarning>
169   </PropertyGroup>
170
171   <!--
172     IDE Macros available from both integrated builds and from command line builds.
173     The following properties are 'macros' that are available via IDE for
174     pre and post build steps.
175     -->
176   <PropertyGroup>
177     <TargetExt Condition="'$(TargetExt)' == '' and '$(OutputType)'=='exe'">.exe</TargetExt>
178     <TargetExt Condition="'$(TargetExt)' == '' and '$(OutputType)'=='winexe'">.exe</TargetExt>
179     <TargetExt Condition="'$(TargetExt)' == '' and '$(OutputType)'=='appcontainerexe'">.exe</TargetExt>
180     <TargetExt Condition="'$(TargetExt)' == '' and '$(OutputType)'=='library'">.dll</TargetExt>
181     <TargetExt Condition="'$(TargetExt)' == '' and '$(OutputType)'=='module'">.netmodule</TargetExt>
182     <TargetExt Condition="'$(TargetExt)' == '' and '$(OutputType)'=='winmdobj'">.winmdobj</TargetExt>
183   </PropertyGroup>
184
185   <PropertyGroup>
186
187     <!-- Required for enabling Team Build for packaging app package-generating projects -->
188     <OutDirWasSpecified Condition=" '$(OutDir)'!='' and '$(OutDirWasSpecified)'=='' ">true</OutDirWasSpecified>
189
190     <OutDir Condition=" '$(OutDir)' == '' ">$(OutputPath)</OutDir>
191     <!-- Example, bin\Debug\ -->
192     <!-- Ensure OutDir has a trailing slash, so it can be concatenated -->
193     <OutDir Condition="'$(OutDir)' != '' and !HasTrailingSlash('$(OutDir)')">$(OutDir)\</OutDir>
194     <ProjectName Condition=" '$(ProjectName)' == '' ">$(MSBuildProjectName)</ProjectName>
195     <!-- Example, MyProject -->
196
197     <!-- For projects that generate app packages or ones that want a per-project output directory, update OutDir to include the project name -->
198     <OutDir Condition="'$(OutDir)' != '' and '$(OutDirWasSpecified)' == 'true' and (('$(WindowsAppContainer)' == 'true' and '$(GenerateProjectSpecificOutputFolder)' != 'false') or '$(GenerateProjectSpecificOutputFolder)' == 'true')">$(OutDir)$(ProjectName)\</OutDir>
199
200     <TargetName Condition="'$(TargetName)' == '' and '$(OutputType)' == 'winmdobj' and '$(RootNamespace)' != ''">$(RootNamespace)</TargetName>
201     <TargetName Condition=" '$(TargetName)' == '' ">$(AssemblyName)</TargetName>
202     <!-- Example, MyAssembly -->
203     <ProjectFileName Condition=" '$(ProjectFileName)' == '' ">$(MSBuildProjectFile)</ProjectFileName>
204     <!-- Example, MyProject.csproj -->
205     <ProjectExt Condition=" '$(ProjectExt)' == '' ">$(MSBuildProjectExtension)</ProjectExt>
206     <!-- Example, .csproj -->
207     <WinMDExpOutputWindowsMetadataFilename Condition="'$(WinMDExpOutputWindowsMetadataFilename)' == '' and '$(OutputType)' == 'winmdobj'">$(TargetName).winmd</WinMDExpOutputWindowsMetadataFilename>
208     <TargetFileName Condition=" '$(TargetFileName)' == '' and '$(OutputType)' == 'winmdobj'">$(WinMDExpOutputWindowsMetadataFilename)</TargetFileName>
209     <TargetFileName Condition=" '$(TargetFileName)' == '' ">$(TargetName)$(TargetExt)</TargetFileName>
210
211     <!-- Example, MyAssembly.dll -->
212   </PropertyGroup>
213
214   <PropertyGroup>
215     <!--
216         The PublishableProject property is used when invoking the publish target on a solution that
217         contains multiple projects. The property determines which projects should be published, and
218         which projects should be skipped in the publish target. By default any "Windows Application"
219         or "Console Application" project type is publishable. However, a project that would otherwise
220         be published can be skipped by defining the PublishableProject property in the project itself.
221         -->
222     <_DeploymentPublishableProjectDefault Condition="'$(OutputType)'=='winexe' or '$(OutputType)'=='exe' or '$(OutputType)'=='appcontainerexe'">true</_DeploymentPublishableProjectDefault>
223     <PublishableProject Condition="'$(PublishableProject)'==''">$(_DeploymentPublishableProjectDefault)</PublishableProject>
224
225     <_DeploymentTargetApplicationManifestFileName Condition="'$(OutputType)'=='library'">Native.$(AssemblyName).manifest</_DeploymentTargetApplicationManifestFileName>
226     <!-- Example, Native.MyAssembly.manifest -->
227     <_DeploymentTargetApplicationManifestFileName Condition="'$(OutputType)'=='winexe'">$(TargetFileName).manifest</_DeploymentTargetApplicationManifestFileName>
228     <!-- Example, MyAssembly.exe.manifest -->
229     <_DeploymentTargetApplicationManifestFileName Condition="'$(OutputType)'=='exe'">$(TargetFileName).manifest</_DeploymentTargetApplicationManifestFileName>
230     <!-- Example, MyAssembly.exe.manifest -->
231     <_DeploymentTargetApplicationManifestFileName Condition="'$(OutputType)'=='appcontainerexe'">$(TargetFileName).manifest</_DeploymentTargetApplicationManifestFileName>
232     <!-- Example, MyAssembly.exe.manifest -->
233     <TargetDeployManifestFileName Condition="'$(TargetDeployManifestFileName)' == '' and '$(HostInBrowser)' != 'true'">$(AssemblyName).application</TargetDeployManifestFileName>
234     <!-- Example, MyAssembly.application -->
235     <TargetDeployManifestFileName Condition="'$(TargetDeployManifestFileName)' == '' and '$(HostInBrowser)' == 'true'">$(AssemblyName).xbap</TargetDeployManifestFileName>
236     <!-- Example, MyAssembly.xbap -->
237     <GenerateClickOnceManifests Condition="'$(OutputType)'=='winexe' or '$(OutputType)'=='exe' or '$(OutputType)'=='appcontainerexe'">$(GenerateManifests)</GenerateClickOnceManifests>
238
239     <_DeploymentApplicationManifestIdentity Condition="'$(OutputType)'=='library'">Native.$(AssemblyName)</_DeploymentApplicationManifestIdentity>
240     <_DeploymentApplicationManifestIdentity Condition="'$(OutputType)'=='winexe'">$(AssemblyName).exe</_DeploymentApplicationManifestIdentity>
241     <_DeploymentApplicationManifestIdentity Condition="'$(OutputType)'=='exe'">$(AssemblyName).exe</_DeploymentApplicationManifestIdentity>
242     <_DeploymentApplicationManifestIdentity Condition="'$(OutputType)'=='appcontainerexe'">$(AssemblyName).exe</_DeploymentApplicationManifestIdentity>
243     <_DeploymentDeployManifestIdentity Condition="'$(HostInBrowser)' != 'true'">$(AssemblyName).application</_DeploymentDeployManifestIdentity>
244     <_DeploymentDeployManifestIdentity Condition="'$(HostInBrowser)' == 'true'">$(AssemblyName).xbap</_DeploymentDeployManifestIdentity>
245
246     <_DeploymentFileMappingExtension Condition="'$(MapFileExtensions)'=='true'">.deploy</_DeploymentFileMappingExtension>
247     <_DeploymentFileMappingExtension Condition="'$(MapFileExtensions)'!='true'"></_DeploymentFileMappingExtension>
248
249     <_DeploymentBuiltUpdateInterval Condition="'$(UpdatePeriodically)'=='true'">$(UpdateInterval)</_DeploymentBuiltUpdateInterval>
250     <_DeploymentBuiltUpdateIntervalUnits Condition="'$(UpdatePeriodically)'=='true'">$(UpdateIntervalUnits)</_DeploymentBuiltUpdateIntervalUnits>
251     <_DeploymentBuiltUpdateInterval Condition="'$(UpdatePeriodically)'!='true'">0</_DeploymentBuiltUpdateInterval>
252     <_DeploymentBuiltUpdateIntervalUnits Condition="'$(UpdatePeriodically)'!='true'">Days</_DeploymentBuiltUpdateIntervalUnits>
253     <_DeploymentBuiltMinimumRequiredVersion Condition="'$(UpdateRequired)'=='true' and '$(Install)'=='true'">$(MinimumRequiredVersion)</_DeploymentBuiltMinimumRequiredVersion>
254
255     <MaxTargetPath Condition="'$(MaxTargetPath)'==''">100</MaxTargetPath>
256   </PropertyGroup>
257
258   <PropertyGroup>
259     <!--
260         By default, GenerateApplicationManifest puts all satellite assemblies to the manifest
261         record by default by setting TargetCulture to *.
262         -->
263     <TargetCulture Condition="'$(TargetCulture)'==''">*</TargetCulture>
264     <FallbackCulture Condition="'$(UICulture)'!='' and '$(FallbackCulture)'==''">$(UICulture)</FallbackCulture>
265   </PropertyGroup>
266
267   <ItemGroup>
268     <!-- Not used any more-->
269     <_OutputPathItem Include="$(OutDir)"/>
270
271     <_UnmanagedRegistrationCache Include="$(BaseIntermediateOutputPath)$(MSBuildProjectFile).UnmanagedRegistration.cache"/>
272     <_ResolveComReferenceCache Include="$(IntermediateOutputPath)$(MSBuildProjectFile).ResolveComReference.cache"/>
273   </ItemGroup>
274
275   <PropertyGroup>
276     <!-- Example, c:\MyProjects\MyProject\bin\debug\ -->
277     <!--
278         Condition intentionally omitted on this one, because it causes problems
279         when we pick up the value of an environment variable named TargetDir
280         -->
281     <TargetDir Condition="'$(OutDir)' != ''">$([MSBuild]::Escape($([System.IO.Path]::GetFullPath(`$([System.IO.Path]::Combine(`$(MSBuildProjectDirectory)`, `$(OutDir)`))`))))</TargetDir>
282
283     <!-- Example, c:\MyProjects\MyProject\bin\debug\MyAssembly.dll -->
284     <TargetPath Condition=" '$(TargetPath)' == '' ">$(TargetDir)$(TargetFileName)</TargetPath>
285
286     <TargetRefPath Condition=" '$(TargetRefPath)' == '' and '$(ProduceReferenceAssembly)' == 'true' ">$([MSBuild]::NormalizePath($(TargetDir), 'ref', $(TargetFileName)))</TargetRefPath>
287
288     <!-- Example, c:\MyProjects\MyProject\ -->
289     <ProjectDir Condition=" '$(ProjectDir)' == '' ">$(MSBuildProjectDirectory)\</ProjectDir>
290
291     <!-- Example, c:\MyProjects\MyProject\MyProject.csproj -->
292     <ProjectPath Condition=" '$(ProjectPath)' == '' ">$(ProjectDir)$(ProjectFileName)</ProjectPath>
293
294     <!-- Example, AnyCPU -->
295     <PlatformName Condition=" '$(PlatformName)' == '' ">$(Platform)</PlatformName>
296   </PropertyGroup>
297
298   <ItemGroup>
299     <!-- This is not used here but remains for backwards compatibility -->
300     <AppConfigFileDestination Include="$(OutDir)$(TargetFileName).config"/>
301   </ItemGroup>
302
303   <!--
304     IDE Macros available only from integrated builds.
305     The following properties are 'macros' that are available via IDE for
306     pre and post build steps. However, they are not defined when directly building
307     a project from the command line, only when building a solution.
308     -->
309   <PropertyGroup>
310     <DevEnvDir Condition="'$(DevEnvDir)'==''">*Undefined*</DevEnvDir>
311     <SolutionName Condition="'$(SolutionName)'==''">*Undefined*</SolutionName>
312     <!-- Example, MySolution -->
313     <SolutionFileName Condition="'$(SolutionFileName)'==''">*Undefined*</SolutionFileName>
314     <!-- Example, MySolution.sln -->
315     <SolutionPath Condition="'$(SolutionPath)'==''">*Undefined*</SolutionPath>
316     <!-- Example, f:\MySolutions\MySolution\MySolution.sln -->
317     <SolutionDir Condition="'$(SolutionDir)'==''">*Undefined*</SolutionDir>
318     <!-- Example, f:\MySolutions\MySolution\ -->
319     <SolutionExt Condition="'$(SolutionExt)'==''">*Undefined*</SolutionExt>
320     <!-- Example, .sln -->
321   </PropertyGroup>
322
323   <PropertyGroup>
324     <GenerateBindingRedirectsOutputType Condition="'$(OutputType)'=='exe' or '$(OutputType)'=='winexe'">true</GenerateBindingRedirectsOutputType>
325   </PropertyGroup>
326   <PropertyGroup Condition="'$(AutoUnifyAssemblyReferences)' == ''">
327     <AutoUnifyAssemblyReferences>true</AutoUnifyAssemblyReferences>
328     <AutoUnifyAssemblyReferences Condition="'$(GenerateBindingRedirectsOutputType)' == 'true' and '$(AutoGenerateBindingRedirects)' != 'true'">false</AutoUnifyAssemblyReferences>
329   </PropertyGroup>
330   <PropertyGroup>
331     <BaseIntermediateOutputPath Condition="!HasTrailingSlash('$(BaseIntermediateOutputPath)')">$(BaseIntermediateOutputPath)\</BaseIntermediateOutputPath>
332     <CleanFile Condition="'$(CleanFile)'==''">$(MSBuildProjectFile).FileListAbsolute.txt</CleanFile>
333     <!-- During DesignTime Builds, skip project reference build as Design time is only queueing information.-->
334     <BuildProjectReferences Condition="'$(BuildProjectReferences)' == '' and '$(DesignTimeBuild)' == 'true'">false</BuildProjectReferences>
335     <!-- By default we will build (and if applicable, clean) all project references. But this can be used to disable that-->
336     <BuildProjectReferences Condition="'$(BuildProjectReferences)' == ''">true</BuildProjectReferences>
337     <BuildInParallel Condition="'$(BuildInParallel)' == ''">true</BuildInParallel>
338     <_ResolveReferenceDependencies Condition="'$(_ResolveReferenceDependencies)' == ''">false</_ResolveReferenceDependencies>
339     <_GetChildProjectCopyToOutputDirectoryItems Condition="'$(_GetChildProjectCopyToOutputDirectoryItems)' == ''">true</_GetChildProjectCopyToOutputDirectoryItems>
340     <OverwriteReadOnlyFiles Condition="'$(OverwriteReadOnlyFiles)' == ''">false</OverwriteReadOnlyFiles>
341     <ComReferenceNoClassMembers Condition="'$(ComReferenceNoClassMembers)' == ''">false</ComReferenceNoClassMembers>
342   </PropertyGroup>
343
344   <PropertyGroup Condition=" $(IntermediateOutputPath) == '' ">
345     <IntermediateOutputPath Condition=" '$(PlatformName)' == 'AnyCPU' ">$(BaseIntermediateOutputPath)$(Configuration)\</IntermediateOutputPath>
346     <IntermediateOutputPath Condition=" '$(PlatformName)' != 'AnyCPU' ">$(BaseIntermediateOutputPath)$(PlatformName)\$(Configuration)\</IntermediateOutputPath>
347   </PropertyGroup>
348   <PropertyGroup>
349     <IntermediateOutputPath Condition="!HasTrailingSlash('$(IntermediateOutputPath)')">$(IntermediateOutputPath)\</IntermediateOutputPath>
350     <_GenerateBindingRedirectsIntermediateAppConfig>$(IntermediateOutputPath)$(MSBuildProjectFile).$(TargetFileName).config</_GenerateBindingRedirectsIntermediateAppConfig>
351   </PropertyGroup>
352   <ItemGroup>
353     <IntermediateAssembly Include="$(IntermediateOutputPath)$(TargetName)$(TargetExt)"/>
354     <FinalDocFile Include="@(DocFileItem->'$(OutDir)%(Filename)%(Extension)')"/>
355     <CopyUpToDateMarker Include="$([MSBuild]::NormalizePath('$(MSBuildProjectDirectory)', '$(IntermediateOutputPath)', '$(MSBuildProjectFile).CopyComplete'))" />
356   </ItemGroup>
357
358   <ItemGroup Condition="'$(ProduceReferenceAssembly)' == 'true'">
359     <IntermediateRefAssembly Include="$(IntermediateOutputPath)ref\$(TargetName)$(TargetExt)" Condition="'@(IntermediateRefAssembly)' == ''" />
360     <CreateDirectory Include="@(IntermediateRefAssembly->'%(RootDir)%(Directory)')" />
361     <CreateDirectory Include="$(OutDir)ref" />
362   </ItemGroup>
363
364   <ItemGroup Condition="'$(_DebugSymbolsProduced)' == 'true'">
365     <_DebugSymbolsIntermediatePath Include="$(IntermediateOutputPath)$(TargetName).compile.pdb" Condition="'$(OutputType)' == 'winmdobj' and '@(_DebugSymbolsIntermediatePath)' == ''"/>
366     <_DebugSymbolsIntermediatePath Include="$(IntermediateOutputPath)$(TargetName).pdb" Condition="'$(OutputType)' != 'winmdobj' and '@(_DebugSymbolsIntermediatePath)' == ''"/>
367     <_DebugSymbolsOutputPath Include="@(_DebugSymbolsIntermediatePath->'$(OutDir)%(Filename)%(Extension)')" />
368   </ItemGroup>
369
370   <PropertyGroup Condition="'$(_DebugSymbolsProduced)' == 'true' and '$(OutputType)' == 'winmdobj'">
371     <WinMDExpOutputPdb Condition="'$(WinMDExpOutputPdb)' == ''">$(IntermediateOutputPath)$(TargetName).pdb</WinMDExpOutputPdb>
372     <_WinMDDebugSymbolsOutputPath>$([System.IO.Path]::Combine('$(OutDir)', $([System.IO.Path]::GetFileName('$(WinMDExpOutputPdb)'))))</_WinMDDebugSymbolsOutputPath>
373   </PropertyGroup>
374
375   <PropertyGroup Condition="'$(OutputType)' == 'winmdobj' and '$(DocumentationFile)'!=''">
376     <WinMDOutputDocumentationFile Condition="'$(WinMDOutputDocumentationFile)' == ''">$(IntermediateOutputPath)$(TargetName).xml</WinMDOutputDocumentationFile>
377     <_WinMDDocFileOutputPath>$([System.IO.Path]::Combine('$(OutDir)', $([System.IO.Path]::GetFileName('$(WinMDOutputDocumentationFile)'))))</_WinMDDocFileOutputPath>
378   </PropertyGroup>
379
380   <PropertyGroup Condition="'$(WinMDExpOutputWindowsMetadataFilename)' != ''">
381     <_IntermediateWindowsMetadataPath>$(IntermediateOutputPath)$(WinMDExpOutputWindowsMetadataFilename)</_IntermediateWindowsMetadataPath>
382     <_WindowsMetadataOutputPath>$(OutDir)$(WinMDExpOutputWindowsMetadataFilename)</_WindowsMetadataOutputPath>
383   </PropertyGroup>
384
385   <ItemGroup>
386     <!-- Create an item for entry point of the ClickOnce application (Example: WindowsApplication1.exe) -->
387     <_DeploymentManifestEntryPoint Include="@(IntermediateAssembly)">
388       <TargetPath>$(TargetFileName)</TargetPath>
389     </_DeploymentManifestEntryPoint>
390
391     <!-- Create an item for the application icon if one exists in the project (Example: app.ico) -->
392     <!-- NOTE: The item Include and the Exists function are operating relative to the PROJECT (.csproj, .vbproj etc.) directory in this case -->
393     <_DeploymentManifestIconFile Include="$(ApplicationIcon)" Condition="Exists('$(ApplicationIcon)')">
394       <TargetPath>$(ApplicationIcon)</TargetPath>
395     </_DeploymentManifestIconFile>
396
397     <!-- Create an item for the output application manifest (Example: WindowsApplication1.exe.manifeset) -->
398     <ApplicationManifest Include="$(IntermediateOutputPath)$(_DeploymentTargetApplicationManifestFileName)">
399       <TargetPath>$(_DeploymentTargetApplicationManifestFileName)</TargetPath>
400     </ApplicationManifest>
401
402     <!-- Create an item for the final application manifest (Example: WindowsApplication1.exe.manifeset)
403              This item represents the final output application manifest used for project-to-project
404              references and for copying to the publish output location. -->
405     <_ApplicationManifestFinal Include="$(OutDir)$(_DeploymentTargetApplicationManifestFileName)">
406       <TargetPath>$(_DeploymentTargetApplicationManifestFileName)</TargetPath>
407     </_ApplicationManifestFinal>
408
409     <!-- Create an item for the output deploy manifest (Example: WindowsApplication1.application) -->
410     <DeployManifest Include="$(IntermediateOutputPath)$(TargetDeployManifestFileName)">
411       <TargetPath>$(TargetDeployManifestFileName)</TargetPath>
412     </DeployManifest>
413
414     <!-- Create an item for the intermediate trust info file -->
415     <_DeploymentIntermediateTrustInfoFile Include="$(IntermediateOutputPath)$(TargetName).TrustInfo.xml" Condition="'$(TargetZone)'!=''"/>
416   </ItemGroup>
417
418   <!--
419     Determine the <deploymentProvider> (_DeploymentUrl) for the ClickOnce deployment manifest.
420     Prefer the UpdateUrl, falling back to InstallUrl or PublishUrl if not specified.
421     If the UpdateUrl is specified then _DeploymentUrl is always set to the UpdateUrl.
422     Otherwise, only set the _DeploymentUrl if it's an installed app and updates are enabled.
423     -->
424   <PropertyGroup>
425     <_DeploymentUrl Condition="'$(_DeploymentUrl)'==''">$(UpdateUrl)</_DeploymentUrl>
426     <_DeploymentUrl Condition="'$(_DeploymentUrl)'==''">$(InstallUrl)</_DeploymentUrl>
427     <_DeploymentUrl Condition="'$(_DeploymentUrl)'==''">$(PublishUrl)</_DeploymentUrl>
428     <_DeploymentUrl Condition="!('$(UpdateUrl)'=='') and '$(Install)'=='false'"></_DeploymentUrl>
429     <_DeploymentUrl Condition="'$(_DeploymentUrl)'!=''">$(_DeploymentUrl)$(TargetDeployManifestFileName)</_DeploymentUrl>
430     <!--
431         Need to explicitly blank out the _DeploymentUrl when it's not used. Otherwise an
432         inappropriate value may be used. For example a local path from the PublishUrl
433         is something we never want to see in the manifest because it means you could
434         only install the app from that machine.
435         -->
436     <_DeploymentUrl Condition="'$(UpdateUrl)'=='' and !('$(Install)'=='true' and '$(UpdateEnabled)'=='true')"></_DeploymentUrl>
437     <_DeploymentUrl Condition="'$(ExcludeDeploymentUrl)'=='true'"></_DeploymentUrl>
438   </PropertyGroup>
439
440   <!-- Determine the URLs for the bootstrapper. -->
441   <PropertyGroup>
442     <_DeploymentApplicationUrl Condition="'$(IsWebBootstrapper)'=='true'">$(InstallUrl)</_DeploymentApplicationUrl>
443     <_DeploymentApplicationUrl Condition="'$(IsWebBootstrapper)'=='true' and '$(InstallUrl)'==''">$(PublishUrl)</_DeploymentApplicationUrl>
444     <_DeploymentComponentsUrl Condition="'$(BootstrapperComponentsLocation)'=='Absolute'">$(BootstrapperComponentsUrl)</_DeploymentComponentsUrl>
445   </PropertyGroup>
446
447   <!-- Output location for publish target. -->
448   <PropertyGroup>
449     <PublishDir Condition="'$(PublishDir)' != '' and !HasTrailingSlash('$(PublishDir)')">$(PublishDir)\</PublishDir>
450     <PublishDir Condition="'$(PublishDir)'==''">$(OutputPath)app.publish\</PublishDir>
451   </PropertyGroup>
452
453   <!--
454     ProcessorArchitecture is the target processor architecture.
455     -->
456   <PropertyGroup Condition="'$(ProcessorArchitecture)'==''">
457     <!--
458         If ProcessorArchitecture is not set, set it to PlatformTarget
459         Note: if $(PlatformTarget) is also blank resolve assembly reference defaults to msil which is the
460         desired behavior in this case
461         -->
462     <ProcessorArchitecture>$(PlatformTarget)</ProcessorArchitecture>
463
464     <!--
465         If Processor architecture is not set and PlatformTarget is a known target translate the
466         PlatformTarget into something ResolveAssemblyReference knows about
467         -->
468     <ProcessorArchitecture Condition=" '$(PlatformTarget)' == 'AnyCpu' ">msil</ProcessorArchitecture>
469     <ProcessorArchitecture Condition=" '$(PlatformTarget)' == 'x64' ">amd64</ProcessorArchitecture>
470     <ProcessorArchitecture Condition=" '$(PlatformTarget)' == 'Itanium' ">ia64</ProcessorArchitecture>
471     <ProcessorArchitecture Condition=" '$(PlatformTarget)' == 'x86' ">x86</ProcessorArchitecture>
472     <ProcessorArchitecture Condition=" '$(PlatformTarget)' == 'ARM' ">arm</ProcessorArchitecture>
473   </PropertyGroup>
474
475  <PropertyGroup>
476     <ConsiderPlatformAsProcessorArchitecture Condition="'$(ConsiderPlatformAsProcessorArchitecture)' == ''">true</ConsiderPlatformAsProcessorArchitecture>
477  </PropertyGroup>
478
479  <PropertyGroup Condition="'$(ProcessorArchitecture)' == '' and '$(ConsiderPlatformAsProcessorArchitecture)' == 'true'">
480     <!-- We need to do this here because if we were to just compare against platform visual would parse them out as available platforms which may not be the case -->
481     <ProcessorArchitectureAsPlatform>$(Platform)</ProcessorArchitectureAsPlatform>
482     <ProcessorArchitecture Condition=" '$(ProcessorArchitectureAsPlatform)' == 'AnyCpu' or '$(ProcessorArchitectureAsPlatform)' == 'Any Cpu'">msil</ProcessorArchitecture>
483     <ProcessorArchitecture Condition=" '$(ProcessorArchitectureAsPlatform)' == 'x64' or '$(ProcessorArchitectureAsPlatform)' == 'amd64'">amd64</ProcessorArchitecture>
484     <ProcessorArchitecture Condition=" '$(ProcessorArchitectureAsPlatform)' == 'Itanium' ">ia64</ProcessorArchitecture>
485     <ProcessorArchitecture Condition=" '$(ProcessorArchitectureAsPlatform)' == 'x86' or '$(ProcessorArchitectureAsPlatform)' == 'win32'">x86</ProcessorArchitecture>
486     <ProcessorArchitecture Condition=" '$(ProcessorArchitectureAsPlatform)' == 'ARM' ">arm</ProcessorArchitecture>
487
488     <!--For compatibility with the 4.0 behavior, if not set above, default to the environment. To override this, set ProcessorArchitecture explicitly. We also need to disable the warning since we do not know if what the environment is set to is correct-->
489     <ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch Condition="'$(ProcessorArchitecture)'==''">None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
490     <ProcessorArchitecture Condition="'$(ProcessorArchitecture)'==''">$(PROCESSOR_ARCHITECTURE)</ProcessorArchitecture>
491   </PropertyGroup>
492
493
494   <!-- Sensible defaults for the most-commonly-desired MSBuildRuntime and MSBuildArchitecture values -->
495   <PropertyGroup Condition="'$(DisableOutOfProcTaskHost)' == ''">
496     <TargetFrameworkAsMSBuildRuntime Condition="'$(TargetFrameworkVersion)' == 'v2.0' or '$(TargetFrameworkVersion)' == 'v3.0' or '$(TargetFrameworkVersion)' == 'v3.5'">CLR2</TargetFrameworkAsMSBuildRuntime>
497     <TargetFrameworkAsMSBuildRuntime Condition="'$(TargetFrameworkVersion)' == 'v4.0' or '$(TargetFrameworkVersion)' == 'v4.5'">CLR4</TargetFrameworkAsMSBuildRuntime>
498     <TargetFrameworkAsMSBuildRuntime Condition="'$(TargetFrameworkAsMSBuildRuntime)' == ''">CurrentRuntime</TargetFrameworkAsMSBuildRuntime>
499
500     <PlatformTargetAsMSBuildArchitectureExplicitlySet Condition="'$(PlatformTargetAsMSBuildArchitecture)' != ''">true</PlatformTargetAsMSBuildArchitectureExplicitlySet>
501     <PlatformTargetAsMSBuildArchitectureExplicitlySet Condition="'$(PlatformTargetAsMSBuildArchitecture)' == ''">false</PlatformTargetAsMSBuildArchitectureExplicitlySet>
502
503     <PlatformTargetAsMSBuildArchitecture Condition="'$(PlatformTarget)' == 'x86' or ('$(PlatformTarget)' == 'x64' and '$(MSBuildExtensionsPath64)' != '')">$(PlatformTarget)</PlatformTargetAsMSBuildArchitecture>
504     <PlatformTargetAsMSBuildArchitecture Condition="'$(PlatformTarget)' == 'arm'">x86</PlatformTargetAsMSBuildArchitecture>
505     <PlatformTargetAsMSBuildArchitecture Condition="('$(PlatformTarget)' == 'ia64' and '$(MSBuildExtensionsPath64)' != '')">x64</PlatformTargetAsMSBuildArchitecture>
506     <PlatformTargetAsMSBuildArchitecture Condition="'$(PlatformTargetAsMSBuildArchitecture)' == ''">CurrentArchitecture</PlatformTargetAsMSBuildArchitecture>
507   </PropertyGroup>
508
509   <!-- Flavor is the project flavor. For example, Client, Smart Devices, SQL Server, etc. -->
510   <PropertyGroup>
511     <ProjectFlavor Condition="'$(ProjectFlavor)'==''">Client</ProjectFlavor>
512   </PropertyGroup>
513
514   <!--
515     The default for compilers is to not delay-sign. If $(DelaySign) is false, let the compiler
516     use its default rather than forcing a no-delay-sign flag to be passed in. This is so that
517     attributes in the source code can override this decision.
518     -->
519   <PropertyGroup>
520     <DelaySign Condition="'$(SignAssembly)' != 'true'">false</DelaySign>
521     <DelaySign Condition="'$(DelaySign)'!='true'"></DelaySign>
522   </PropertyGroup>
523
524   <!-- These properties control web reference proxy generation. -->
525   <PropertyGroup>
526     <WebReference_EnableProperties Condition=" '$(WebReference_EnableProperties)' == '' ">true</WebReference_EnableProperties>
527     <WebReference_EnableSQLTypes Condition=" '$(WebReference_EnableSQLTypes)' == '' ">true</WebReference_EnableSQLTypes>
528     <WebReference_EnableLegacyEventingModel Condition=" '$(WebReference_EnableLegacyEventingModel)' == '' ">false</WebReference_EnableLegacyEventingModel>
529   </PropertyGroup>
530
531   <PropertyGroup>
532     <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildProjectFullPath);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
533     <MSBuildAllProjects Condition="Exists('$(MSBuildProjectFullPath).user')">$(MSBuildAllProjects);$(MSBuildProjectFullPath).user</MSBuildAllProjects>
534   </PropertyGroup>
535
536   <!--
537     These parameters control where to look in the registry for directories to search for
538     assemblies in the assembly resolution tasks.
539     -->
540   <PropertyGroup>
541     <AssemblyFoldersSuffix Condition=" '$(AssemblyFoldersSuffix)' == '' ">AssemblyFoldersEx</AssemblyFoldersSuffix>
542     <FrameworkRegistryBase Condition=" '$(FrameworkRegistryBase)' == '' ">Software\Microsoft\$(TargetFrameworkIdentifier)</FrameworkRegistryBase>
543     <TargetPlatformRegistryBase Condition="'$(TargetPlatformRegistryBase)' == ''">Software\Microsoft\Microsoft SDKs\$(TargetPlatformIdentifier)</TargetPlatformRegistryBase>
544     <AssemblyFoldersConfigFile Condition="'$(AssemblyFoldersConfigFile)' == ''">$(MSBuildToolsPath32)\AssemblyFolders.config</AssemblyFoldersConfigFile>
545     <AssemblyFoldersConfigFileSearchPath Condition="Exists('$(AssemblyFoldersConfigFile)')">{AssemblyFoldersFromConfig:$(AssemblyFoldersConfigFile),$(TargetFrameworkVersion)};</AssemblyFoldersConfigFileSearchPath>
546     <!--
547         The SearchPaths property is set to find assemblies in the following order:
548
549             (1) Files from current project - indicated by {CandidateAssemblyFiles}
550             (2) $(ReferencePath) - the reference path property, which comes from the .USER file.
551             (3) The hintpath from the referenced item itself, indicated by {HintPathFromItem}.
552             (4) The directory of MSBuild's "target" runtime from GetFrameworkPath.
553                 The "target" runtime folder is the folder of the runtime that MSBuild is a part of.
554             (5) Registered assembly folders, indicated by {Registry:*,*,*}
555             (6) Assembly folders from AssemblyFolders.config file (provided by Visual Studio Dev15+).
556             (7) Legacy registered assembly folders, indicated by {AssemblyFolders}
557             (8) Resolve to the GAC.
558             (9) Treat the reference's Include as if it were a real file name.
559             (10) Look in the application's output folder (like bin\debug)
560         -->
561     <AssemblySearchPaths Condition=" '$(AssemblySearchPaths)' == ''">
562       {CandidateAssemblyFiles};
563       $(ReferencePath);
564       {HintPathFromItem};
565       {TargetFrameworkDirectory};
566       $(AssemblyFoldersConfigFileSearchPath)
567       {Registry:$(FrameworkRegistryBase),$(TargetFrameworkVersion),$(AssemblyFoldersSuffix)$(AssemblyFoldersExConditions)};
568       {AssemblyFolders};
569       {GAC};
570       {RawFileName};
571       $(OutDir)
572     </AssemblySearchPaths>
573
574     <!--
575         These are the extensions that assembly reference resolution will consider for resolution.
576         Add new extensions here if you want to add new file types to consider (for example, .metadata_dll).
577         Put the most likely extensions first for reference resolution speed.
578         -->
579     <AllowedReferenceAssemblyFileExtensions Condition=" '$(AllowedReferenceAssemblyFileExtensions)' == '' ">
580       .winmd;
581       .dll;
582       .exe
583     </AllowedReferenceAssemblyFileExtensions>
584
585     <!--
586         These are the extensions that reference resolution will consider when looking for files related
587         to resolved references.  Add new extensions here if you want to add new file types to consider.
588         -->
589     <AllowedReferenceRelatedFileExtensions Condition=" '$(AllowedReferenceRelatedFileExtensions)' == '' ">
590       .pdb;
591       .xml;
592       .pri;
593       .dll.config;
594       .exe.config
595     </AllowedReferenceRelatedFileExtensions>
596
597     <!--
598         These names are used when determining which TargetFramework subset to use. If the any of the FullReferenceAssemblyNames
599         are seen in the list of client subsets, RAR will assume that no client subset is being used. The list is semicolon seperated
600         For example :   Full;Complete;AllThere
601         -->
602     <FullReferenceAssemblyNames Condition="'$(FullReferenceAssemblyNames)' == ''">Full</FullReferenceAssemblyNames>
603   </PropertyGroup>
604
605   <!-- ContinueOnError takes 3 values:  WarnAndContinue (true), ErrorAndStop (false), and ErrorAndContinue.
606          Default to ErrorAndStop, since that matches the behaviour in previous versions, and what users
607          typically expect -->
608   <PropertyGroup>
609     <ContinueOnError Condition="'$(ContinueOnError)' == ''">false</ContinueOnError>
610   </PropertyGroup>
611
612   <!-- Common Project System support -->
613   <PropertyGroup>
614     <CommonXamlResourcesDirectory Condition=" '$(CommonXamlResourcesDirectory)' == '' ">$(MSBuildThisFileDirectory)$(LangName)\</CommonXamlResourcesDirectory>
615   </PropertyGroup>
616
617   <!-- We need to fallback to en-US in case the xaml rules are not localized (possibly happen on community languages).  -->
618   <PropertyGroup Condition="!Exists('$(CommonXamlResourcesDirectory)')">
619     <CommonXamlResourcesDirectory>$(MSBuildThisFileDirectory)en-US\</CommonXamlResourcesDirectory>
620   </PropertyGroup>
621
622   <ItemGroup Condition=" '$(DefineCommonItemSchemas)' == 'true' ">
623     <PropertyPageSchema Include="$(CommonXamlResourcesDirectory)ProjectItemsSchema.xaml"/>
624
625     <PropertyPageSchema Include="
626                         $(CommonXamlResourcesDirectory)General.xaml;
627                         $(CommonXamlResourcesDirectory)Debugger_General.xaml">
628       <Context>Project</Context>
629     </PropertyPageSchema>
630
631     <PropertyPageSchema Include="$(CommonXamlResourcesDirectory)General.BrowseObject.xaml">
632       <Context>BrowseObject</Context>
633     </PropertyPageSchema>
634
635     <PropertyPageSchema Include="$(CommonXamlResourcesDirectory)General_File.xaml">
636       <Context>File</Context>
637     </PropertyPageSchema>
638
639     <PropertyPageSchema Include="$(CommonXamlResourcesDirectory)SCC.xaml">
640       <Context>Invisible</Context>
641     </PropertyPageSchema>
642
643     <PropertyPageSchema Include="
644                         $(CommonXamlResourcesDirectory)Folder.xaml;
645                         $(CommonXamlResourcesDirectory)None.xaml;
646                         $(CommonXamlResourcesDirectory)Content.xaml;
647                         $(CommonXamlResourcesDirectory)EmbeddedResource.xaml;
648                         ">
649       <Context>File;BrowseObject</Context>
650     </PropertyPageSchema>
651
652     <PropertyPageSchema Include="$(CommonXamlResourcesDirectory)SpecialFolder.xaml;">
653       <Context>File;ProjectSubscriptionService</Context>
654     </PropertyPageSchema>
655   </ItemGroup>
656
657   <PropertyGroup>
658     <DefineCommonReferenceSchemas Condition=" '$(DefineCommonReferenceSchemas)' == '' ">$(DefineCommonItemSchemas)</DefineCommonReferenceSchemas>
659   </PropertyGroup>
660
661   <ItemGroup Condition=" '$(DefineCommonReferenceSchemas)' == 'true' ">
662     <!-- Assembly references -->
663     <PropertyPageSchema Include="$(CommonXamlResourcesDirectory)assemblyreference.xaml">
664       <Context>;BrowseObject</Context>
665     </PropertyPageSchema>
666     <PropertyPageSchema Include="$(CommonXamlResourcesDirectory)ResolvedAssemblyReference.xaml">
667       <Context>ProjectSubscriptionService;BrowseObject</Context>
668     </PropertyPageSchema>
669
670     <!-- COM references -->
671     <PropertyPageSchema Include="$(CommonXamlResourcesDirectory)COMReference.xaml">
672       <Context>;BrowseObject</Context>
673     </PropertyPageSchema>
674     <PropertyPageSchema Include="$(CommonXamlResourcesDirectory)ResolvedCOMReference.xaml">
675       <Context>ProjectSubscriptionService;BrowseObject</Context>
676     </PropertyPageSchema>
677
678     <!-- Project references -->
679     <PropertyPageSchema Include="$(CommonXamlResourcesDirectory)ProjectReference.xaml">
680       <Context>;BrowseObject</Context>
681     </PropertyPageSchema>
682     <PropertyPageSchema Include="$(CommonXamlResourcesDirectory)ResolvedProjectReference.xaml">
683       <Context>ProjectSubscriptionService;BrowseObject</Context>
684     </PropertyPageSchema>
685   </ItemGroup>
686
687   <ItemGroup Condition=" '$(DefineCommonCapabilities)' == 'true' ">
688     <ProjectCapability Include="
689                           AssemblyReferences;
690                           COMReferences;
691                           ProjectReferences;
692                           SharedProjectReferences;
693                           OutputGroups;
694                           AllTargetOutputGroups;
695                           VisualStudioWellKnownOutputGroups;
696                           SingleFileGenerators;
697                           DeclaredSourceItems;
698                           UserSourceItems;
699                            " />
700     <ProjectCapability Condition=" '$(TargetPlatformIdentifier)' == 'Windows' and '$(TargetPlatformVersion)' &lt; 8.0 "
701                        Include="BuildWindowsDesktopTarget" />
702   </ItemGroup>
703
704   <ItemDefinitionGroup Condition=" '$(DefineExplicitDefaults)' == 'true' ">
705     <None>
706       <CopyToOutputDirectory>Never</CopyToOutputDirectory>
707     </None>
708     <Content>
709       <CopyToOutputDirectory>Never</CopyToOutputDirectory>
710     </Content>
711     <Compile>
712       <CopyToOutputDirectory>Never</CopyToOutputDirectory>
713     </Compile>
714     <EmbeddedResource>
715       <CopyToOutputDirectory>Never</CopyToOutputDirectory>
716     </EmbeddedResource>
717   </ItemDefinitionGroup>
718
719   <!--
720     ***********************************************************************************************
721     ***********************************************************************************************
722                                                                 Build Section
723     ***********************************************************************************************
724     ***********************************************************************************************
725     -->
726
727   <!--
728     ============================================================
729                                         _CheckForInvalidConfigurationAndPlatform
730
731     This target checks for errors in statically defined properties.  By setting BeforeTargets, we try
732     to ensure that the target runs before any build related targets.  
733     If your target requires this check and is running as a BeforeTargets of one of the first targets
734     of $(BuildDependsOn), $(RebuildDependsOn), or $(CleanDependsOn) you will need to set your DependsOn
735     to this target.
736     ============================================================
737     -->
738   <Target
739       Name="_CheckForInvalidConfigurationAndPlatform"
740       BeforeTargets="$(BuildDependsOn);Build;$(RebuildDependsOn);Rebuild;$(CleanDependsOn);Clean">
741
742     <PropertyGroup>
743       <_InvalidConfigurationMessageText>The OutputPath property is not set for project '$(MSBuildProjectFile)'.  Please check to make sure that you have specified a valid combination of Configuration and Platform for this project.  Configuration='$(_OriginalConfiguration)'  Platform='$(_OriginalPlatform)'.</_InvalidConfigurationMessageText>
744       <_InvalidConfigurationMessageText Condition="'$(BuildingInsideVisualStudio)' == 'true'">$(_InvalidConfigurationMessageText)  This error may also appear if some other project is trying to follow a project-to-project reference to this project, this project has been unloaded or is not included in the solution, and the referencing project does not build using the same or an equivalent Configuration or Platform.</_InvalidConfigurationMessageText>
745       <_InvalidConfigurationMessageText Condition="'$(BuildingInsideVisualStudio)' != 'true'">$(_InvalidConfigurationMessageText)  You may be seeing this message because you are trying to build a project without a solution file, and have specified a non-default Configuration or Platform that doesn't exist for this project.</_InvalidConfigurationMessageText>
746     </PropertyGroup>
747
748     <Error Condition=" '$(_InvalidConfigurationError)' == 'true' " Text="$(_InvalidConfigurationMessageText)"/>
749     <Warning Condition=" '$(_InvalidConfigurationWarning)' == 'true' " Text="$(_InvalidConfigurationMessageText)"/>
750
751     <Message Condition="'$(DesignTimeBuild)' != 'true'" Text="Configuration=$(Configuration)" Importance="Low" />
752     <Message Condition="'$(DesignTimeBuild)' != 'true'" Text="Platform=$(Platform)" Importance="Low" />
753
754     <!-- Although we try to ensure a trailing slash, it's possible to circumvent this if the property is set on the command line -->
755     <Error Condition="'$(OutDir)' != '' and !HasTrailingSlash('$(OutDir)')" Text="The OutDir property must end with a trailing slash." />
756     <Error Condition="'$(BaseIntermediateOutputPath)' != '' and !HasTrailingSlash('$(BaseIntermediateOutputPath)')" Text="The BaseIntermediateOutputPath must end with a trailing slash." />
757     <Error Condition="'$(IntermediateOutputPath)' != '' and !HasTrailingSlash('$(IntermediateOutputPath)')" Text="The IntermediateOutputPath must end with a trailing slash." />
758
759     <!-- Also update the value of PlatformTargetAsMSBuildArchitecture per the value of Prefer32Bit.  We are doing
760          this here because Prefer32Bit may be set anywhere in the targets, so we can't depend on it having the
761          correct value when we're trying to figure out PlatformTargetAsMSBuildArchitecture -->
762     <PropertyGroup Condition="'$(Prefer32Bit)' == 'true' and ('$(PlatformTarget)' == 'AnyCPU' or '$(PlatformTarget)' == '') and '$(PlatformTargetAsMSBuildArchitectureExplicitlySet)' != 'true'">
763       <PlatformTargetAsMSBuildArchitecture>x86</PlatformTargetAsMSBuildArchitecture>
764     </PropertyGroup>
765   </Target>
766
767   <!--
768     ============================================================
769                                         Build
770
771     The main build entry point.
772     ============================================================
773     -->
774   <PropertyGroup>
775     <BuildDependsOn>
776       BeforeBuild;
777       CoreBuild;
778       AfterBuild
779     </BuildDependsOn>
780   </PropertyGroup>
781   <Target
782       Name="Build"
783       Condition=" '$(_InvalidConfigurationWarning)' != 'true' "
784       DependsOnTargets="$(BuildDependsOn)"
785       Returns="@(TargetPathWithTargetPlatformMoniker)" />
786
787   <!--
788     ============================================================
789                                         BeforeBuild
790
791     Redefine this target in your project in order to run tasks just before Build
792     ============================================================
793     -->
794   <Target Name="BeforeBuild"/>
795
796   <!--
797     ============================================================
798                                         AfterBuild
799
800     Redefine this target in your project in order to run tasks just after Build
801     ============================================================
802     -->
803   <Target Name="AfterBuild"/>
804
805   <!--
806     ============================================================
807                                         CoreBuild
808
809     The core build step calls each of the build targets.
810     ============================================================
811     -->
812   <PropertyGroup>
813     <CoreBuildDependsOn>
814       BuildOnlySettings;
815       PrepareForBuild;
816       PreBuildEvent;
817       ResolveReferences;
818       PrepareResources;
819       ResolveKeySource;
820       Compile;
821       ExportWindowsMDFile;
822       UnmanagedUnregistration;
823       GenerateSerializationAssemblies;
824       CreateSatelliteAssemblies;
825       GenerateManifests;
826       GetTargetPath;
827       PrepareForRun;
828       UnmanagedRegistration;
829       IncrementalClean;
830       PostBuildEvent
831     </CoreBuildDependsOn>
832   </PropertyGroup>
833   <Target
834       Name="CoreBuild"
835       DependsOnTargets="$(CoreBuildDependsOn)">
836
837     <OnError ExecuteTargets="_TimeStampAfterCompile;PostBuildEvent" Condition="'$(RunPostBuildEvent)'=='Always' or '$(RunPostBuildEvent)'=='OnOutputUpdated'"/>
838     <OnError ExecuteTargets="_CleanRecordFileWrites"/>
839
840   </Target>
841
842   <!--
843     ============================================================
844                                         Rebuild
845
846     Delete all intermediate and final build outputs, and then build the project from scratch.
847     ============================================================
848     -->
849   <PropertyGroup>
850
851     <_ProjectDefaultTargets Condition="'$(MSBuildProjectDefaultTargets)' != ''">$(MSBuildProjectDefaultTargets)</_ProjectDefaultTargets>
852     <_ProjectDefaultTargets Condition="'$(MSBuildProjectDefaultTargets)' == ''">Build</_ProjectDefaultTargets>
853
854     <RebuildDependsOn>
855       BeforeRebuild;
856       Clean;
857       $(_ProjectDefaultTargets);
858       AfterRebuild;
859     </RebuildDependsOn>
860
861     <RebuildDependsOn Condition=" '$(MSBuildProjectDefaultTargets)' == 'Rebuild' " >
862       BeforeRebuild;
863       Clean;
864       Build;
865       AfterRebuild;
866     </RebuildDependsOn>
867   </PropertyGroup>
868
869   <Target
870       Name="Rebuild"
871       Condition=" '$(_InvalidConfigurationWarning)' != 'true' "
872       DependsOnTargets="$(RebuildDependsOn)"
873       Returns="$(TargetPath)"/>
874
875   <!--
876     ============================================================
877                                         BeforeRebuild
878
879     Redefine this target in your project in order to run tasks just before Rebuild
880     ============================================================
881     -->
882   <Target Name="BeforeRebuild"/>
883
884   <!--
885     ============================================================
886                                         AfterRebuild
887
888     Redefine this target in your project in order to run tasks just after Rebuild
889     ============================================================
890     -->
891   <Target Name="AfterRebuild"/>
892
893   <!--
894     ============================================================
895                                         BuildGenerateSources
896
897     Redefine this target in your project in order to run tasks for BuildGenerateSources
898
899     Set BuildPassReferences to enable P2P builds
900     ============================================================
901     -->
902   <PropertyGroup>
903     <BuildGenerateSourcesAction>Build</BuildGenerateSourcesAction>
904   </PropertyGroup>
905
906   <Target Name="BuildGenerateSources" DependsOnTargets="BuildGenerateSourcesTraverse;$(BuildGenerateSourcesAction)" />
907
908   <Target Name="BuildGenerateSourcesTraverse" DependsOnTargets="PrepareProjectReferences">
909     <MSBuild
910         Projects="@(_MSBuildProjectReferenceExistent)"
911         Targets="BuildGenerateSources"
912         BuildInParallel="$(BuildInParallel)"
913         Properties="%(_MSBuildProjectReferenceExistent.SetConfiguration); %(_MSBuildProjectReferenceExistent.SetPlatform); %(_MSBuildProjectReferenceExistent.SetTargetFramework);"
914         Condition="'$(BuildPassReferences)' == 'true' and '@(ProjectReferenceWithConfiguration)' != '' and '@(_MSBuildProjectReferenceExistent)' != '' and '%(_MSBuildProjectReferenceExistent.BuildReference)' == 'true'"
915         ContinueOnError="!$(BuildingProject)"
916         RemoveProperties="%(_MSBuildProjectReferenceExistent.GlobalPropertiesToRemove)">
917     </MSBuild>
918   </Target>
919
920   <!--
921     ============================================================
922                                         BuildCompile
923
924     Redefine this target in your project in order to run tasks for BuildCompile
925     ============================================================
926     -->
927   <PropertyGroup>
928     <BuildCompileAction>Build</BuildCompileAction>
929   </PropertyGroup>
930
931   <Target Name="BuildCompile" DependsOnTargets="BuildCompileTraverse;$(BuildCompileAction)" />
932
933   <Target Name="BuildCompileTraverse" DependsOnTargets="PrepareProjectReferences">
934     <MSBuild
935         Projects="@(_MSBuildProjectReferenceExistent)"
936         Targets="BuildCompile"
937         BuildInParallel="$(BuildInParallel)"
938         Properties="%(_MSBuildProjectReferenceExistent.SetConfiguration); %(_MSBuildProjectReferenceExistent.SetPlatform); %(_MSBuildProjectReferenceExistent.SetTargetFramework)"
939         Condition="'$(BuildPassReferences)' == 'true' and '@(ProjectReferenceWithConfiguration)' != '' and '@(_MSBuildProjectReferenceExistent)' != ''  and '%(_MSBuildProjectReferenceExistent.BuildReference)' == 'true'"
940         ContinueOnError="!$(BuildingProject)"
941         RemoveProperties="%(_MSBuildProjectReferenceExistent.GlobalPropertiesToRemove)">
942     </MSBuild>
943   </Target>
944
945   <!--
946     ============================================================
947                                         BuildLink
948
949     Redefine this target in your project in order to run tasks for BuildLink
950     ============================================================
951     -->
952   <PropertyGroup>
953     <BuildLinkAction>Build</BuildLinkAction>
954   </PropertyGroup>
955
956   <Target Name="BuildLink" DependsOnTargets="BuildLinkTraverse;$(BuildLinkAction)" />
957
958   <Target Name="BuildLinkTraverse" DependsOnTargets="PrepareProjectReferences" >
959     <MSBuild
960         Projects="@(_MSBuildProjectReferenceExistent)"
961         Targets="BuildLink"
962         BuildInParallel="$(BuildInParallel)"
963         Properties="%(_MSBuildProjectReferenceExistent.SetConfiguration); %(_MSBuildProjectReferenceExistent.SetPlatform); %(_MSBuildProjectReferenceExistent.SetTargetFramework)"
964         Condition="'$(BuildPassReferences)' == 'true' and '@(ProjectReferenceWithConfiguration)' != '' and '@(_MSBuildProjectReferenceExistent)' != ''  and '%(_MSBuildProjectReferenceExistent.BuildReference)' == 'true'"
965         ContinueOnError="!$(BuildingProject)"
966         RemoveProperties="%(_MSBuildProjectReferenceExistent.GlobalPropertiesToRemove)">
967     </MSBuild>
968   </Target>
969
970   <!--
971     ============================================================
972                                         CopyRunEnvironmentFiles
973
974     Copy environment files necessary to run the user's app to the final directory.
975     This is a public target that can be invoked by an IDE.
976
977     This may be used by an IDE to make the app.config file available for running
978     the target app.
979     ============================================================
980     -->
981   <Target
982       Name="CopyRunEnvironmentFiles"
983       DependsOnTargets="PrepareForBuild;SetWin32ManifestProperties;_CopyAppConfigFile;_CleanRecordFileWrites"/>
984
985   <!--
986     ============================================================
987                                         Run
988
989     Run the final build output if it is a .EXE
990     ============================================================
991     -->
992   <PropertyGroup>
993     <RunDependsOn></RunDependsOn>
994   </PropertyGroup>
995   <Target
996       Name="Run"
997       DependsOnTargets="$(RunDependsOn)">
998
999     <Error Text="Cannot run '$(TargetPath)' because project output type is not '.exe'" Condition="'$(TargetExt)'!='.exe'"/>
1000     <Exec Command="$(TargetPath) $(StartArguments)" WorkingDirectory="$(OutDir)" Condition=" '$(StartWorkingDirectory)' == '' "/>
1001     <Exec Command="$(TargetPath) $(StartArguments)" WorkingDirectory="$(StartWorkingDirectory)" Condition=" '$(StartWorkingDirectory)' != '' "/>
1002
1003   </Target>
1004
1005
1006
1007
1008   <!--
1009     ***********************************************************************************************
1010     ***********************************************************************************************
1011                                                                 BuildOnlySettings Section
1012     ***********************************************************************************************
1013     ***********************************************************************************************
1014     -->
1015
1016   <!--
1017     ============================================================
1018                                         BuildOnlySettings
1019
1020     This target is called only when doing a real build.  It is specifically not called during project load.
1021     ============================================================
1022     -->
1023   <PropertyGroup>
1024     <BuildingProject>false</BuildingProject>
1025   </PropertyGroup>
1026   <Target
1027       Name="BuildOnlySettings">
1028     <PropertyGroup>
1029       <BuildingProject>true</BuildingProject>
1030     </PropertyGroup>
1031   </Target>
1032
1033
1034
1035
1036   <!--
1037     ***********************************************************************************************
1038     ***********************************************************************************************
1039                                                                 PrepareForBuild Section
1040     ***********************************************************************************************
1041     ***********************************************************************************************
1042     -->
1043
1044   <!--
1045     ============================================================
1046                                         PrepareForBuild
1047
1048     Prepare the prerequisites for building.
1049     ============================================================
1050     -->
1051   <PropertyGroup>
1052     <PrepareForBuildDependsOn>GetFrameworkPaths;GetReferenceAssemblyPaths;AssignLinkMetadata</PrepareForBuildDependsOn>
1053   </PropertyGroup>
1054   <Target
1055       Name="PrepareForBuild"
1056       DependsOnTargets="$(PrepareForBuildDependsOn)">
1057
1058     <ItemGroup>
1059       <AppConfigWithTargetPath Include="$(AppConfig)" Condition="'$(AppConfig)'!=''">
1060         <TargetPath>$(TargetFileName).config</TargetPath>
1061       </AppConfigWithTargetPath>
1062     </ItemGroup>
1063
1064     <FindAppConfigFile PrimaryList="@(None)" SecondaryList="@(Content)" TargetPath="$(TargetFileName).config" Condition="'$(AppConfig)'==''">
1065       <Output TaskParameter="AppConfigFile" ItemName="AppConfigWithTargetPath"/>
1066       <Output TaskParameter="AppConfigFile" PropertyName="AppConfig"/>
1067     </FindAppConfigFile>
1068
1069     <!-- Create the directories for intermediate and final build products, and any other arbitrary directories. -->
1070     <!-- We are going to continue on error here so that if the tree is read only we will still get intellisense -->
1071     <MakeDir Directories="$(OutDir);$(IntermediateOutputPath);@(DocFileItem->'%(RelativeDir)');@(CreateDirectory)" ContinueOnError="True"/>
1072
1073   </Target>
1074
1075   <!--
1076     ============================================================
1077                                         GetFrameworkPaths
1078
1079     Get the paths for the .NET Framework installation directory
1080
1081     These paths are not used directly by this .targets file but are available for pre and
1082     post build steps.
1083     ============================================================
1084     -->
1085   <PropertyGroup>
1086     <Framework40Dir>@(_TargetFramework40DirectoryItem)</Framework40Dir>
1087     <Framework35Dir>@(_TargetFramework35DirectoryItem)</Framework35Dir>
1088     <Framework30Dir>@(_TargetFramework30DirectoryItem)</Framework30Dir>
1089     <Framework20Dir>@(_TargetFramework20DirectoryItem)</Framework20Dir>
1090     <!-- Note we need to make the 4.0 FrameworkDir point to the 2.0 location by default since we shipped msbuild 4.0 that way and to change it would be a breaking change.-->
1091     <FrameworkDir Condition="'$(FrameworkDir)' == '' and ('$(TargetFrameworkVersion)' == 'v2.0' or '$(TargetFrameworkVersion)' == 'v3.5' or '$(TargetFrameworkVersion)' == 'v4.0')">@(_TargetFramework20DirectoryItem)</FrameworkDir>
1092     <FrameworkDir Condition="'$(FrameworkDir)' == ''">@(_TargetFramework40DirectoryItem)</FrameworkDir>
1093     <TargetedFrameworkDir Condition="'$(TargetedFrameworkDir)' == ''">@(_TargetedFrameworkDirectoryItem)</TargetedFrameworkDir>
1094     <FrameworkSDKDir Condition="'$(FrameworkSDKDir)' == ''">@(_TargetFrameworkSDKDirectoryItem)</FrameworkSDKDir>
1095     <GetFrameworkPathsDependsOn></GetFrameworkPathsDependsOn>
1096   </PropertyGroup>
1097
1098   <!-- This is a generally overriden target, for example it is overriden in the Microsoft.NETFramework.targets file -->
1099   <Target Name="GetFrameworkPaths"/>
1100
1101   <!--
1102     ============================================================
1103                                         GetReferenceAssemblyPaths
1104
1105     Get the paths for the Reference Assemblies for the known versions of the
1106     .NET Framework.
1107
1108     These paths are used by the build process in order to resolve the correct
1109     assemblies from the various directories, and to support multi-targeting
1110     ============================================================
1111     -->
1112   <Target
1113       Name="GetReferenceAssemblyPaths"
1114       DependsOnTargets="$(GetReferenceAssemblyPathsDependsOn)">
1115
1116     <!-- if TargetFrameworkDirectory doesn't have a custom value, clear it out; that way we can get reference paths and target framework directories all in the right order -->
1117     <PropertyGroup>
1118       <TargetFrameworkDirectory Condition="'@(_CombinedTargetFrameworkDirectoriesItem)' == '$(TargetFrameworkDirectory)'"/>
1119     </PropertyGroup>
1120
1121     <!-- By default if there is no root path set then the task will assume it is Program Files\Reference Assemblies\Microsoft\Framework-->
1122     <GetReferenceAssemblyPaths
1123         Condition="'$(TargetFrameworkMoniker)' != '' and ('$(_TargetFrameworkDirectories)' == '' or '$(_FullFrameworkReferenceAssemblyPaths)' == '')"
1124         TargetFrameworkMoniker="$(TargetFrameworkMoniker)"
1125         RootPath="$(TargetFrameworkRootPath)"
1126         BypassFrameworkInstallChecks="$(BypassFrameworkInstallChecks)"
1127         >
1128       <Output TaskParameter="ReferenceAssemblyPaths" PropertyName="_TargetFrameworkDirectories"/>
1129       <Output TaskParameter="FullFrameworkReferenceAssemblyPaths" PropertyName="_FullFrameworkReferenceAssemblyPaths"/>
1130       <Output TaskParameter="TargetFrameworkMonikerDisplayName" PropertyName="TargetFrameworkMonikerDisplayName" Condition="'$(TargetFrameworkMonikerDisplayName)' == ''"/>
1131     </GetReferenceAssemblyPaths>
1132
1133     <PropertyGroup>
1134       <TargetFrameworkDirectory>$(_TargetFrameworkDirectories);$(TargetFrameworkDirectory);$(WinFXAssemblyDirectory)</TargetFrameworkDirectory>
1135       <TargetFrameworkDirectory Condition="'$(TargetPlatformWinMDLocation)' != '' and Exists('$(TargetPlatformWinMDLocation)')">$(TargetFrameworkDirectory);$(TargetPlatformWinMDLocation)</TargetFrameworkDirectory>
1136     </PropertyGroup>
1137
1138     <!-- Remove the AssemblyFolders if no target framework directories could be found. This is to prevent us from
1139              resolving from the assemblyfolders global location if we are not acutally targeting a framework-->
1140
1141     <PropertyGroup>
1142       <RemoveAssemblyFoldersIfNoTargetFramework Condition="'$(RemoveAssemblyFoldersIfNoTargetFramework)' == ''">true</RemoveAssemblyFoldersIfNoTargetFramework>
1143     </PropertyGroup>
1144
1145     <PropertyGroup Condition="'$(_TargetFrameworkDirectories)' == '' and '$(AssemblySearchPaths)' != '' and '$(RemoveAssemblyFoldersIfNoTargetFramework)' == 'true'">
1146       <AssemblySearchPaths>$(AssemblySearchPaths.Replace('{AssemblyFolders}', '').Split(';'))</AssemblySearchPaths>
1147     </PropertyGroup>
1148
1149     <ItemGroup Condition="'$(ImplicitlyExpandDesignTimeFacades)' == 'true'">
1150       <DesignTimeFacadeDirectoryRoots Include="$(TargetFrameworkDirectory)" />
1151       <DesignTimeFacadeDirectories Include="%(DesignTimeFacadeDirectoryRoots.Identity)Facades\" Condition="Exists('%(DesignTimeFacadeDirectoryRoots.Identity)Facades\')" />
1152     </ItemGroup>
1153
1154     <PropertyGroup Condition="'@(DesignTimeFacadeDirectories)' != ''">
1155       <TargetFrameworkDirectory>$(TargetFrameworkDirectory);@(DesignTimeFacadeDirectories)</TargetFrameworkDirectory>
1156     </PropertyGroup>
1157
1158     <PropertyGroup Condition="'$(_TargetFrameworkDirectories)' == ''">
1159       <TargetFrameworkProfile/>
1160     </PropertyGroup>
1161   </Target>
1162
1163    <!-- Returns target framework moniker. E.g. ".NETFramework,Version=v4.0.1" -->
1164   <Target Name="GetTargetFrameworkMoniker"
1165           Returns="$(TargetFrameworkMoniker)"/>
1166
1167   <!-- Returns target framework moniker display name. E.g. ".NET Framework 4 Platform Update 1 (KB2478063)" -->
1168   <Target Name="GetTargetFrameworkMonikerDisplayName"
1169           DependsOnTargets="GetFrameworkPaths;GetReferenceAssemblyPaths"
1170           Returns="$(TargetFrameworkMonikerDisplayName)"/>
1171
1172   <!-- Returns semicolon separated list of target framework directories.
1173   E.g "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0.1\;C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\" -->
1174   <Target Name="GetTargetFrameworkDirectories"
1175           DependsOnTargets="GetFrameworkPaths;GetReferenceAssemblyPaths"
1176           Returns="$(TargetFrameworkDirectory)"/>
1177
1178   <!--
1179     ============================================================
1180                                         AssignLinkMetadata
1181
1182        For items of a certain set of whitelisted types, make sure that
1183        if they are defined in a file other than the project file, that
1184        they have "Link" metadata set to an appropriate default.
1185     ============================================================
1186     -->
1187   <Target Name="AssignLinkMetadata" Condition=" '$(SynthesizeLinkMetadata)' == 'true' ">
1188     <!-- NONE ITEMS -->
1189     <AssignLinkMetadata Items="@(None)"
1190                         Condition="'@(None)' != '' and '%(None.DefiningProjectFullPath)' != '$(MSBuildProjectFullPath)'">
1191       <Output TaskParameter="OutputItems" ItemName="_Temp" />
1192     </AssignLinkMetadata>
1193
1194     <ItemGroup>
1195       <None Remove="@(_Temp)" />
1196       <None Include="@(_Temp)" />
1197       <_Temp Remove="@(_Temp)" />
1198     </ItemGroup>
1199
1200     <!-- CONTENT ITEMS -->
1201     <AssignLinkMetadata Items="@(Content)"
1202                         Condition="'@(Content)' != '' and '%(Content.DefiningProjectFullPath)' != '$(MSBuildProjectFullPath)'">
1203       <Output TaskParameter="OutputItems" ItemName="_Temp" />
1204     </AssignLinkMetadata>
1205
1206     <ItemGroup>
1207       <Content Remove="@(_Temp)" />
1208       <Content Include="@(_Temp)" />
1209       <_Temp Remove="@(_Temp)" />
1210     </ItemGroup>
1211
1212
1213     <!-- PAGE ITEMS -->
1214     <AssignLinkMetadata Items="@(Page)"
1215                         Condition="'@(Page)' != '' and '%(Page.DefiningProjectFullPath)' != '$(MSBuildProjectFullPath)'">
1216       <Output TaskParameter="OutputItems" ItemName="_Temp" />
1217     </AssignLinkMetadata>
1218
1219     <ItemGroup>
1220       <Page Remove="@(_Temp)" />
1221       <Page Include="@(_Temp)" />
1222       <_Temp Remove="@(_Temp)" />
1223     </ItemGroup>
1224
1225
1226     <!-- APPLICATIONDEFINITION ITEMS -->
1227     <AssignLinkMetadata Items="@(ApplicationDefinition)"
1228                         Condition="'@(ApplicationDefinition)' != '' and '%(ApplicationDefinition.DefiningProjectFullPath)' != '$(MSBuildProjectFullPath)'">
1229       <Output TaskParameter="OutputItems" ItemName="_Temp" />
1230     </AssignLinkMetadata>
1231
1232     <ItemGroup>
1233       <ApplicationDefinition Remove="@(_Temp)" />
1234       <ApplicationDefinition Include="@(_Temp)" />
1235       <_Temp Remove="@(_Temp)" />
1236     </ItemGroup>
1237
1238     <!-- EMBEDDEDRESOURCE ITEMS -->
1239     <AssignLinkMetadata Items="@(EmbeddedResource)"
1240                         Condition="'@(EmbeddedResource)' != '' and '%(EmbeddedResource.DefiningProjectFullPath)' != '$(MSBuildProjectFullPath)'">
1241       <Output TaskParameter="OutputItems" ItemName="_Temp" />
1242     </AssignLinkMetadata>
1243
1244     <ItemGroup>
1245       <EmbeddedResource Remove="@(_Temp)" />
1246       <EmbeddedResource Include="@(_Temp)" />
1247       <_Temp Remove="@(_Temp)" />
1248     </ItemGroup>
1249   </Target>
1250
1251   <!--
1252     ***********************************************************************************************
1253     ***********************************************************************************************
1254                                                                 PreBuildEvent Section
1255     ***********************************************************************************************
1256     ***********************************************************************************************
1257     -->
1258
1259   <!--
1260     ============================================================
1261                                         PreBuildEvent
1262
1263     Run the pre-build event if there is one.
1264     ============================================================
1265     -->
1266   <PropertyGroup>
1267     <PreBuildEventDependsOn></PreBuildEventDependsOn>
1268   </PropertyGroup>
1269   <Target
1270       Name="PreBuildEvent"
1271       Condition="'$(PreBuildEvent)'!=''"
1272       DependsOnTargets="$(PreBuildEventDependsOn)">
1273
1274     <Exec WorkingDirectory="$(OutDir)" Command="$(PreBuildEvent)" />
1275
1276   </Target>
1277
1278
1279
1280
1281   <!--
1282     ***********************************************************************************************
1283     ***********************************************************************************************
1284                                                                 UnmanagedUnregistration Section
1285     ***********************************************************************************************
1286     ***********************************************************************************************
1287     -->
1288
1289   <!--
1290     ============================================================
1291                                         UnmanagedUnregistration
1292
1293     If the main assembly had previously been registered for COM interop, unregister it now.
1294     We will re-register the new version after it has been built.
1295     ============================================================
1296     -->
1297   <PropertyGroup>
1298     <UnmanagedUnregistrationDependsOn></UnmanagedUnregistrationDependsOn>
1299   </PropertyGroup>
1300   <Target
1301       Name="UnmanagedUnregistration"
1302       Condition="(('$(_AssemblyTimestampBeforeCompile)' != '$(_AssemblyTimestampAfterCompile)' or '$(RegisterForComInterop)' != 'true' or '$(OutputType)' != 'library') or
1303                     ('$(_AssemblyTimestampBeforeCompile)' == '')) and
1304                    Exists('@(_UnmanagedRegistrationCache)')"
1305       DependsOnTargets="$(UnmanagedUnregistrationDependsOn)">
1306
1307     <PropertyGroup>
1308       <UnregisterAssemblyMSBuildArchitecture Condition="'$(UnregisterAssemblyMSBuildArchitecture)' == ''">$(PlatformTargetAsMSBuildArchitecture)</UnregisterAssemblyMSBuildArchitecture>
1309     </PropertyGroup>
1310
1311     <PropertyGroup Condition="'$(TargetFrameworkAsMSBuildRuntime)' != '' and '$(UnregisterAssemblyMSBuildArchitecture)' != ''">
1312       <!-- Falling back to the current runtime if we are targeting CLR2 and the task host doesn't exist will lead to
1313            incorrect behavior in some cases, but it's the same incorrect behavior as Visual Studio 2010, and thus better
1314            than causing build breaks on upgrade to Win8 the way not doing so would.  For more details, see the
1315            corresponding comment in GenerateResource. -->
1316       <UnregisterAssemblyMSBuildRuntime
1317           Condition="'$(UnregisterAssemblyMSBuildRuntime)' == '' and
1318                      $([MSBuild]::DoesTaskHostExist(`$(TargetFrameworkAsMSBuildRuntime)`, `$(UnregisterAssemblyMSBuildArchitecture)`))">$(TargetFrameworkAsMSBuildRuntime)</UnregisterAssemblyMSBuildRuntime>
1319
1320       <!-- If the targeted runtime doesn't exist, fall back to current -->
1321       <UnregisterAssemblyMSBuildRuntime Condition="'$(UnregisterAssemblyMSBuildRuntime)' == ''">CurrentRuntime</UnregisterAssemblyMSBuildRuntime>
1322     </PropertyGroup>
1323
1324
1325     <UnregisterAssembly AssemblyListFile="@(_UnmanagedRegistrationCache)"
1326                         MSBuildArchitecture="$(UnregisterAssemblyMSBuildArchitecture)"
1327                         MSBuildRuntime="$(UnregisterAssemblyMSBuildRuntime)" />
1328
1329   </Target>
1330
1331
1332
1333
1334   <!--
1335     ***********************************************************************************************
1336     ***********************************************************************************************
1337                                                                 ResolveReferences Section
1338     ***********************************************************************************************
1339     ***********************************************************************************************
1340     -->
1341   <!--
1342     ============================================================
1343                      GetTargetFrameworkVersion
1344
1345     This stand-alone target returns the target framework version (i.e. v3.5, v4.0, etc.)
1346     that would be used if we built this project.
1347
1348     ============================================================
1349     -->
1350
1351   <Target
1352      Name="GetTargetFrameworkVersion"
1353      Returns="$(TargetFrameworkVersion)">
1354   </Target>
1355
1356   <!--
1357     ============================================================
1358                                         ResolveReferences
1359     ============================================================
1360     -->
1361   <PropertyGroup>
1362     <ResolveReferencesDependsOn>
1363       BeforeResolveReferences;
1364       AssignProjectConfiguration;
1365       ResolveProjectReferences;
1366       FindInvalidProjectReferences;
1367       ResolveNativeReferences;
1368       ResolveAssemblyReferences;
1369       GenerateBindingRedirects;
1370       ResolveComReferences;
1371       AfterResolveReferences
1372     </ResolveReferencesDependsOn>
1373   </PropertyGroup>
1374
1375   <Target
1376       Name="ResolveReferences"
1377       DependsOnTargets="$(ResolveReferencesDependsOn)"/>
1378
1379   <!--
1380     ============================================================
1381                                         BeforeResolveReferences
1382
1383     Redefine this target in your project in order to run tasks just before ResolveReferences
1384     ============================================================
1385     -->
1386   <Target Name="BeforeResolveReferences"/>
1387
1388   <!--
1389     ============================================================
1390                                         AfterResolveReferences
1391
1392     Redefine this target in your project in order to run tasks just after ResolveReferences
1393     ============================================================
1394     -->
1395   <Target Name="AfterResolveReferences"/>
1396
1397   <!--
1398     ============================================================
1399                                         AssignProjectConfiguration
1400
1401     Assigns the appropriate configuration to each project in the list of project references passed in.
1402     Adds to the project references passed in any project references implied by dependencies expressed in the solution file, if any.
1403
1404         [IN]
1405         @(ProjectReference) - the list of all project references
1406
1407         [OUT]
1408         @(ProjectReferenceWithConfiguration) - the list of project references (MSBuild and potentially VSIP projects)
1409                                                with metadata values FullConfiguration, Configuration, Platform,
1410                                                SetConfiguration, and SetPlatform
1411     ============================================================
1412     -->
1413   <Target
1414       Name="AssignProjectConfiguration"
1415       Condition="'$(CurrentSolutionConfigurationContents)' != '' or '@(ProjectReference)'!=''">
1416
1417     <PropertyGroup>
1418       <OnlyReferenceAndBuildProjectsEnabledInSolutionConfiguration Condition="'$(OnlyReferenceAndBuildProjectsEnabledInSolutionConfiguration)' == ''">true</OnlyReferenceAndBuildProjectsEnabledInSolutionConfiguration>
1419       <ShouldUnsetParentConfigurationAndPlatform Condition="'$(ShouldUnsetParentConfigurationAndPlatform)' == '' and ('$(BuildingInsideVisualStudio)' == 'true' or '$(BuildingSolutionFile)' == 'true')">true</ShouldUnsetParentConfigurationAndPlatform>
1420       <ShouldUnsetParentConfigurationAndPlatform Condition="'$(ShouldUnsetParentConfigurationAndPlatform)' == ''">false</ShouldUnsetParentConfigurationAndPlatform>
1421
1422       <!-- Web Application projects can "secretly" reference Silverlight projects, which can take project dependencies on that same Web Application.  If the project
1423            dependencies are promoted to project references, this ends up creating a situation where we have a circular reference between the two projects.  We don't
1424            want this to happen, so just turn off synthetic project reference generation for Silverlight projects. -->
1425       <AddSyntheticProjectReferencesForSolutionDependencies Condition="'$(AddSyntheticProjectReferencesForSolutionDependencies)' == '' and '$(TargetFrameworkIdentifier)' == 'Silverlight'">false</AddSyntheticProjectReferencesForSolutionDependencies>
1426
1427       <!-- Inside VS, we do not need to add synthetic references, as VS already organizes the build per any solution-level dependencies; we only do this on the command line-->
1428       <AddSyntheticProjectReferencesForSolutionDependencies Condition="'$(AddSyntheticProjectReferencesForSolutionDependencies)' == '' and '$(BuildingInsideVisualStudio)' != 'true'">true</AddSyntheticProjectReferencesForSolutionDependencies>
1429     </PropertyGroup>
1430
1431     <!-- Assign a project configuration to each project reference if we're building a solution file. -->
1432     <AssignProjectConfiguration
1433         ProjectReferences="@(ProjectReference)"
1434         CurrentProject="$(MSBuildProjectFullPath)"
1435         CurrentProjectConfiguration="$(Configuration)"
1436         CurrentProjectPlatform="$(Platform)"
1437         DefaultToVcxPlatformMapping="$(DefaultToVcxPlatformMapping)"
1438         VcxToDefaultPlatformMapping="$(VcxToDefaultPlatformMapping)"
1439         OutputType="$(OutputType)"
1440         ResolveConfigurationPlatformUsingMappings="false"
1441         SolutionConfigurationContents="$(CurrentSolutionConfigurationContents)"
1442         AddSyntheticProjectReferencesForSolutionDependencies="$(AddSyntheticProjectReferencesForSolutionDependencies)"
1443         OnlyReferenceAndBuildProjectsEnabledInSolutionConfiguration = "$(OnlyReferenceAndBuildProjectsEnabledInSolutionConfiguration)"
1444         ShouldUnsetParentConfigurationAndPlatform = "$(ShouldUnsetParentConfigurationAndPlatform)" >
1445
1446       <!-- EMITTED FOR COMPATIBILITY REASONS ONLY. CONSUME PROJECTREFERENCEWITHCONFIGURATION INSTEAD -->
1447       <Output TaskParameter="AssignedProjects" ItemName="_ProjectReferenceWithConfiguration"/>
1448       <Output TaskParameter="UnassignedProjects" ItemName="_ProjectReferenceWithConfiguration"/>
1449
1450       <Output TaskParameter="AssignedProjects" ItemName="ProjectReferenceWithConfiguration"/>
1451       <Output TaskParameter="UnassignedProjects" ItemName="ProjectReferenceWithConfiguration"/>
1452     </AssignProjectConfiguration>
1453
1454     <ItemGroup>
1455       <_ProjectReferenceWithConfiguration>
1456         <BuildReference Condition="'%(_ProjectReferenceWithConfiguration.BuildReference)' == ''">true</BuildReference>
1457         <ReferenceOutputAssembly Condition="'%(_ProjectReferenceWithConfiguration.ReferenceOutputAssembly)' == ''">true</ReferenceOutputAssembly>
1458       </_ProjectReferenceWithConfiguration>
1459       <ProjectReferenceWithConfiguration>
1460         <BuildReference Condition="'%(ProjectReferenceWithConfiguration.BuildReference)' == ''">true</BuildReference>
1461         <ReferenceOutputAssembly Condition="'%(ProjectReferenceWithConfiguration.ReferenceOutputAssembly)' == ''">true</ReferenceOutputAssembly>
1462       </ProjectReferenceWithConfiguration>
1463     </ItemGroup>
1464   </Target>
1465
1466   <!--
1467     ============================================================
1468                                         _SplitProjectReferencesByFileExistence
1469
1470     Split referenced projects into two lists: those that exist on
1471     disk and those that don't.
1472     ============================================================
1473     -->
1474
1475   <Target
1476     Name="_SplitProjectReferencesByFileExistence">
1477
1478     <!--
1479         Use this task for matching projects with pre-resolved project outputs set by the IDE
1480         if building inside the IDE.  The IDE only includes non-MSBuild projects in the output list.  We'll
1481         use MSBuild to resolve MSBuild projects.
1482         This task will resolve VSIP (3rd party) project references and create a new item list with only project references
1483         to projects in the MSBuild format.
1484         -->
1485     <ResolveNonMSBuildProjectOutput
1486         ProjectReferences="@(ProjectReferenceWithConfiguration)"
1487         PreresolvedProjectOutputs="$(VSIDEResolvedNonMSBuildProjectOutputs)"
1488         Condition="'$(BuildingInsideVisualStudio)'=='true' and '@(ProjectReferenceWithConfiguration)'!=''">
1489
1490       <Output TaskParameter="ResolvedOutputPaths" ItemName="_ResolvedProjectReferencePaths"/>
1491       <Output TaskParameter="UnresolvedProjectReferences" ItemName="_MSBuildProjectReference"/>
1492
1493     </ResolveNonMSBuildProjectOutput>
1494
1495     <!--
1496        If building from the command line, simply copy the ProjectReferenceWithConfiguration item list to _MSBuildProjectReference,
1497        since we have to assume all projects are in the MSBuild format. We have no way of building
1498        VSIP (3rd party) projects from the command line.
1499        -->
1500     <ItemGroup>
1501       <_MSBuildProjectReference Include="@(ProjectReferenceWithConfiguration)" Condition="'$(BuildingInsideVisualStudio)'!='true' and '@(ProjectReferenceWithConfiguration)'!=''"/>
1502     </ItemGroup>
1503
1504     <!-- Break the project list into two lists: those that exist on disk and those that don't. -->
1505     <ItemGroup>
1506       <_MSBuildProjectReferenceExistent Include="@(_MSBuildProjectReference)" Condition="Exists('%(Identity)')"/>
1507       <_MSBuildProjectReferenceNonexistent Include="@(_MSBuildProjectReference)" Condition="!Exists('%(Identity)')"/>
1508     </ItemGroup>
1509
1510   </Target>
1511
1512   <!--
1513     ====================================================================================
1514                                         _GetProjectReferenceTargetFrameworkProperties
1515
1516     Builds the GetTargetFrameworkProperties target of all existent project references,
1517     passing $(TargetFrameworkMoniker) as $(ReferringTargetFramework) and sets the
1518     SetTargetFramework metadata of the project reference to the value that is returned.
1519
1520     This allows a cross-targeting project to select how it should be configured to
1521     build against the most appropriate target for the referring target framework.
1522
1523     ======================================================================================
1524   -->
1525   <Target Name="_GetProjectReferenceTargetFrameworkProperties"
1526           Outputs="%(_MSBuildProjectReferenceExistent.Identity)">
1527     <!--
1528       Honor SkipGetTargetFrameworkProperties=true metadata on project references
1529       to mean that the project reference is known not to target multiple frameworks
1530       and the mechanism here for selecting the best one can be skipped as an optimization.
1531
1532       We give this treatment to .vcxproj by default since no .vcxproj can target more
1533       than one framework.
1534    -->
1535    <ItemGroup>
1536       <_MSBuildProjectReferenceExistent Condition="'%(_MSBuildProjectReferenceExistent.SkipGetTargetFrameworkProperties)' == '' and '%(Extension)' == '.vcxproj'">
1537         <SkipGetTargetFrameworkProperties>true</SkipGetTargetFrameworkProperties>
1538       </_MSBuildProjectReferenceExistent>
1539    </ItemGroup>
1540
1541     <!--
1542        Allow project references to specify which target framework properties to set and their values
1543        without consulting the referenced project. This has two use cases:
1544
1545        1. A caller may wish to pick a compatible but sub-optimal target framework. For example,
1546           to unit test the .NETStandard implementation using a .NETFramework caller even though
1547           there is also a .NETFramework implementation.
1548
1549        2. As an escape hatch for cases where the compatibility check performed by 
1550           GetTargetFrameworkProperties is faulty.
1551     -->
1552     <ItemGroup>
1553       <_MSBuildProjectReferenceExistent Condition="'%(_MSBuildProjectReferenceExistent.SetTargetFramework)' != ''">
1554         <SkipGetTargetFrameworkProperties>true</SkipGetTargetFrameworkProperties>
1555       </_MSBuildProjectReferenceExistent>
1556     </ItemGroup>
1557
1558     <!--
1559       Select the moniker to send to each project reference  if not already set. NugetTargetMoniker (NTM) is preferred by default over 
1560       TargetFrameworkMoniker (TFM) because it is required to disambiguate the UWP case where TFM is fixed at .NETCore,Version=v5.0 and 
1561       has floating NTM=UAP,Version=vX.Y.Z. However, in other cases (classic PCLs), NTM contains multiple values and that will cause the MSBuild
1562       invocation below to fail by passing invalid properties. Therefore we do not use the NTM if it contains a semicolon.
1563     -->
1564     <PropertyGroup Condition="'$(ReferringTargetFrameworkForProjectReferences)' == ''">
1565       <ReferringTargetFrameworkForProjectReferences Condition="'$(NugetTargetMoniker)' != '' and !$(NuGetTargetMoniker.Contains(';'))">$(NugetTargetMoniker)</ReferringTargetFrameworkForProjectReferences>
1566       <ReferringTargetFrameworkForProjectReferences Condition="'$(NugetTargetMoniker)' == ''">$(TargetFrameworkMoniker)</ReferringTargetFrameworkForProjectReferences>
1567     </PropertyGroup>
1568
1569     <MSBuild
1570         Projects="%(_MSBuildProjectReferenceExistent.Identity)"
1571         Targets="GetTargetFrameworkProperties"
1572         BuildInParallel="$(BuildInParallel)"
1573         Properties="%(_MSBuildProjectReferenceExistent.SetConfiguration); %(_MSBuildProjectReferenceExistent.SetPlatform); ReferringTargetFramework=$(ReferringTargetFrameworkForProjectReferences)"
1574         ContinueOnError="!$(BuildingProject)"
1575         RemoveProperties="%(_MSBuildProjectReferenceExistent.GlobalPropertiesToRemove);TargetFramework;RuntimeIdentifier"
1576         Condition="'%(_MSBuildProjectReferenceExistent.SkipGetTargetFrameworkProperties)' != 'true'">
1577
1578       <Output TaskParameter="TargetOutputs" PropertyName="_ProjectReferenceTargetFrameworkProperties" />
1579     </MSBuild>
1580
1581     <ItemGroup>
1582       <_MSBuildProjectReferenceExistent Condition="'%(_MSBuildProjectReferenceExistent.Identity)' == '%(Identity)' and '$(_ProjectReferenceTargetFrameworkProperties)' != ''">
1583         <SetTargetFramework>$(_ProjectReferenceTargetFrameworkProperties)</SetTargetFramework>
1584
1585         <UndefineProperties Condition="$(_ProjectReferenceTargetFrameworkProperties.Contains(`ProjectHasSingleTargetFramework=true`))">%(_MSBuildProjectReferenceExistent.UndefineProperties);TargetFramework;ProjectHasSingleTargetFramework</UndefineProperties>
1586         <!-- Unconditionally remove the property that was set as a marker to indicate that for this call we should remove TargetFramework -->
1587         <UndefineProperties Condition="!$(_ProjectReferenceTargetFrameworkProperties.Contains(`ProjectHasSingleTargetFramework=true`))">%(_MSBuildProjectReferenceExistent.UndefineProperties);ProjectHasSingleTargetFramework</UndefineProperties>
1588       </_MSBuildProjectReferenceExistent>
1589     </ItemGroup>
1590
1591     <ItemGroup>
1592       <_MSBuildProjectReferenceExistent Condition="'%(_MSBuildProjectReferenceExistent.Identity)' == '%(Identity)' and '$(_ProjectReferenceTargetFrameworkProperties)' != ''">
1593         <UndefineProperties Condition="$(_ProjectReferenceTargetFrameworkProperties.Contains(`ProjectIsRidAgnostic=true`))">%(_MSBuildProjectReferenceExistent.UndefineProperties);RuntimeIdentifier;ProjectIsRidAgnostic</UndefineProperties>
1594         <!-- Unconditionally remove the property that was set as a marker to indicate that for this call we should remove RuntimeIdentifier -->
1595         <UndefineProperties Condition="!$(_ProjectReferenceTargetFrameworkProperties.Contains(`ProjectIsRidAgnostic=true`))">%(_MSBuildProjectReferenceExistent.UndefineProperties);ProjectIsRidAgnostic</UndefineProperties>
1596       </_MSBuildProjectReferenceExistent>
1597     </ItemGroup>
1598
1599     <PropertyGroup>
1600       <_ProjectReferenceTargetFrameworkProperties />
1601     </PropertyGroup>
1602   </Target>
1603
1604   <!--
1605     ============================================================
1606                                     GetTargetFrameworkProperties
1607
1608     Overrridden by cross-targeting projects to return the set of
1609     properties (in the form "key1=value1;...keyN=valueN") needed
1610     to build it with the best target for the referring project's
1611     target framework.
1612
1613     The referring project's $(TargetFrameworkMoniker) is passed 
1614     in as $(ReferringTargetFramework)
1615   -->
1616   <Target Name="GetTargetFrameworkProperties" />
1617
1618   <!--
1619     ============================================================
1620                                         PrepareProjectReferences
1621
1622     Prepares project references for consumption by other targets.
1623
1624         [IN]
1625         @(ProjectReference) - The list of project references.
1626
1627         [OUT]
1628         @(ProjectReferenceWithConfiguration)   - Project references with apporpriate metadata
1629         @(_MSBuildProjectReferenceExistent)    - Subset of @(ProjectReferenceWithConfiguration) that exist 
1630                                                  with added SetTargetFramework metadata for cross-targeting
1631         @(_MSBuildProjectReferenceNonExistent) - Subset of  @(ProjectReferenceWithConfiguration) that do not exist
1632     ============================================================
1633   -->
1634   <PropertyGroup>
1635     <PrepareProjectReferencesDependsOn>
1636       AssignProjectConfiguration;
1637       _SplitProjectReferencesByFileExistence;
1638       _GetProjectReferenceTargetFrameworkProperties
1639     </PrepareProjectReferencesDependsOn>
1640   </PropertyGroup>
1641   <Target Name="PrepareProjectReferences" DependsOnTargets="$(PrepareProjectReferencesDependsOn)" />
1642
1643   <!--
1644     ============================================================
1645                                         ResolveProjectReferences
1646
1647     Build referenced projects:
1648
1649         [IN]
1650         @(ProjectReferenceWithConfiguration) - The list of project references.
1651
1652         [OUT]
1653         @(_ResolvedNativeProjectReferencePaths) - Paths to referenced native projects.
1654         @(_ResolvedProjectReferencePaths) - Paths to referenced managed projects.
1655     ============================================================
1656     -->
1657   <!-- By default, the outputs of project references are passed to the compiler -->
1658   <ItemDefinitionGroup>
1659     <ProjectReference>
1660       <!-- Target to build in the project reference; by default, this property is blank, indicating the default targets-->
1661       <Targets>$(ProjectReferenceBuildTargets)</Targets>
1662       <!-- Extra item type to emit outputs of the destination into. Defaults to blank. To emit only into this list, set the ReferenceOutputAssembly metadata to false as well. -->
1663       <OutputItemType/>
1664       <ReferenceSourceTarget>ProjectReference</ReferenceSourceTarget>
1665     </ProjectReference>
1666   </ItemDefinitionGroup>
1667
1668   <Target
1669       Name="ResolveProjectReferences"
1670       DependsOnTargets="PrepareProjectReferences"
1671       Returns="@(_ResolvedNativeProjectReferencePaths);@(_ResolvedProjectReferencePaths)">
1672
1673     <!--
1674         When building this project from the IDE, just gather the referenced build outputs.
1675         The IDE will already have built the project, so there's no need to do it again here.
1676
1677         The ContinueOnError setting is here so that, during project load, as
1678         much information as possible will be passed to the compilers.
1679         -->
1680
1681     <MSBuild
1682         Projects="@(_MSBuildProjectReferenceExistent)"
1683         Targets="GetTargetPath"
1684         BuildInParallel="$(BuildInParallel)"
1685         Properties="%(_MSBuildProjectReferenceExistent.SetConfiguration); %(_MSBuildProjectReferenceExistent.SetPlatform); %(_MSBuildProjectReferenceExistent.SetTargetFramework)"
1686         Condition="'%(_MSBuildProjectReferenceExistent.BuildReference)' == 'true' and '@(ProjectReferenceWithConfiguration)' != '' and ('$(BuildingInsideVisualStudio)' == 'true' or '$(BuildProjectReferences)' != 'true') and '$(VisualStudioVersion)' != '10.0' and '@(_MSBuildProjectReferenceExistent)' != ''"
1687         ContinueOnError="!$(BuildingProject)"
1688         RemoveProperties="%(_MSBuildProjectReferenceExistent.GlobalPropertiesToRemove)">
1689
1690       <Output TaskParameter="TargetOutputs" ItemName="_ResolvedProjectReferencePaths" Condition="'%(_MSBuildProjectReferenceExistent.ReferenceOutputAssembly)'=='true'"/>
1691       <Output TaskParameter="TargetOutputs" ItemName="%(_MSBuildProjectReferenceExistent.OutputItemType)" Condition="'%(_MSBuildProjectReferenceExistent.OutputItemType)' != ''"/>
1692
1693     </MSBuild>
1694
1695     <!--
1696         QUIRKING FOR DEV10
1697
1698         In the 4.0 version of the targets, we built the targets specified in the Targets metadata in addition to
1699         GetTargetPath when building in the IDE.  In 4.5, we changed this to just GetTargetPath because it was
1700         causing performance trouble with certain systems that specified targets that did a significant amount of
1701         work in the Targets metadata, expecting them to only build when doing a real build.
1702
1703         However, that change broke C++ unit testing in Dev10 + 4.5 scenarios, because they required use of the
1704         Targets metadata in order to get design time builds to work properly.  Thus, we need to make sure we
1705         restore the Dev10 behavior when building on Dev10.
1706         -->
1707
1708     <MSBuild
1709         Projects="@(_MSBuildProjectReferenceExistent)"
1710         Targets="%(_MSBuildProjectReferenceExistent.Targets);GetTargetPath"
1711         BuildInParallel="$(BuildInParallel)"
1712         Properties="%(_MSBuildProjectReferenceExistent.SetConfiguration); %(_MSBuildProjectReferenceExistent.SetPlatform); %(_MSBuildProjectReferenceExistent.SetTargetFramework)"
1713         Condition="'%(_MSBuildProjectReferenceExistent.BuildReference)' == 'true' and '@(ProjectReferenceWithConfiguration)' != '' and ('$(BuildingInsideVisualStudio)' == 'true' or '$(BuildProjectReferences)' != 'true') and '$(VisualStudioVersion)' == '10.0' and '@(_MSBuildProjectReferenceExistent)' != ''"
1714         ContinueOnError="!$(BuildingProject)"
1715         RemoveProperties="%(_MSBuildProjectReferenceExistent.GlobalPropertiesToRemove)">
1716
1717       <Output TaskParameter="TargetOutputs" ItemName="_ResolvedProjectReferencePaths" Condition="'%(_MSBuildProjectReferenceExistent.ReferenceOutputAssembly)'=='true'"/>
1718       <Output TaskParameter="TargetOutputs" ItemName="%(_MSBuildProjectReferenceExistent.OutputItemType)" Condition="'%(_MSBuildProjectReferenceExistent.OutputItemType)' != ''"/>
1719
1720     </MSBuild>
1721
1722     <!--
1723         Build referenced projects when building from the command line.
1724         -->
1725     <MSBuild
1726         Projects="@(_MSBuildProjectReferenceExistent)"
1727         Targets="%(_MSBuildProjectReferenceExistent.Targets)"
1728         BuildInParallel="$(BuildInParallel)"
1729         Properties="%(_MSBuildProjectReferenceExistent.SetConfiguration); %(_MSBuildProjectReferenceExistent.SetPlatform);  %(_MSBuildProjectReferenceExistent.SetTargetFramework)"
1730         Condition="'%(_MSBuildProjectReferenceExistent.BuildReference)' == 'true' and '@(ProjectReferenceWithConfiguration)' != '' and '$(BuildingInsideVisualStudio)' != 'true' and '$(BuildProjectReferences)' == 'true' and '@(_MSBuildProjectReferenceExistent)' != ''"
1731         ContinueOnError="$(ContinueOnError)"
1732         RemoveProperties="%(_MSBuildProjectReferenceExistent.GlobalPropertiesToRemove)">
1733
1734       <Output TaskParameter="TargetOutputs" ItemName="_ResolvedProjectReferencePaths" Condition="'%(_MSBuildProjectReferenceExistent.ReferenceOutputAssembly)'=='true' or '$(DesignTimeBuild)' == 'true'"/>
1735       <Output TaskParameter="TargetOutputs" ItemName="%(_MSBuildProjectReferenceExistent.OutputItemType)" Condition="'%(_MSBuildProjectReferenceExistent.OutputItemType)' != ''"/>
1736
1737     </MSBuild>
1738
1739     <!--
1740         Get manifest items from the (non-exe) built project references (to feed them into ResolveNativeReference).
1741         -->
1742     <MSBuild
1743         Projects="@(_MSBuildProjectReferenceExistent)"
1744         Targets="GetNativeManifest"
1745         BuildInParallel="$(BuildInParallel)"
1746         Properties="%(_MSBuildProjectReferenceExistent.SetConfiguration); %(_MSBuildProjectReferenceExistent.SetPlatform); %(_MSBuildProjectReferenceExistent.SetTargetFramework)"
1747         Condition="'%(_MSBuildProjectReferenceExistent.BuildReference)' == 'true' and '@(ProjectReferenceWithConfiguration)' != '' and '$(BuildingProject)' == 'true' and '@(_MSBuildProjectReferenceExistent)' != ''"
1748         ContinueOnError="$(ContinueOnError)"
1749         RemoveProperties="%(_MSBuildProjectReferenceExistent.GlobalPropertiesToRemove)">
1750
1751       <Output TaskParameter="TargetOutputs" ItemName="NativeReference" Condition="'%(_MSBuildProjectReferenceExistent.ReferenceOutputAssembly)' == 'true'"/>
1752     </MSBuild>
1753
1754     <ItemGroup>
1755       <_ResolvedProjectReferencePaths Remove="@(_ResolvedProjectReferencePaths)" Condition="'%(_ResolvedProjectReferencePaths.ResolveableAssembly)' == 'false'" />
1756       <!--
1757           Copy OriginalItemSpec to OriginalProjectReferenceItemSpec, so that when ResolveAssemblyReferences
1758           takes these items and resolves them to ReferencePath, we can still recover the _real_ OriginalItemSpec
1759           for the unresolved reference items.
1760           -->
1761       <_ResolvedProjectReferencePaths>
1762         <OriginalProjectReferenceItemSpec>%(_ResolvedProjectReferencePaths.OriginalItemSpec)</OriginalProjectReferenceItemSpec>
1763       </_ResolvedProjectReferencePaths>
1764     </ItemGroup>
1765
1766     <!-- Issue a warning for each non-existent project. -->
1767     <Warning
1768         Text="The referenced project '%(_MSBuildProjectReferenceNonexistent.Identity)' does not exist."
1769         Condition="'@(ProjectReferenceWithConfiguration)' != '' and '@(_MSBuildProjectReferenceNonexistent)' != ''"/>
1770
1771   </Target>
1772
1773   <Target
1774     Name="ResolveProjectReferencesDesignTime"
1775     Returns="@(_ProjectReferencesFromRAR);@(_ResolvedNativeProjectReferencePaths)"
1776     DependsOnTargets="ResolveProjectReferences;ResolveAssemblyReferences">
1777     <!-- We need to do this here because we only want project references which have passed through rar and have not been unresolved due to violating some MT rule
1778         which means we need to pull the project references out of the referencepath item because they will only exist there if they were correctly resolved.
1779     -->
1780     <ItemGroup>
1781       <_ProjectReferencesFromRAR Include="@(ReferencePath->WithMetadataValue('ReferenceSourceTarget', 'ProjectReference'))">
1782         <OriginalItemSpec>%(ReferencePath.ProjectReferenceOriginalItemSpec)</OriginalItemSpec>
1783       </_ProjectReferencesFromRAR>
1784     </ItemGroup>
1785   </Target>
1786
1787   <Target
1788    Name="ExpandSDKReferencesDesignTime"
1789    Returns="@(ReferencesFromSDK)"
1790    DependsOnTargets="ExpandSDKReferences"/>
1791
1792   <!--
1793     ============================================================
1794                                         GetTargetPath
1795
1796     This target returns an item containing the build product (i.e. EXE, DLL)
1797     that would be produced if we built this project, with some relevant
1798     metadata.
1799     ============================================================
1800     -->
1801   <PropertyGroup>
1802     <GetTargetPathDependsOn>$(GetTargetPathDependsOn)</GetTargetPathDependsOn>
1803   </PropertyGroup>
1804
1805   <Target
1806       Name="GetTargetPath"
1807       DependsOnTargets="$(GetTargetPathDependsOn)"
1808       Returns="@(TargetPathWithTargetPlatformMoniker)" />
1809
1810   <!--
1811     ============================================================
1812                                         GetTargetPathWithTargetPlatformMoniker
1813
1814     This stand-alone target returns the name and version of the target platform for this project.
1815
1816     NOTE: The ProjectReference protocol uses only GetTargetPath. Computing the item
1817     in this target allows projects to override GetTargetPath without having to reimplement
1818     the details of the metadata computation.
1819     ============================================================
1820     -->
1821   <PropertyGroup>
1822     <GetTargetPathWithTargetPlatformMonikerDependsOn>$(GetTargetPathDependsOn)</GetTargetPathWithTargetPlatformMonikerDependsOn>
1823   </PropertyGroup>
1824
1825   <!--NOTE: since an overridden GetTargetPath might not include a DependsOn
1826       for this target, it's safer to establish the dependency here with a
1827       BeforeTargets. -->
1828   <Target
1829       Name="GetTargetPathWithTargetPlatformMoniker"
1830       BeforeTargets="GetTargetPath"
1831       DependsOnTargets="$(GetTargetPathWithTargetPlatformMonikerDependsOn)"
1832       Returns="@(TargetPathWithTargetPlatformMoniker)">
1833     <ItemGroup>
1834       <TargetPathWithTargetPlatformMoniker Include="$(TargetPath)">
1835         <TargetPlatformMoniker>$(TargetPlatformMoniker)</TargetPlatformMoniker>
1836         <TargetPlatformIdentifier>$(TargetPlatformIdentifier)</TargetPlatformIdentifier>
1837         <TargetFrameworkIdentifier>$(TargetFrameworkIdentifier)</TargetFrameworkIdentifier>
1838         <TargetFrameworkVersion>$(TargetFrameworkVersion)</TargetFrameworkVersion>
1839         <TargetFrameworkVersion Condition="$(TargetFrameworkVersion.StartsWith('v'))">$(TargetFrameworkVersion.Substring(1))</TargetFrameworkVersion>
1840         <ReferenceAssembly Condition="'$(ProduceReferenceAssembly)' == 'true'">$(TargetRefPath)</ReferenceAssembly>
1841         <CopyUpToDateMarker>@(CopyUpToDateMarker)</CopyUpToDateMarker>
1842       </TargetPathWithTargetPlatformMoniker>
1843     </ItemGroup>
1844   </Target>
1845
1846   <!--
1847     ============================================================
1848                                         GetNativeManifest
1849
1850     Compute the manifest item for this project.
1851
1852         [IN]
1853         $(_DeploymentApplicationManifestIdentity) - the manifest identity
1854         @(ApplicationManifest)         - the original application manifest item
1855
1856         [OUT]
1857         @(ComputedApplicationManifest) - application manifest item with full hint path, if generated
1858     ============================================================
1859     -->
1860   <Target
1861       Name="GetNativeManifest"
1862       Returns="@(ComputedApplicationManifest)">
1863
1864     <ItemGroup>
1865       <ComputedApplicationManifest Include="$(_DeploymentApplicationManifestIdentity)" Condition="'$(OutputType)'!='winexe' and '$(OutputType)'!='exe' and '$(OutputType)'!='appcontainerexe' and Exists('%(_ApplicationManifestFinal.FullPath)')">
1866         <HintPath>%(_ApplicationManifestFinal.FullPath)</HintPath>
1867       </ComputedApplicationManifest>
1868     </ItemGroup>
1869
1870   </Target>
1871
1872   <!--
1873     ============================================================
1874                                         ResolveNativeReferences
1875
1876     Resolve native references
1877
1878         [IN]
1879         @(NativeReference) - The manifest reference (or list of manifest references)
1880
1881         [OUT]
1882         @(NativeReferenceFile)  - List of manifest files referenced.
1883         @(_DeploymentNativePrerequisite)   - List of native assembly prerequisites contained in the manifest.
1884         @(ComClassReference)    - List of COM components contained in the manifest.
1885         @(COMReferenceFromNative) List of type libraries contained in the manifest.
1886         @(COMFileReference)     - List of loose files contained in the manifest.
1887         @(_DeploymentLooseManifestFile)    - List of extra files that should be published.
1888     ============================================================
1889     -->
1890   <Target
1891       Name="ResolveNativeReferences"
1892       Condition="'@(NativeReference)'!=''"
1893       DependsOnTargets="ResolveProjectReferences">
1894
1895     <ResolveNativeReference
1896         NativeReferences="@(NativeReference)"
1897         AdditionalSearchPaths="$(ReferencePath);$(OutDir)"
1898             >
1899       <Output TaskParameter="ContainingReferenceFiles" ItemName="NativeReferenceFile"/>
1900       <Output TaskParameter="ContainedPrerequisiteAssemblies" ItemName="_DeploymentNativePrerequisite"/>
1901       <Output TaskParameter="ContainedComComponents" ItemName="ComClassReference"/>
1902       <Output TaskParameter="ContainedTypeLibraries" ItemName="COMReferenceFromNative"/>
1903       <Output TaskParameter="ContainedLooseTlbFiles" ItemName="COMFileReference"/>
1904       <Output TaskParameter="ContainedLooseEtcFiles" ItemName="_DeploymentLooseManifestFile"/>
1905     </ResolveNativeReference>
1906
1907   </Target>
1908
1909   <!--
1910     ============================================================
1911
1912                                         ResolveAssemblyReferences
1913
1914     Given the list of assemblies, find the closure of all assemblies that they depend on. These are
1915     what we need to copy to the output directory.
1916
1917         [IN]
1918         @(Reference) - List of assembly references as fusion names.
1919         @(_ResolvedProjectReferencePaths) - List of project references produced by projects that this project depends on.
1920
1921             The 'Private' attribute on the reference corresponds to the Copy Local flag in IDE.
1922             The 'Private' flag can have three possible values:
1923                 - 'True' means the reference should be Copied Local
1924                 - 'False' means the reference should not be Copied Local
1925                 - [Missing] means this task will decide whether to treat this reference as CopyLocal or not.
1926
1927         [OUT]
1928         @(ReferencePath) - Paths to resolved primary files.
1929         @(ReferenceDependencyPaths) - Paths to resolved dependency files.
1930         @(_ReferenceRelatedPaths) - Paths to .xmls and .pdbs.
1931         @(ReferenceSatellitePaths) - Paths to satellites.
1932         @(_ReferenceSerializationAssemblyPaths) - Paths to XML serialization assemblies created by sgen.
1933         @(_ReferenceScatterPaths) - Paths to scatter files.
1934         @(ReferenceCopyLocalPaths) - Paths to files that should be copied to the local directory.
1935     ============================================================
1936     -->
1937   <PropertyGroup>
1938     <ResolveAssemblyReferencesDependsOn>
1939       GetFrameworkPaths;
1940       GetReferenceAssemblyPaths;
1941       PrepareForBuild;
1942       ResolveSDKReferences;
1943       ExpandSDKReferences;
1944     </ResolveAssemblyReferencesDependsOn>
1945   </PropertyGroup>
1946   <Target
1947       Name="ResolveAssemblyReferences"
1948       Returns="@(ReferencePath)"
1949       DependsOnTargets="$(ResolveAssemblyReferencesDependsOn)">
1950
1951     <ItemGroup>
1952       <_ReferenceInstalledAssemblyDirectory Include="$(TargetFrameworkDirectory)" />
1953       <_ReferenceInstalledAssemblySubsets Include="$(TargetFrameworkSubset)" />
1954     </ItemGroup>
1955
1956     <!--
1957         Only read and write cache file at build time, skip it for load time because its more
1958         expensive to write the newly created cache file.
1959         -->
1960     <PropertyGroup>
1961       <ResolveAssemblyReferencesStateFile Condition="'$(BuildingProject)'=='true'">$(IntermediateOutputPath)$(MSBuildProjectFile)ResolveAssemblyReference.cache</ResolveAssemblyReferencesStateFile>
1962     </PropertyGroup>
1963
1964     <!-- Make an App.Config item that exists when AutoUnify is false. -->
1965     <ItemGroup>
1966       <_ResolveAssemblyReferencesApplicationConfigFileForExes Include="@(AppConfigWithTargetPath)" Condition="'$(AutoGenerateBindingRedirects)'=='true' or '$(AutoUnifyAssemblyReferences)'=='false'"/>
1967     </ItemGroup>
1968
1969     <PropertyGroup>
1970       <!-- Default in task is true -->
1971       <_FindDependencies Condition="'$(BuildingProject)' != 'true' and '$(_ResolveReferenceDependencies)' != 'true'">false</_FindDependencies>
1972       <ResolveAssemblyReferencesSilent Condition="'$(ResolveAssemblyReferencesSilent)' == '' and '$(TraceDesignTime)' != 'true' and '$(BuildingProject)' == 'false'">true</ResolveAssemblyReferencesSilent>
1973       <ResolveAssemblyReferencesSilent Condition="'$(ResolveAssemblyReferencesSilent)' == ''">false</ResolveAssemblyReferencesSilent>
1974       <ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch Condition="'$(ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch)' == ''">Warning</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
1975     </PropertyGroup>
1976
1977     <ItemGroup>
1978       <!-- Remove any references which we have added as explicit reference so that we do not get duplicates. We need to make sure we do not have duplicates
1979              because this confuses the IDE  when it tries to compare the list of references passed in to the list of resolved references. If it does not match then the
1980              ide will show one of the references as not resolved, this will not break the build but is a display issue -->
1981       <Reference Remove="$(AdditionalExplicitAssemblyReferences)"/>
1982       <Reference Include="$(AdditionalExplicitAssemblyReferences)">
1983         <Implicit>true</Implicit>
1984       </Reference>
1985     </ItemGroup>
1986
1987     <ResolveAssemblyReference
1988         Assemblies="@(Reference)"
1989         AssemblyFiles="@(_ResolvedProjectReferencePaths);@(_ExplicitReference)"
1990         TargetFrameworkDirectories="@(_ReferenceInstalledAssemblyDirectory)"
1991         InstalledAssemblyTables="@(InstalledAssemblyTables);@(RedistList)"
1992         IgnoreDefaultInstalledAssemblyTables="$(IgnoreDefaultInstalledAssemblyTables)"
1993         IgnoreDefaultInstalledAssemblySubsetTables="$(IgnoreInstalledAssemblySubsetTables)"
1994         CandidateAssemblyFiles="@(Content);@(None)"
1995         SearchPaths="$(AssemblySearchPaths)"
1996         AllowedAssemblyExtensions="$(AllowedReferenceAssemblyFileExtensions)"
1997         AllowedRelatedFileExtensions="$(AllowedReferenceRelatedFileExtensions)"
1998         TargetProcessorArchitecture="$(ProcessorArchitecture)"
1999         AppConfigFile="@(_ResolveAssemblyReferencesApplicationConfigFileForExes)"
2000         AutoUnify="$(AutoUnifyAssemblyReferences)"
2001         SupportsBindingRedirectGeneration="$(GenerateBindingRedirectsOutputType)"
2002         IgnoreVersionForFrameworkReferences="$(IgnoreVersionForFrameworkReferences)"
2003         FindDependencies="$(_FindDependencies)"
2004         FindSatellites="$(BuildingProject)"
2005         FindSerializationAssemblies="$(BuildingProject)"
2006         FindRelatedFiles="$(BuildingProject)"
2007         Silent="$(ResolveAssemblyReferencesSilent)"
2008         TargetFrameworkVersion="$(TargetFrameworkVersion)"
2009         TargetFrameworkMoniker="$(TargetFrameworkMoniker)"
2010         TargetFrameworkMonikerDisplayName="$(TargetFrameworkMonikerDisplayName)"
2011         TargetedRuntimeVersion="$(TargetedRuntimeVersion)"
2012         StateFile="$(ResolveAssemblyReferencesStateFile)"
2013         InstalledAssemblySubsetTables="@(InstalledAssemblySubsetTables)"
2014         TargetFrameworkSubsets="@(_ReferenceInstalledAssemblySubsets)"
2015         FullTargetFrameworkSubsetNames="$(FullReferenceAssemblyNames)"
2016         FullFrameworkFolders="$(_FullFrameworkReferenceAssemblyPaths)"
2017         FullFrameworkAssemblyTables="@(FullFrameworkAssemblyTables)"
2018         ProfileName="$(TargetFrameworkProfile)"
2019         LatestTargetFrameworkDirectories="@(LatestTargetFrameworkDirectories)"
2020         CopyLocalDependenciesWhenParentReferenceInGac="$(CopyLocalDependenciesWhenParentReferenceInGac)"
2021         DoNotCopyLocalIfInGac="$(DoNotCopyLocalIfInGac)"
2022         ResolvedSDKReferences="@(ResolvedSDKReference)"
2023         WarnOrErrorOnTargetArchitectureMismatch="$(ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch)"
2024         IgnoreTargetFrameworkAttributeVersionMismatch ="$(ResolveAssemblyReferenceIgnoreTargetFrameworkAttributeVersionMismatch)"
2025         ContinueOnError="$(ContinueOnError)"
2026         Condition="'@(Reference)'!='' or '@(_ResolvedProjectReferencePaths)'!='' or '@(_ExplicitReference)' != ''"
2027         >
2028
2029       <Output TaskParameter="ResolvedFiles" ItemName="ReferencePath"/>
2030       <Output TaskParameter="ResolvedFiles" ItemName="_ResolveAssemblyReferenceResolvedFiles"/>
2031       <Output TaskParameter="ResolvedDependencyFiles" ItemName="ReferenceDependencyPaths"/>
2032       <Output TaskParameter="RelatedFiles" ItemName="_ReferenceRelatedPaths"/>
2033       <Output TaskParameter="SatelliteFiles" ItemName="ReferenceSatellitePaths"/>
2034       <Output TaskParameter="SerializationAssemblyFiles" ItemName="_ReferenceSerializationAssemblyPaths"/>
2035       <Output TaskParameter="ScatterFiles" ItemName="_ReferenceScatterPaths"/>
2036       <Output TaskParameter="CopyLocalFiles" ItemName="ReferenceCopyLocalPaths"/>
2037       <Output TaskParameter="SuggestedRedirects" ItemName="SuggestedBindingRedirects"/>
2038       <Output TaskParameter="FilesWritten" ItemName="FileWrites"/>
2039       <Output TaskParameter="DependsOnSystemRuntime" PropertyName="DependsOnSystemRuntime"/>
2040     </ResolveAssemblyReference>
2041   </Target>
2042
2043   <!--
2044     ============================================================
2045
2046                                         FindReferenceAssembliesForReferences
2047
2048     Given the list of references, create a list of assemblies to pass to the compiler that
2049     includes reference assemblies rather than implementation assemblies where possible.
2050
2051         [IN]
2052         @(ReferencePath) - List of assembly references as resolved paths with ReferenceAssembly metadata
2053
2054         [OUT]
2055         @(ReferencePathWithRefAssemblies) - Paths to resolved reference (or implementation) assemblies.
2056     ============================================================
2057     -->
2058   <Target Name="FindReferenceAssembliesForReferences"
2059           DependsOnTargets="ResolveReferences">
2060     <ItemGroup>
2061       <!-- Reference assemblies are not produced in all cases, but it's easier to consume them
2062            if this metadatum is always populated. Ensure that it points to the implementation
2063            assembly unless already specified. -->
2064       <ReferencePath Condition="'%(ReferencePath.ReferenceAssembly)' == ''">
2065         <ReferenceAssembly>%(FullPath)</ReferenceAssembly>
2066       </ReferencePath>
2067
2068       <ReferencePathWithRefAssemblies Include="@(ReferencePath->'%(ReferenceAssembly)')"
2069                                       Condition="'$(CompileUsingReferenceAssemblies)' != 'false'">
2070         <OriginalPath Condition="'%(ReferencePath.Identity)' != '@(ReferencePath->'%(ReferenceAssembly)')'">%(ReferencePath.Identity)</OriginalPath>
2071       </ReferencePathWithRefAssemblies>
2072       <ReferencePathWithRefAssemblies Include="@(ReferencePath)"
2073                                       Condition="'$(CompileUsingReferenceAssemblies)' == 'false'" />
2074     </ItemGroup>
2075   </Target>
2076
2077   <!--
2078     ====================================================================================================
2079
2080                                         GenerateBindingRedirects
2081     Inject the binding redirects into the app config file based on suggested redirects as output from
2082     ResolveAssemblyReferences.
2083
2084         [IN]
2085         @(AppConfigWithTargetPath) - Path to the source app config file. This can be null if the project
2086                                      doesn't contain an app config file.
2087         $(TargetFileName) -          The file name of the build target.
2088
2089         [OUT]
2090         @(OutputAppConfigFile) -     Path to the output app config file in the intermediate directory.
2091
2092     ====================================================================================================
2093   -->
2094   <Target Name="GenerateBindingRedirects"
2095     Inputs="$(MSBuildAllProjects);@(AppConfigFile);$(ResolveAssemblyReferencesStateFile);$(IntermediateOutputPath);@(SuggestedBindingRedirects)"
2096     Outputs="$(_GenerateBindingRedirectsIntermediateAppConfig)"
2097     Condition="'$(AutoGenerateBindingRedirects)' == 'true' and '$(GenerateBindingRedirectsOutputType)' == 'true'">
2098
2099     <GenerateBindingRedirects
2100       AppConfigFile="@(AppConfigWithTargetPath)"
2101       TargetName="$(TargetFileName).config"
2102       OutputAppConfigFile="$(_GenerateBindingRedirectsIntermediateAppConfig)"
2103       SuggestedRedirects="@(SuggestedBindingRedirects)"
2104       >
2105
2106       <Output TaskParameter="OutputAppConfigFile" ItemName="FileWrites" />
2107
2108     </GenerateBindingRedirects>
2109
2110   </Target>
2111
2112   <!--
2113     ====================================================================================================
2114
2115                                         GenerateBindingRedirectsUpdateAppConfig
2116     Updates the project to use the generated app.config content.  This needs to run regardless of
2117     inputs/outputs so it is seperate from GenerateBindingRedirects.
2118     ====================================================================================================
2119   -->
2120   <Target Name="GenerateBindingRedirectsUpdateAppConfig"
2121     AfterTargets="GenerateBindingRedirects"
2122     Condition="'$(AutoGenerateBindingRedirects)' == 'true' and '$(GenerateBindingRedirectsOutputType)' == 'true' and Exists('$(_GenerateBindingRedirectsIntermediateAppConfig)')">
2123
2124     <PropertyGroup>
2125       <AppConfig>$(_GenerateBindingRedirectsIntermediateAppConfig)</AppConfig>
2126     </PropertyGroup>
2127     <ItemGroup>
2128       <AppConfigWithTargetPath Remove="@(AppConfigWithTargetPath)" />
2129       <AppConfigWithTargetPath Include="$(AppConfig)">
2130         <TargetPath>$(TargetFileName).config</TargetPath>
2131       </AppConfigWithTargetPath>
2132     </ItemGroup>
2133
2134   </Target>
2135
2136   <!--
2137     ===========================================================================================
2138                                         GetInstalledSDKs
2139
2140     Gets the list of SDKs installed in the SDKDirectoryRoot and SDKRegistryRoot locations
2141
2142     These paths are used by the ResolveSDKReference task and the ResolveAssemblyReference task.
2143     ===========================================================================================
2144   -->
2145   <PropertyGroup>
2146     <SDKReferenceRegistryRoot Condition="'$(SDKReferenceRegistryRoot)' == ''">Software\Microsoft\Microsoft SDKs</SDKReferenceRegistryRoot>
2147     <SDKReferenceDirectoryRoot Condition="'$(SDKReferenceDirectoryRoot)' == ''">$(LocalAppData)\Microsoft SDKs;$(MSBuildProgramFiles32)\Microsoft SDKs</SDKReferenceDirectoryRoot>
2148     <!-- Manifest driven extension SDK locations -->
2149     <SDKExtensionDirectoryRoot Condition="'$(SDKExtensionDirectoryRoot)' == '' and '$(SDKIdentifier)' != ''">$(MSBuildProgramFiles32)\Microsoft SDKs\Windows Kits\10;$(MSBuildProgramFiles32)\Windows Kits\10</SDKExtensionDirectoryRoot>
2150
2151     <!-- UAP projects by default should support Windows 8.1 SDKs -->
2152     <SupportWindows81SDKs Condition="'$(SupportWindows81SDKs)' == '' and '$(Support81SDKs)' != 'false' and '$(TargetPlatformIdentifier)' == 'UAP'">true</SupportWindows81SDKs>
2153     <TargetPlatformIdentifierWindows81 Condition="'$(TargetPlatformIdentifierWindows81)' == '' and '$(SupportWindows81SDKs)' == 'true'">Windows</TargetPlatformIdentifierWindows81>
2154     <TargetPlatformVersionWindows81 Condition="'$(TargetPlatformVersionWindows81)' == '' and '$(SupportWindows81SDKs)' == 'true'">8.1</TargetPlatformVersionWindows81>
2155
2156     <!-- Desktop and phone SDKs often have the exact same identifiers, don't enable phone by default -->
2157     <SupportWindowsPhone81SDKs Condition="'$(SupportWindowsPhone81SDKs)' == '' and '$(Support81SDKs)' != 'false' and '$(TargetPlatformIdentifier)' == 'UAP'">false</SupportWindowsPhone81SDKs>
2158     <TargetPlatformIdentifierWindowsPhone81 Condition="'$(TargetPlatformIdentifierWindowsPhone81)' == '' and '$(SupportWindowsPhone81SDKs)' == 'true'">WindowsPhoneApp</TargetPlatformIdentifierWindowsPhone81>
2159     <TargetPlatformVersionWindowsPhone81 Condition="'$(TargetPlatformVersionWindowsPhone81)' == '' and '$(SupportWindowsPhone81SDKs)' == 'true'">8.1</TargetPlatformVersionWindowsPhone81>
2160   </PropertyGroup>
2161
2162   <Target
2163       Name="GetInstalledSDKLocations"
2164       DependsOnTargets="$(GetInstalledSDKLocationsDependsOn)"
2165       Returns="@(InstalledSDKLocations)"
2166       >
2167
2168     <GetInstalledSDKLocations
2169            SDKDirectoryRoots="$(SDKReferenceDirectoryRoot)"
2170            SDKExtensionDirectoryRoots="$(SDKExtensionDirectoryRoot)"
2171            SDKRegistryRoot="$(SDKReferenceRegistryRoot)"
2172            TargetPlatformVersion="$(TargetPlatformVersion)"
2173            TargetPlatformIdentifier="$(TargetPlatformIdentifier)"
2174            Condition="'@(SDKReference)' != ''"
2175            >
2176       <Output TaskParameter="InstalledSDKs" ItemName="InstalledSDKLocations"/>
2177     </GetInstalledSDKLocations>
2178
2179     <!-- Also lookup 8.1 SDKs if requested -->
2180     <GetInstalledSDKLocations
2181            SDKDirectoryRoots="$(SDKReferenceDirectoryRoot)"
2182            SDKExtensionDirectoryRoots=""
2183            SDKRegistryRoot="$(SDKReferenceRegistryRoot)"
2184            TargetPlatformVersion="$(TargetPlatformVersionWindows81)"
2185            TargetPlatformIdentifier="$(TargetPlatformIdentifierWindows81)"
2186            Condition="'@(SDKReference)' != '' and '$(SupportWindows81SDKs)' == 'true' and '$(TargetPlatformIdentifierWindows81)' != '' and '$(TargetPlatformVersionWindows81)' != ''"
2187            WarnWhenNoSDKsFound="false"
2188            >
2189       <Output TaskParameter="InstalledSDKs" ItemName="InstalledSDKLocations"/>
2190     </GetInstalledSDKLocations>
2191
2192     <GetInstalledSDKLocations
2193            SDKDirectoryRoots="$(SDKReferenceDirectoryRoot)"
2194            SDKExtensionDirectoryRoots=""
2195            SDKRegistryRoot="$(SDKReferenceRegistryRoot)"
2196            TargetPlatformVersion="$(TargetPlatformVersionWindowsPhone81)"
2197            TargetPlatformIdentifier="$(TargetPlatformIdentifierWindowsPhone81)"
2198            Condition="'@(SDKReference)' != '' and '$(SupportWindowsPhone81SDKs)' == 'true' and '$(TargetPlatformIdentifierWindowsPhone81)' != '' and '$(TargetPlatformVersionWindowsPhone81)' != ''"
2199            WarnWhenNoSDKsFound="false"
2200            >
2201       <Output TaskParameter="InstalledSDKs" ItemName="InstalledSDKLocations"/>
2202     </GetInstalledSDKLocations>
2203
2204   </Target>
2205
2206   <!--
2207     ============================================================
2208
2209                                         ResolveSDKReferences
2210
2211     Given a list of SDKReference items and a list of resolved winmd files which may contain metadata as to which sdk they came from
2212     we need to find the sdk root folders on disk and populate a ResolvedSDKReference item which has the full path to the SDK ROOT
2213     and the sdk identity as a piece of metadata.
2214
2215         [IN]
2216         @(SDKReference) - List of sdk references (the identity in the sdk manifest file).
2217         @(ReferencePath) -List of resolved assemblies, we are interested in the ones which have IsWinMDFile set to true.
2218
2219         [OUT]
2220         @(ResolvedSDKReference) - Full path to the root of the SDK
2221     ============================================================
2222   -->
2223   <PropertyGroup>
2224     <ResolveSDKReferencesDependsOn>
2225       GetInstalledSDKLocations
2226     </ResolveSDKReferencesDependsOn>
2227   </PropertyGroup>
2228
2229   <PropertyGroup>
2230     <TargetedSDKConfiguration Condition="'$(TargetedSDKConfiguration)' == '' and '_$(Configuration)' == '_Debug'">Debug</TargetedSDKConfiguration>
2231     <TargetedSDKConfiguration Condition="'$(TargetedSDKConfiguration)' == '' and '_$(Configuration)' == '_Release'">Retail</TargetedSDKConfiguration>
2232     <TargetedSDKConfiguration Condition="'$(TargetedSDKConfiguration)' == ''">Retail</TargetedSDKConfiguration>
2233     <TargetedSDKArchitecture Condition="'$(TargetedSDKArchitecture)' == ''">$(ProcessorArchitecture)</TargetedSDKArchitecture>
2234     <TargetedSDKArchitecture Condition="'$(TargetedSDKArchitecture)' == ''">Neutral</TargetedSDKArchitecture>
2235   </PropertyGroup>
2236
2237   <PropertyGroup>
2238     <ShouldMarkCertainSDKReferencesAsRuntimeOnly Condition="'$(ShouldMarkCertainSDKReferencesAsRuntimeOnly)' == ''">true</ShouldMarkCertainSDKReferencesAsRuntimeOnly>
2239   </PropertyGroup>
2240
2241   <ItemGroup Condition="'$(ShouldMarkCertainSDKReferencesAsRuntimeOnly)' == 'true'">
2242     <!-- Dependencies that are specified as runtime-only dependencies. Therefore the associated files are not used to build Appx package.  -->
2243     <!-- TODO: Do we need to do anything like this for the new SDK? -->
2244     <RuntimeReferenceOnlySDKDependencies Condition = "'$(TargetPlatformVersion)' == '8.1'" Include="Microsoft.VCLibs, Version=11.0"/>
2245   </ItemGroup>
2246
2247   <Target
2248       Name="ResolveSDKReferences"
2249       Returns="@(ResolvedSDKReference)"
2250       DependsOnTargets="$(ResolveSDKReferencesDependsOn)">
2251
2252     <ResolveSDKReference
2253            SDKReferences="@(SDKReference)"
2254            RuntimeReferenceOnlySDKDependencies="@(RuntimeReferenceOnlySDKDependencies)"
2255            References="@(Reference)"
2256            TargetPlatformVersion="$(TargetPlatformVersion)"
2257            TargetPlatformIdentifier="$(TargetPlatformIdentifier)"
2258            WarnOnMissingPlatformVersion="$(SDKReferenceWarnOnMissingMaxPlatformVersion)"
2259            ProjectName="$(MSBuildProjectName)"
2260            TargetedSDKConfiguration="$(TargetedSDKConfiguration)"
2261            TargetedSDKArchitecture="$(TargetedSDKArchitecture)"
2262            InstalledSDKs ="@(InstalledSDKLocations)"
2263            LogResolutionErrorsAsWarnings ="$(LogSDKReferenceResolutionErrorsAsWarnings)"
2264            Prefer32Bit ="$(Prefer32Bit)"
2265            ContinueOnError="$(ContinueOnError)"
2266            Condition="'@(SDKReference)'!=''">
2267       <Output TaskParameter="ResolvedSDKReferences" ItemName="ResolvedSDKReference"/>
2268     </ResolveSDKReference>
2269   </Target>
2270
2271    <Target
2272       Name="ResolveSDKReferencesDesignTime"
2273       Returns="@(ResolvedSDKReference)"
2274       DependsOnTargets="ResolveSDKReferences" />
2275
2276   <!--
2277     ============================================================
2278
2279                                         FindInvalidProjectReferences
2280
2281     Find project to project references with target platform version higher than the one used by the current project and
2282     creates a list of invalid references to be unresolved. It issues a warning for each invalid reference.
2283
2284         [IN]
2285         $(TargetPlatformVersion) - Project's target platform version
2286         @(_ProjectReferenceTargetPlatformMonikers) - List of monikers of all referenced projects gathered by the helper
2287                                                      target GetTargetPlatformMonikers.
2288
2289         [OUT]
2290     @(InvalidProjectReferences) - List of invalid project references
2291
2292     ============================================================
2293     -->
2294
2295   <PropertyGroup>
2296     <FindInvalidProjectReferencesDependsOn>
2297       GetReferenceTargetPlatformMonikers
2298     </FindInvalidProjectReferencesDependsOn>
2299   </PropertyGroup>
2300
2301    <Target
2302       Name="FindInvalidProjectReferences"
2303       Condition ="'$(FindInvalidProjectReferences)' == 'true'"
2304       DependsOnTargets="$(FindInvalidProjectReferencesDependsOn)">
2305
2306      <FindInvalidProjectReferences
2307          TargetPlatformVersion="$(TargetPlatformVersion)"
2308          TargetPlatformIdentifier="$(TargetPlatformIdentifier)"
2309          ProjectReferences="@(TargetPathWithTargetPlatformMoniker)">
2310        <Output TaskParameter="InvalidReferences" ItemName="InvalidProjectReferences" />
2311      </FindInvalidProjectReferences>
2312
2313      <ItemGroup>
2314        <_ResolvedProjectReferencePaths Remove="@(InvalidProjectReferences)" />
2315      </ItemGroup>
2316    </Target>
2317
2318   <Target Name="GetReferenceTargetPlatformMonikers" DependsOnTargets="PrepareProjectReferences">
2319     <MSBuild
2320       Projects="@(_MSBuildProjectReferenceExistent)"
2321       Properties="%(_MSBuildProjectReferenceExistent.SetConfiguration); %(_MSBuildProjectReferenceExistent.SetPlatform); %(_MSBuildProjectReferenceExistent.SetTargetFramework)"
2322       Targets="GetTargetPathWithTargetPlatformMoniker"
2323       BuildInParallel="$(BuildInParallel)"
2324       ContinueOnError="!$(BuildingProject)"
2325       RemoveProperties="%(_MSBuildProjectReferenceExistent.GlobalPropertiesToRemove)">
2326
2327       <Output TaskParameter="TargetOutputs" ItemName="TargetPathWithTargetPlatformMoniker" />
2328     </MSBuild>
2329   </Target>
2330
2331    <!--
2332     ============================================================
2333
2334                        ExpandSDKReferences
2335
2336         After we have resolved the sdk refrence we need to make sure that we automatically include the references which are part of the SDK (both winmd and dll)
2337         as part of the assemblies passed to the compiler.
2338
2339         Project systems or project which do not want to reference all dlls or winmd files should override this target to do nothing.
2340    ============================================================
2341     -->
2342   <PropertyGroup>
2343     <ExpandSDKReferencesDependsOn>
2344       ResolveSDKReferences
2345     </ExpandSDKReferencesDependsOn>
2346
2347     <ExpandSDKAllowedReferenceExtensions Condition="'$(ExpandSDKAllowedReferenceExtensions)' == ''">
2348       .winmd;
2349       .dll
2350     </ExpandSDKAllowedReferenceExtensions>
2351   </PropertyGroup>
2352
2353    <Target Name="ExpandSDKReferences"
2354            Returns="@(ReferencesFromSDK)"
2355            DependsOnTargets="$(ExpandSDKReferencesDependsOn)"
2356     >
2357      <GetSDKReferenceFiles
2358        ResolvedSDKReferences="@(ResolvedSDKReference)"
2359        ReferenceExtensions="$(ExpandSDKAllowedReferenceExtensions)"
2360        TargetSDKIdentifier="$(SDKIdentifier)"
2361        TargetSDKVersion="$(SDKVersion)"
2362        TargetPlatformIdentifier="$(TargetPlatformIdentifier)"
2363        TargetPlatformVersion="$(TargetPlatformVersion)"
2364        LogRedistFilesList="$(GetSDKReferenceFilesLogRedistFilesList)"
2365        LogRedistConflictWithinSDKAsWarning ="$(GetSDKReferenceFilesLogRedistConflictsWithinSDKAsWarning)"
2366        LogRedistConflictBetweenSDKsAsWarning ="$(GetSDKReferenceFilesLogRedistConflictsBetweenSDKsAsWarning)"
2367        LogReferencesList="$(GetSDKReferenceFilesLogReferencesList)"
2368        LogReferenceConflictWithinSDKAsWarning ="$(GetSDKReferenceFilesLogReferenceConflictsWithinSDKAsWarning)"
2369        LogReferenceConflictBetweenSDKsAsWarning ="$(GetSDKReferenceFilesLogReferenceConflictsBetweenSDKsAsWarning)"
2370        CacheFileFolderPath ="$(GetSDKReferenceFilesCacheFolder)"
2371        LogCacheFileExceptions="$(GetSDKReferenceFilesLogCacheFileExceptions)"
2372        Condition="'@(ResolvedSDKReference)'!=''">
2373
2374        <Output TaskParameter="References" ItemName="ReferencePath"/>
2375        <Output TaskParameter="References" ItemName="ReferencesFromSDK"/>
2376        <Output TaskParameter="References" ItemName="_ResolveAssemblyReferenceResolvedFiles"/>
2377        <Output TaskParameter="CopyLocalFiles" ItemName="ReferenceCopyLocalPaths"/>
2378        <Output TaskParameter="RedistFiles" ItemName="ResolvedRedistFiles"/>
2379      </GetSDKReferenceFiles>
2380    </Target>
2381
2382   <!--
2383     ============================================================
2384
2385                                         ExportWindowsMDFile
2386
2387     When a project is generating a a winmd file through c# or vb, ect the compiler will create a WinMDModule file. This file needs to be run
2388     through the winmdexp tool in order to generate the resulting WinMD file.
2389
2390     ===========================================================
2391     -->
2392
2393     <Target Name="ExportWindowsMDFile"
2394           DependsOnTargets="Compile"
2395           Condition="'$(ExportWinMDFile)' == 'true'"
2396           Inputs="@(IntermediateAssembly);@(DocFileItem);@(_DebugSymbolsIntermediatePath);@(ReferencePath);$(MSBuildAllProjects)"
2397           Outputs="$(_IntermediateWindowsMetadataPath);$(WinMDExpOutputPdb);$(WinMDOutputDocumentationFile)"
2398   >
2399
2400       <PropertyGroup>
2401         <!-- Will be copied by the "copy WinMD artifacts" step instead -->
2402         <CopyBuildOutputToOutputDirectory>false</CopyBuildOutputToOutputDirectory>
2403         <CopyOutputSymbolsToOutputDirectory>false</CopyOutputSymbolsToOutputDirectory>
2404
2405         <WinMdExpToolPath Condition="'$(WinMdExpToolPath)' == ''">$(TargetFrameworkSDKToolsDirectory)</WinMdExpToolPath>
2406         <WinMdExpUTF8Ouput Condition="'$(WinMdExpUTF8Ouput)' == ''">true</WinMdExpUTF8Ouput>
2407       </PropertyGroup>
2408
2409       <WinMDExp WinMDModule="@(IntermediateAssembly)"
2410                 References="@(ReferencePath)"
2411                 DisabledWarnings="$(WinMdExpNoWarn)"
2412                 InputDocumentationFile="@(DocFileItem)"
2413                 OutputDocumentationFile="$(WinMDOutputDocumentationFile)"
2414                 TreatWarningsAsErrors="$(TreatWarningsAsErrors)"
2415                 InputPDBFile="@(_DebugSymbolsIntermediatePath)"
2416                 OutputPDBFile="$(WinMDExpOutputPdb)"
2417                 OutputWindowsMetadataFile="$(_IntermediateWindowsMetadataPath)"
2418                 EnvironmentVariables="$(WinMDExpEnvironment)"
2419                 UTF8Output="$(WinMdExpUTF8Ouput)"
2420                 SdkToolsPath="$(WinMdExpToolPath)"
2421                 AssemblyUnificationPolicy="$(WinMDExpAssemblyUnificationPolicy)">
2422       <Output TaskParameter="OutputWindowsMetadataFile" ItemName="FileWrites"/>
2423      </WinMDExp>
2424
2425      <ItemGroup>
2426          <WinMDExpArtifacts Include="$(_IntermediateWindowsMetadataPath)"/>
2427          <WinMDExpArtifacts Include="$(WinMDOutputDocumentationFile)"/>
2428          <WinMDExpArtifacts Include="$(WinMDExpOutputPdb)"/>
2429          <FileWrites Include="$(WinMDOutputDocumentationFile);$(WinMDExpOutputPdb)"/>
2430     </ItemGroup>
2431   </Target>
2432
2433   <Target
2434       Name="ResolveAssemblyReferencesDesignTime"
2435       Returns="@(_ReferencesFromRAR)"
2436       DependsOnTargets="ResolveProjectReferences;ResolveAssemblyReferences">
2437
2438     <!-- We need to do this here because we only want references which have been passed into rar but are not project to project references. -->
2439     <ItemGroup>
2440       <_ReferencesFromRAR Include="@(ReferencePath->WithMetadataValue('ReferenceSourceTarget', 'ResolveAssemblyReference'))"/>
2441     </ItemGroup>
2442   </Target>
2443
2444   <PropertyGroup>
2445     <ProjectDesignTimeAssemblyResolutionSearchPaths Condition=" '$(ProjectDesignTimeAssemblyResolutionSearchPaths)' == '' ">
2446       {CandidateAssemblyFiles};
2447       $(ReferencePath);
2448       {HintPathFromItem};
2449       {TargetFrameworkDirectory};
2450       {Registry:$(FrameworkRegistryBase),$(TargetFrameworkVersion),$(AssemblyFoldersSuffix)$(AssemblyFoldersExConditions)};
2451       {RawFileName};
2452       $(TargetDir)
2453     </ProjectDesignTimeAssemblyResolutionSearchPaths>
2454   </PropertyGroup>
2455
2456   <!--
2457     ==============================================================
2458
2459                                        DesignTimeResolveAssemblyReferences
2460
2461     Given the list of assemblies, resolve their reference paths.
2462     This target is called by Visual Studio at run time in order to filter references
2463     according to the targeted framework.
2464
2465         [IN]
2466         @(DesignTimeReference) - List of assembly references as simple/fusion names.
2467
2468
2469         [OUT]
2470         @(ReferencePath) - Paths to resolved primary files.
2471
2472     ==============================================================
2473     -->
2474   <PropertyGroup>
2475     <DesignTimeResolveAssemblyReferencesDependsOn>
2476       GetFrameworkPaths;
2477       GetReferenceAssemblyPaths;
2478       ResolveReferences
2479     </DesignTimeResolveAssemblyReferencesDependsOn>
2480   </PropertyGroup>
2481
2482   <Target
2483       Name="DesignTimeResolveAssemblyReferences"
2484       Condition="'$(DesignTimeReference)'!=''"
2485       DependsOnTargets="$(DesignTimeResolveAssemblyReferencesDependsOn)">
2486
2487     <ItemGroup>
2488       <_DesignTimeReferenceInstalledAssemblyDirectory Include="$(TargetFrameworkDirectory)" />
2489     </ItemGroup>
2490
2491     <PropertyGroup>
2492       <DesignTimeResolveAssemblyReferencesStateFile Condition="'$(BuildingProject)'=='true'">$(IntermediateOutputPath)$(MSBuildProjectFile)DesignTimeResolveAssemblyReferences.cache</DesignTimeResolveAssemblyReferencesStateFile>
2493     </PropertyGroup>
2494
2495     <PropertyGroup>
2496       <DesignTimeAssemblySearchPaths Condition=" '$(DesignTimeAssemblySearchPaths)' == '' ">
2497         {CandidateAssemblyFiles};
2498         $(ReferencePath);
2499         {HintPathFromItem};
2500         {TargetFrameworkDirectory};
2501         {Registry:$(FrameworkRegistryBase),$(TargetFrameworkVersion),$(AssemblyFoldersSuffix)$(AssemblyFoldersExConditions)};
2502         {RawFileName};
2503         $(OutDir)
2504       </DesignTimeAssemblySearchPaths>
2505     </PropertyGroup>
2506
2507     <PropertyGroup>
2508       <DesignTimeFindDependencies Condition=" '$(DesignTimeFindDependencies)' == '' ">false</DesignTimeFindDependencies>
2509       <DesignTimeIgnoreVersionForFrameworkReferences Condition=" '$(DesignTimeIgnoreVersionForFrameworkReferences)' == '' ">false</DesignTimeIgnoreVersionForFrameworkReferences>
2510       <DesignTimeFindSatellites Condition=" '$(DesignTimeFindSatellites)' == '' ">false</DesignTimeFindSatellites>
2511       <DesignTimeFindSerializationAssemblies Condition=" '$(DesignTimeFindSerializationAssemblies)' == '' ">false</DesignTimeFindSerializationAssemblies>
2512       <DesignTimeFindRelatedFiles Condition=" '$(DesignTimeFindRelatedFiles)' == '' ">false</DesignTimeFindRelatedFiles>
2513       <DesignTimeSilentResolution Condition=" '$(DesignTimeSilentResolution)' == '' and '$(TraceDesignTime)' != 'true'">true</DesignTimeSilentResolution>
2514       <DesignTimeAutoUnify Condition="'$(DesignTimeAutoUnify)' == ''">false</DesignTimeAutoUnify>
2515     </PropertyGroup>
2516
2517     <ItemGroup>
2518       <_DesignTimeReferenceAssemblies Include ="$(DesignTimeReference)" />
2519     </ItemGroup>
2520
2521     <ItemGroup>
2522       <_RARResolvedReferencePath Include="@(ReferencePath)" />
2523       <ReferencePath Remove="@(ReferencePath)" />
2524     </ItemGroup>
2525
2526     <ResolveAssemblyReference
2527         Assemblies="@(_DesignTimeReferenceAssemblies)"
2528         TargetFrameworkDirectories="@(_DesignTimeReferenceInstalledAssemblyDirectory)"
2529         SearchPaths="$(DesignTimeAssemblySearchPaths)"
2530         AllowedAssemblyExtensions="$(AllowedReferenceAssemblyFileExtensions)"
2531         TargetProcessorArchitecture="$(ProcessorArchitecture)"
2532         CandidateAssemblyFiles="@(Content);@(None);@(_RARResolvedReferencePath)"
2533         FindDependencies="$(DesignTimeFindDependencies)"
2534         AutoUnify="$(DesignTimeAutoUnify)"
2535         IgnoreVersionForFrameworkReferences="$(DesignTimeIgnoreVersionForFrameworkReferences)"
2536         FindSatellites="$(DesignTimeFindSatellites)"
2537         FindSerializationAssemblies="$(DesignTimeFindSerializationAssemblies)"
2538         FindRelatedFiles="$(DesignTimeFindRelatedFiles)"
2539         Silent="$(DesignTimeSilentResolution)"
2540         TargetFrameworkVersion="$(TargetFrameworkVersion)"
2541         TargetFrameworkMoniker="$(TargetFrameworkMoniker)"
2542         TargetFrameworkMonikerDisplayName="$(TargetFrameworkMonikerDisplayName)"
2543         TargetedRuntimeVersion="$(TargetedRuntimeVersion)"
2544         StateFile="$(DesignTimeResolveAssemblyReferencesStateFile)"
2545         InstalledAssemblySubsetTables="@(InstalledAssemblySubsetTables)"
2546         IgnoreDefaultInstalledAssemblySubsetTables="$(IgnoreInstalledAssemblySubsetTables)"
2547         TargetFrameworkSubsets="@(_ReferenceInstalledAssemblySubsets)"
2548         FullTargetFrameworkSubsetNames="$(FullReferenceAssemblyNames)"
2549         FullFrameworkFolders="$(_FullFrameworkReferenceAssemblyPaths)"
2550         FullFrameworkAssemblyTables="@(FullFrameworkAssemblyTables)"
2551         ProfileName="$(TargetFrameworkProfile)"
2552         ResolvedSDKReferences="@(ResolvedSDKReference)"
2553         IgnoreTargetFrameworkAttributeVersionMismatch ="$(DesignTimeIgnoreTargetFrameworkAttributeVersionMismatch)"
2554        >
2555
2556       <Output TaskParameter="ResolvedFiles" ItemName="DesignTimeReferencePath"/>
2557       <Output TaskParameter="FilesWritten" ItemName="FileWrites"/>
2558     </ResolveAssemblyReference>
2559   </Target>
2560
2561   <!--
2562     ============================================================
2563                                         ResolveComReferences
2564
2565     Resolve COM references
2566
2567         [IN]
2568         @(COMReference) - The list of COM references
2569         $(BaseIntermediateOutputPath) - The output directory in which to generate wrapper assemblies
2570
2571         [OUT]
2572         @(ReferencePath) - Paths to referenced wrappers.
2573
2574         If ResolveComReferences is invoked from the IDE, PrepareForBuild may need to run to create directories.
2575     ============================================================
2576     -->
2577   <PropertyGroup>
2578     <ComReferenceExecuteAsTool Condition="'$(ComReferenceExecuteAsTool)'==''">false</ComReferenceExecuteAsTool>
2579   </PropertyGroup>
2580
2581   <Target
2582       Name="ResolveComReferences"
2583       Condition="'@(COMReference)'!='' or '@(COMFileReference)'!=''"
2584       Returns="@(ReferencePath)"
2585       DependsOnTargets="PrepareForBuild;ResolveKeySource;ResolveAssemblyReferences"
2586         >
2587
2588     <PropertyGroup Condition=" '$(InteropOutputPath)' == '' ">
2589       <InteropOutputPath>$(IntermediateOutputPath)</InteropOutputPath>
2590     </PropertyGroup>
2591
2592     <MakeDir Directories="$(InteropOutputPath)"/>
2593
2594     <!--
2595         Note: This task should not be batched, since it relies on having all the COM references fed into it at once.
2596         -->
2597     <PropertyGroup>
2598       <ResolveComReferenceMSBuildArchitecture Condition="'$(ResolveComReferenceMSBuildArchitecture)' == ''">$(PlatformTargetAsMSBuildArchitecture)</ResolveComReferenceMSBuildArchitecture>
2599
2600       <ResolveComReferenceToolPath Condition="'$(ResolveComReferenceToolPath)' == ''">$(TargetFrameworkSDKToolsDirectory)</ResolveComReferenceToolPath>
2601       <ResolveComReferenceSilent Condition="'$(ResolveComReferenceSilent)' == ''">false</ResolveComReferenceSilent>
2602     </PropertyGroup>
2603
2604     <ResolveComReference
2605           TypeLibNames="@(COMReference)"
2606           TypeLibFiles="@(COMFileReference)"
2607           ResolvedAssemblyReferences="@(ReferencePath)"
2608           WrapperOutputDirectory="$(InteropOutputPath)"
2609           IncludeVersionInInteropName="$(IncludeVersionInInteropName)"
2610           KeyContainer="$(KeyContainerName)"
2611           KeyFile="$(KeyOriginatorFile)"
2612           DelaySign="$(DelaySign)"
2613           StateFile="@(_ResolveComReferenceCache)"
2614           TargetFrameworkVersion="$(TargetFrameworkVersion)"
2615           TargetProcessorArchitecture="$(ProcessorArchitecture)"
2616           NoClassMembers="$(ComReferenceNoClassMembers)"
2617           Silent="$(ResolveComReferenceSilent)"
2618           EnvironmentVariables="$(ResolveComReferenceEnvironment)"
2619           SdkToolsPath="$(ResolveComReferenceToolPath)"
2620           ExecuteAsTool="$(ComReferenceExecuteAsTool)"
2621           MSBuildArchitecture="$(ResolveComReferenceMSBuildArchitecture)"
2622           ContinueOnError="$(ContinueOnError)">
2623
2624       <Output TaskParameter="ResolvedFiles" ItemName="ReferencePath"/>
2625       <Output TaskParameter="ResolvedFiles" ItemName="ComReferenceWrappers"/>
2626       <Output TaskParameter="ResolvedFiles" ItemName="FileWrites"/>
2627       <!-- This output list only includes items with Isolated attribute set to True.  It's done by the task itself. -->
2628       <Output TaskParameter="ResolvedModules" ItemName="ResolvedIsolatedComModules"/>
2629
2630     </ResolveComReference>
2631
2632     <ItemGroup>
2633       <FileWrites Include="@(_ResolveComReferenceCache)"/>
2634       <ReferenceComWrappersToCopyLocal Include="@(ComReferenceWrappers)" Condition="'%(ComReferenceWrappers.CopyLocal)'!='false'"/>
2635     </ItemGroup>
2636
2637   </Target>
2638
2639   <Target
2640       Name="ResolveComReferencesDesignTime"
2641       Returns="@(ComReferenceWrappers)"
2642       DependsOnTargets="ResolveComReferences" />
2643
2644   <!--
2645     ***********************************************************************************************
2646     ***********************************************************************************************
2647                                                                 PrepareResources Section
2648     ***********************************************************************************************
2649     ***********************************************************************************************
2650     -->
2651
2652   <!--
2653     ============================================================
2654                                         PrepareResources
2655
2656     Prepare resources for the Compile step.
2657     ============================================================
2658     -->
2659   <PropertyGroup>
2660     <PrepareResourcesDependsOn>
2661       PrepareResourceNames;
2662       ResGen;
2663       CompileLicxFiles
2664     </PrepareResourcesDependsOn>
2665   </PropertyGroup>
2666   <Target
2667       Name="PrepareResources"
2668       DependsOnTargets="$(PrepareResourcesDependsOn)"/>
2669
2670   <!--
2671     ============================================================
2672                                         PrepareResourceNames
2673
2674     Prepare the names of resource files.
2675     ============================================================
2676     -->
2677   <PropertyGroup>
2678     <PrepareResourceNamesDependsOn>
2679       AssignTargetPaths;
2680       SplitResourcesByCulture;
2681       CreateManifestResourceNames;
2682       CreateCustomManifestResourceNames
2683     </PrepareResourceNamesDependsOn>
2684   </PropertyGroup>
2685   <Target
2686       Name="PrepareResourceNames"
2687       DependsOnTargets="$(PrepareResourceNamesDependsOn)"/>
2688
2689   <!--
2690     ============================================================
2691                                         AssignTargetPaths
2692
2693     This target creates <TargetPath> tags for items. <TargetPath> is a relative folder plus filename
2694     for the destination of this item.
2695     ============================================================
2696     -->
2697   <PropertyGroup>
2698     <AssignTargetPathsDependsOn></AssignTargetPathsDependsOn>
2699   </PropertyGroup>
2700   <Target
2701       Name="AssignTargetPaths"
2702       DependsOnTargets="$(AssignTargetPathsDependsOn)">
2703
2704     <ItemGroup>
2705       <_Temporary Remove="@(_Temporary)" />
2706     </ItemGroup>
2707
2708     <!-- AssignTargetPath generates TargetPath metadata that is consumed by CreateManifestResourceNames target for manifest name generation -->
2709     <AssignTargetPath Files="@(EmbeddedResource)" RootFolder="$(MSBuildProjectDirectory)">
2710       <Output TaskParameter="AssignedFiles" ItemName="_Temporary" />
2711     </AssignTargetPath>
2712
2713
2714     <ItemGroup>
2715       <!-- Replace items in EmbeddedResource with the items emitted by the AssignTargetPath task that have the TargetPath metadata -->
2716       <EmbeddedResource Remove="@(_Temporary)" />
2717       <EmbeddedResource Include="@(_Temporary)" />
2718       <_Temporary Remove="@(_Temporary)" />
2719     </ItemGroup>
2720
2721     <AssignTargetPath Files="@(Content)" RootFolder="$(MSBuildProjectDirectory)">
2722       <Output TaskParameter="AssignedFiles" ItemName="ContentWithTargetPath" />
2723     </AssignTargetPath>
2724
2725     <AssignTargetPath Files="@(None)" RootFolder="$(MSBuildProjectDirectory)">
2726       <Output TaskParameter="AssignedFiles" ItemName="_NoneWithTargetPath" />
2727     </AssignTargetPath>
2728
2729     <AssignTargetPath Files="@(BaseApplicationManifest)" RootFolder="$(MSBuildProjectDirectory)">
2730       <Output TaskParameter="AssignedFiles" ItemName="_DeploymentBaseManifestWithTargetPath"/>
2731     </AssignTargetPath>
2732
2733     <AssignTargetPath Files="@(None)" RootFolder="$(MSBuildProjectDirectory)" Condition="'@(_DeploymentBaseManifestWithTargetPath)'=='' and '%(None.Extension)'=='.manifest'">
2734       <Output TaskParameter="AssignedFiles" ItemName="_DeploymentBaseManifestWithTargetPath" />
2735     </AssignTargetPath>
2736
2737   </Target>
2738
2739   <!--
2740     ============================================================
2741                                         GetItemTargetPaths
2742
2743     This target returns all items that have TargetPath metadata assigned by the AssignTargetPaths target.
2744     ============================================================
2745     -->
2746   <Target
2747     Name="GetItemTargetPaths"
2748     DependsOnTargets="AssignTargetPaths"
2749     Returns="
2750       @(EmbeddedResource);
2751       @(ContentWithTargetPath);
2752       @(_NoneWithTargetPath);
2753       @(_DeploymentBaseManifestWithTargetPath);
2754       " />
2755
2756   <!--
2757     ============================================================
2758                                         SplitResourcesByCulture
2759
2760     Split EmbeddedResource items into five lists based on whether
2761     they are resx files, licx files or other resources and whether they should be localized. Also adds Type and Culture
2762     metadata. Type indicates whether the resource is "Resx" or "Non-Resx".
2763
2764         [IN]/[OUT]
2765         @(EmbeddedResource) - The raw list of resources.
2766
2767         [OUT]
2768         @(_LicxFile) - The EmbeddedResource items with extension equal to '.licx'.
2769     ============================================================
2770     -->
2771   <Target
2772       Name="SplitResourcesByCulture"
2773       DependsOnTargets="AssignTargetPaths">
2774
2775     <Warning Condition="'@(ResxWithNoCulture)'!=''" Code="MSB9000" Text="ResxWithNoCulture item type is deprecated. Use EmbeddedResource items instead."/>
2776     <Warning Condition="'@(ResxWithCulture)'!=''" Code="MSB9001" Text="ResxWithCulture item type is deprecated. Use EmbeddedResource items instead."/>
2777     <Warning Condition="'@(NonResxWithCulture)'!=''" Code="MSB9002" Text="NonResxWithCulture item type is deprecated. Use EmbeddedResource items instead."/>
2778     <Warning Condition="'@(NonResxWithNoCulture)'!=''" Code="MSB9003" Text="NonResxWithNoCulture item type is deprecated. Use EmbeddedResource items instead."/>
2779
2780     <ItemGroup>
2781       <_LicxFile Include="@(EmbeddedResource)" Condition="'%(Extension)'=='.licx'"/>
2782
2783       <!-- CONSUMED FOR COMPATIBILITY REASONS ONLY. EMIT EMBEDDEDRESOURCE INSTEAD -->
2784       <EmbeddedResource Include="@(ResxWithNoCulture);@(ResxWithCulture)">
2785         <Type>Resx</Type>
2786       </EmbeddedResource>
2787       <EmbeddedResource Include="@(NonResxWithCulture);@(NonResxWithNoCulture)">
2788         <Type>Non-Resx</Type>
2789       </EmbeddedResource>
2790     </ItemGroup>
2791
2792     <AssignCulture Files="@(EmbeddedResource)" Condition="'%(Extension)'!='.licx'">
2793       <!-- Create the list of culture resx and embedded resource files -->
2794       <Output TaskParameter="AssignedFilesWithCulture" ItemName="_MixedResourceWithCulture"/>
2795       <!-- Create the list of non-culture resx and embedded resource files -->
2796       <Output TaskParameter="AssignedFilesWithNoCulture" ItemName="_MixedResourceWithNoCulture"/>
2797     </AssignCulture>
2798
2799     <ItemGroup>
2800
2801       <!-- Remove EmbeddedResource items that we have processed already
2802                  i.e. either Licx, or resources that don't have culture info -->
2803       <EmbeddedResource Remove="@(_MixedResourceWithCulture)" />
2804       <EmbeddedResource Remove="@(_MixedResourceWithNoCulture)" />
2805       <EmbeddedResource Remove="@(_LicxFile)" />
2806
2807       <!-- Add back everything except Licx, so that we have culture info -->
2808       <EmbeddedResource Include="@(_MixedResourceWithNoCulture);@(_MixedResourceWithCulture)" Condition="'%(Extension)'=='.resx' or '%(Extension)'=='.restext'">
2809         <Type Condition="'%(_MixedResourceWithNoCulture.Type)'=='' and '%(_MixedResourceWithCulture.Type)'==''">Resx</Type>
2810       </EmbeddedResource>
2811       <EmbeddedResource Include="@(_MixedResourceWithNoCulture);@(_MixedResourceWithCulture)" Condition="'%(Extension)'!='.resx' and '%(Extension)'!='.restext'">
2812         <Type Condition="'%(_MixedResourceWithNoCulture.Type)'=='' and '%(_MixedResourceWithCulture.Type)'==''">Non-Resx</Type>
2813       </EmbeddedResource>
2814
2815       <!-- EMITTED FOR COMPATIBILITY REASONS ONLY. CONSUME EMBEDDEDRESOURCE INSTEAD -->
2816       <ResxWithNoCulture Remove="@(ResxWithNoCulture)"/>
2817       <NonResxWithNoCulture Remove="@(NonResxWithNoCulture)"/>
2818       <ResxWithCulture Remove="@(ResxWithCulture)"/>
2819       <NonResxWithCulture Remove="@(NonResxWithCulture)"/>
2820       <ResxWithNoCulture Include="@(_MixedResourceWithNoCulture)" Condition="'%(WithCulture)'=='false' and ('%(Extension)'=='.resx' or '%(Extension)'=='.restext')"/>
2821       <NonResxWithNoCulture Include="@(_MixedResourceWithNoCulture)" Condition="'%(WithCulture)'=='false' and ('%(Extension)'!='.resx' and '%(Extension)'!='.restext')"/>
2822       <ResxWithCulture Include="@(_MixedResourceWithCulture)" Condition="'%(WithCulture)'=='true' and ('%(Extension)'=='.resx' or '%(Extension)'=='.restext')"/>
2823       <NonResxWithCulture Include="@(_MixedResourceWithCulture)" Condition="'%(WithCulture)'=='true' and ('%(Extension)'!='.resx' and '%(Extension)'!='.restext')"/>
2824
2825       <!-- Clean up temporary lists -->
2826       <_MixedResourceWithNoCulture Remove="@(_MixedResourceWithNoCulture)" />
2827       <_MixedResourceWithCulture Remove="@(_MixedResourceWithCulture)" />
2828
2829     </ItemGroup>
2830
2831   </Target>
2832
2833   <!--
2834     =======================================================================
2835                                         CreateCustomManifestResourceNames
2836
2837     Allows custom manifest resource name generation tasks to plug
2838     into the build process
2839     =======================================================================
2840     -->
2841   <PropertyGroup>
2842     <CreateCustomManifestResourceNamesDependsOn></CreateCustomManifestResourceNamesDependsOn>
2843   </PropertyGroup>
2844   <Target
2845       Name="CreateCustomManifestResourceNames"
2846       DependsOnTargets="$(CreateCustomManifestResourceNamesDependsOn)"/>
2847
2848   <!--
2849     ============================================================
2850                                         ResGen
2851
2852     Run GenerateResource on the given resx files.
2853
2854     ============================================================
2855     -->
2856   <PropertyGroup>
2857     <ResGenDependsOn>ResolveAssemblyReferences;SplitResourcesByCulture;BeforeResGen;CoreResGen;AfterResGen</ResGenDependsOn>
2858     <CoreResGenDependsOn>FindReferenceAssembliesForReferences</CoreResGenDependsOn>
2859     <UseSourcePath Condition="'$(UseSourcePath)'==''">true</UseSourcePath>
2860     <ResGenExecuteAsTool Condition="'$(ResGenExecuteAsTool)'==''">false</ResGenExecuteAsTool>
2861   </PropertyGroup>
2862   <Target
2863       Name="ResGen"
2864       DependsOnTargets="$(ResGenDependsOn)"/>
2865
2866   <!--
2867     ============================================================
2868                                         BeforeResGen
2869
2870     Redefine this target in your project in order to run tasks just before Resgen.
2871     ============================================================
2872     -->
2873   <Target Name="BeforeResGen"/>
2874
2875   <!--
2876     ============================================================
2877                                         AfterResGen
2878
2879     Redefine this target in your project in order to run tasks just after Resgen.
2880     ============================================================
2881     -->
2882   <Target Name="AfterResGen"/>
2883
2884   <!--
2885     ============================================================
2886                                         CoreResGen
2887     ============================================================
2888     -->
2889   <Target
2890       Name="CoreResGen"
2891       DependsOnTargets="$(CoreResGenDependsOn)">
2892
2893     <ItemGroup>
2894       <_Temporary Remove="@(_Temporary)" />
2895     </ItemGroup>
2896
2897     <PropertyGroup>
2898       <GenerateResourceMSBuildArchitecture Condition="'$(GenerateResourceMSBuildArchitecture)' == ''">$(PlatformTargetAsMSBuildArchitecture)</GenerateResourceMSBuildArchitecture>
2899
2900       <ResgenToolPath Condition="'$(ResgenToolPath)' == ''">$(TargetFrameworkSDKToolsDirectory)</ResgenToolPath>
2901     </PropertyGroup>
2902
2903     <PropertyGroup Condition="'$(TargetFrameworkAsMSBuildRuntime)' != '' and '$(GenerateResourceMSBuildArchitecture)' != ''">
2904       <!-- In the general case, we want to fail to run the task if the task host it's requesting doesn't exist, because we'd rather let the
2905            user know there's something wrong than just silently generate something that's probably not quite right. However, in a few
2906            circumstances, there are tasks that are already aware of runtime / bitness concerns, in which case even if we go ahead and run
2907            the more recent version of the task, it should be able to generate something correct.  GenerateResource is one such task, so
2908            we check for the existence of the targeted task host so that we can use it preferentially, but if it can't be found, we'll fall
2909            back to the current task since it's still mostly correct.
2910
2911            In particular, we need to do this because otherwise people with Dev10 on a machine that they upgrade to Win8 will be broken:
2912            they'll have ResGen from the 7.0A SDK installed, so launching ResGen will still work, but the CLR2 task host is only installed by
2913            the 8.0A SDK, which they won't have installed, and thus without this fallback mechanism, their projects targeting v3.5 will
2914            suddenly start failing to build.-->
2915       <GenerateResourceMSBuildRuntime
2916           Condition="'$(GenerateResourceMSBuildRuntime)' == '' and
2917                      $([MSBuild]::DoesTaskHostExist(`$(TargetFrameworkAsMSBuildRuntime)`, `$(GenerateResourceMSBuildArchitecture)`))">$(TargetFrameworkAsMSBuildRuntime)</GenerateResourceMSBuildRuntime>
2918
2919       <!-- If the targeted runtime doesn't exist, fall back to current -->
2920       <GenerateResourceMSBuildRuntime Condition="'$(GenerateResourceMSBuildRuntime)' == ''">CurrentRuntime</GenerateResourceMSBuildRuntime>
2921     </PropertyGroup>
2922
2923     <!-- 4.0 task has some new parameters that we want to make use of if we're targeting 4.0 -->
2924     <GenerateResource
2925         Sources="@(EmbeddedResource)"
2926         UseSourcePath="$(UseSourcePath)"
2927         References="@(ReferencePathWithRefAssemblies)"
2928         AdditionalInputs="$(MSBuildAllProjects)"
2929         NeverLockTypeAssemblies="$(GenerateResourceNeverLockTypeAssemblies)"
2930         StateFile="$(IntermediateOutputPath)$(MSBuildProjectFile).GenerateResource.Cache"
2931         StronglyTypedClassName="%(EmbeddedResource.StronglyTypedClassName)"
2932         StronglyTypedFileName="%(EmbeddedResource.StronglyTypedFileName)"
2933         StronglyTypedLanguage="%(EmbeddedResource.StronglyTypedLanguage)"
2934         StronglyTypedNamespace="%(EmbeddedResource.StronglyTypedNamespace)"
2935         StronglyTypedManifestPrefix="%(EmbeddedResource.StronglyTypedManifestPrefix)"
2936         PublicClass="%(EmbeddedResource.PublicClass)"
2937         OutputResources="@(EmbeddedResource->'$(IntermediateOutputPath)%(ManifestResourceName).resources')"
2938         Condition="'%(EmbeddedResource.Type)' == 'Resx' and '%(EmbeddedResource.GenerateResource)' != 'false' and '$(GenerateResourceMSBuildRuntime)' != 'CLR2'"
2939         SdkToolsPath="$(ResgenToolPath)"
2940         ExecuteAsTool="$(ResGenExecuteAsTool)"
2941         EnvironmentVariables="$(ResGenEnvironment)"
2942         MSBuildRuntime="$(GenerateResourceMSBuildRuntime)"
2943         MSBuildArchitecture="$(GenerateResourceMSBuildArchitecture)">
2944
2945       <Output TaskParameter="FilesWritten" ItemName="FileWrites"/>
2946       <Output TaskParameter="StronglyTypedFileName" ItemName="Compile"/>
2947
2948       <!-- Gather Sources as an output since it will contain OutputResource metadata indicating the final output resource that it was compiled into -->
2949       <Output TaskParameter="Sources" ItemName="_Temporary" />
2950
2951     </GenerateResource>
2952
2953     <!-- But we can't use those parameters if we're targeting 3.5, since we're using the 3.5 task -->
2954     <GenerateResource
2955         Sources="@(EmbeddedResource)"
2956         UseSourcePath="$(UseSourcePath)"
2957         References="@(ReferencePath)"
2958         AdditionalInputs="$(MSBuildAllProjects)"
2959         NeverLockTypeAssemblies="$(GenerateResourceNeverLockTypeAssemblies)"
2960         StateFile="$(IntermediateOutputPath)$(MSBuildProjectFile).GenerateResource.Cache"
2961         StronglyTypedClassName="%(EmbeddedResource.StronglyTypedClassName)"
2962         StronglyTypedFileName="%(EmbeddedResource.StronglyTypedFileName)"
2963         StronglyTypedLanguage="%(EmbeddedResource.StronglyTypedLanguage)"
2964         StronglyTypedNamespace="%(EmbeddedResource.StronglyTypedNamespace)"
2965         StronglyTypedManifestPrefix="%(EmbeddedResource.StronglyTypedManifestPrefix)"
2966         PublicClass="%(EmbeddedResource.PublicClass)"
2967         OutputResources="@(EmbeddedResource->'$(IntermediateOutputPath)%(ManifestResourceName).resources')"
2968         MSBuildRuntime="$(GenerateResourceMSBuildRuntime)"
2969         MSBuildArchitecture="$(GenerateResourceMSBuildArchitecture)"
2970         Condition="'%(EmbeddedResource.Type)' == 'Resx' and '%(EmbeddedResource.GenerateResource)' != 'false' and '$(GenerateResourceMSBuildRuntime)' == 'CLR2'">
2971
2972       <Output TaskParameter="FilesWritten" ItemName="FileWrites"/>
2973       <Output TaskParameter="StronglyTypedFileName" ItemName="Compile"/>
2974
2975       <!-- Gather Sources as an output since it will contain OutputResource metadata indicating the final output resource that it was compiled into -->
2976       <Output TaskParameter="Sources" ItemName="_Temporary" />
2977
2978     </GenerateResource>
2979
2980     <ItemGroup>
2981       <EmbeddedResource Remove="@(_Temporary)" />
2982
2983       <!-- Add back the Sources list (with OutputResource metadata) that we output from GenerateResource into EmbeddedResource -->
2984       <EmbeddedResource Include="@(_Temporary)" />
2985       <_Temporary Remove="@(_Temporary)" />
2986
2987       <!-- EMITTED FOR COMPATIBILITY REASONS ONLY. CONSUME EMBEDDEDRESOURCE INSTEAD -->
2988       <ManifestResourceWithNoCulture Include="@(EmbeddedResource->'%(OutputResource)')" Condition="'%(EmbeddedResource.WithCulture)'=='false' and '%(EmbeddedResource.Type)' == 'Resx'">
2989         <EmittedForCompatibilityOnly>true</EmittedForCompatibilityOnly>
2990       </ManifestResourceWithNoCulture>
2991       <ManifestNonResxWithNoCultureOnDisk Include="@(EmbeddedResource)" Condition="'%(EmbeddedResource.WithCulture)'=='false' and '%(EmbeddedResource.Type)' == 'Non-Resx'">
2992         <EmittedForCompatibilityOnly>true</EmittedForCompatibilityOnly>
2993       </ManifestNonResxWithNoCultureOnDisk>
2994
2995       <!-- EMITTED FOR COMPATIBILITY REASONS ONLY. CONSUME EMBEDDEDRESOURCE INSTEAD -->
2996       <ManifestResourceWithCulture Include="@(EmbeddedResource->'%(OutputResource)')" Condition="'%(EmbeddedResource.WithCulture)'=='true' and '%(EmbeddedResource.Type)' == 'Resx'">
2997         <EmittedForCompatibilityOnly>true</EmittedForCompatibilityOnly>
2998       </ManifestResourceWithCulture>
2999       <ManifestNonResxWithCultureOnDisk Include="@(EmbeddedResource)" Condition="'%(EmbeddedResource.WithCulture)'=='true' and '%(EmbeddedResource.Type)' == 'Non-Resx'">
3000         <EmittedForCompatibilityOnly>true</EmittedForCompatibilityOnly>
3001       </ManifestNonResxWithCultureOnDisk>
3002
3003     </ItemGroup>
3004
3005   </Target>
3006
3007   <!--
3008     ============================================================
3009                                         CompileLicxFiles
3010
3011     Compile .licx files (containing information about licensed controls used by the application) into .licenses files.
3012
3013         [IN]
3014         @(_LicxFile) - The list of .licx files in the project (usually there will be just one)
3015
3016         [OUT]
3017         @(CompiledLicenseFile) - The list of compiled .licenses files (there will be just one)
3018     ============================================================
3019     -->
3020   <PropertyGroup>
3021     <CompileLicxFilesDependsOn></CompileLicxFilesDependsOn>
3022   </PropertyGroup>
3023   <Target
3024       Name="CompileLicxFiles"
3025       Condition="'@(_LicxFile)'!=''"
3026       DependsOnTargets="$(CompileLicxFilesDependsOn)"
3027       Inputs="$(MSBuildAllProjects);@(_LicxFile);@(ReferencePath);@(ReferenceDependencyPaths)"
3028       Outputs="$(IntermediateOutputPath)$(TargetFileName).licenses">
3029
3030     <PropertyGroup>
3031       <LCMSBuildArchitecture Condition="'$(LCMSBuildArchitecture)' == ''">$(PlatformTargetAsMSBuildArchitecture)</LCMSBuildArchitecture>
3032     </PropertyGroup>
3033
3034     <LC
3035         Sources="@(_LicxFile)"
3036         LicenseTarget="$(TargetFileName)"
3037         OutputDirectory="$(IntermediateOutputPath)"
3038         OutputLicense="$(IntermediateOutputPath)$(TargetFileName).licenses"
3039         ReferencedAssemblies="@(ReferencePath);@(ReferenceDependencyPaths)"
3040         NoLogo="$(NoLogo)"
3041         ToolPath="$(LCToolPath)"
3042         SdkToolsPath="$(TargetFrameworkSDKToolsDirectory)"
3043         EnvironmentVariables="$(LCEnvironment)"
3044         MSBuildArchitecture="$(LCMSBuildArchitecture)"
3045         TargetFrameworkVersion="$(TargetFrameworkVersion)"
3046         >
3047
3048       <Output TaskParameter="OutputLicense" ItemName="CompiledLicenseFile"/>
3049       <Output TaskParameter="OutputLicense" ItemName="FileWrites"/>
3050
3051     </LC>
3052
3053   </Target>
3054
3055
3056
3057
3058   <!--
3059     ***********************************************************************************************
3060     ***********************************************************************************************
3061                                                                 ResolveKeySource Section
3062     ***********************************************************************************************
3063     ***********************************************************************************************
3064     -->
3065
3066   <!--
3067     ============================================================
3068                                         ResolveKeySource
3069
3070     Resolve the strong name key used to sign the assembly as well as the certificate used to
3071     sign the ClickOnce manifests.
3072
3073         [IN]
3074         $(AssemblyOriginatorKeyFile)     - The file used to sign the assembly (.snk or .pfx)
3075         $(ManifestCertificateThumbprint) - The thumbprint used to locate the certificate in the
3076                                            user's certificate store.
3077         $(ManifestKeyFile)               - The key file that contains the certificate in case the
3078                                            certificate is not in the user's store.
3079
3080         [OUT]
3081         $(ResolvedAssemblyKeyFile)        - Key used to sign the assembly
3082         $(_DeploymentResolvedManifestCertificateThumbprint) - Certificate used to sign the manifests
3083     ============================================================
3084     -->
3085   <Target
3086       Name="ResolveKeySource"
3087       Condition="$(SignManifests) == 'true' or $(SignAssembly) == 'true'">
3088
3089     <ResolveKeySource
3090         KeyFile="$(AssemblyOriginatorKeyFile)"
3091         CertificateThumbprint="$(ManifestCertificateThumbprint)"
3092         CertificateFile="$(ManifestKeyFile)"
3093         SuppressAutoClosePasswordPrompt="$(BuildingInsideVisualStudio)"
3094         ShowImportDialogDespitePreviousFailures="$(BuildingProject)"
3095         ContinueOnError="!$(BuildingProject)"
3096           >
3097
3098       <Output TaskParameter="ResolvedKeyFile" PropertyName="KeyOriginatorFile" Condition=" '$(SignAssembly)' == 'true' "/>
3099       <Output TaskParameter="ResolvedKeyContainer" PropertyName="KeyContainerName" Condition=" '$(SignAssembly)' == 'true' "/>
3100       <Output TaskParameter="ResolvedThumbprint" PropertyName="_DeploymentResolvedManifestCertificateThumbprint" Condition=" '$(SignManifests)' == 'true' "/>
3101
3102     </ResolveKeySource>
3103
3104   </Target>
3105
3106   <!--
3107     ***********************************************************************************************
3108     ***********************************************************************************************
3109                                                                 Compile Section
3110     ***********************************************************************************************
3111     ***********************************************************************************************
3112     -->
3113
3114   <!--
3115     ============================================================
3116                                         Compile
3117     ============================================================
3118     -->
3119   <PropertyGroup>
3120     <CompileDependsOn>
3121       ResolveReferences;
3122       ResolveKeySource;
3123       SetWin32ManifestProperties;
3124       FindReferenceAssembliesForReferences;
3125       _GenerateCompileInputs;
3126       BeforeCompile;
3127       _TimeStampBeforeCompile;
3128       _GenerateCompileDependencyCache;
3129       CoreCompile;
3130       _TimeStampAfterCompile;
3131       AfterCompile;
3132     </CompileDependsOn>
3133   </PropertyGroup>
3134   <Target
3135       Name="Compile"
3136       DependsOnTargets="$(CompileDependsOn)"/>
3137
3138   <!--
3139     ============================================================
3140                                         _GenerateCompileInputs
3141
3142     Create the _CoreCompileResourceInputs list of inputs to the CoreCompile target.
3143     ============================================================
3144     -->
3145   <Target Name="_GenerateCompileInputs">
3146
3147     <Warning Condition="'@(ManifestResourceWithNoCulture)'!='' and '%(ManifestResourceWithNoCulture.EmittedForCompatibilityOnly)'==''" Code="MSB9004" Text="ManifestResourceWithNoCulture item type is deprecated. Emit EmbeddedResource items instead, with metadata WithCulture='false', Type='Resx', and optional LogicalName."/>
3148     <Warning Condition="'@(ManifestNonResxWithNoCultureOnDisk)'!='' and '%(ManifestNonResxWithNoCultureOnDisk.EmittedForCompatibilityOnly)'==''" Code="MSB9005" Text="ManifestNonResxWithNoCultureOnDisk item type is deprecated. Emit EmbeddedResource items instead, with metadata WithCulture='false', Type='Non-Resx', and optional LogicalName."/>
3149
3150     <ItemGroup>
3151
3152       <!-- _CoreCompileResourceInputs is the list of TLDA inputs that should trigger CoreCompile, and are listed as inputs to that target -->
3153       <_CoreCompileResourceInputs Include="@(EmbeddedResource->'%(OutputResource)')" Condition="'%(EmbeddedResource.WithCulture)' == 'false' and '%(EmbeddedResource.Type)' == 'Resx'" />
3154       <_CoreCompileResourceInputs Include="@(EmbeddedResource)" Condition="'%(EmbeddedResource.WithCulture)' == 'false' and '%(EmbeddedResource.Type)' == 'Non-Resx' " />
3155
3156       <!-- CONSUMED FOR COMPATIBILITY REASONS ONLY. EMIT EMBEDDEDRESOURCE INSTEAD -->
3157       <_CoreCompileResourceInputs Include="@(ManifestResourceWithNoCulture)" Condition="'%(ManifestResourceWithNoCulture.EmittedForCompatibilityOnly)'==''">
3158         <Type>Resx</Type>
3159         <WithCulture>false</WithCulture>
3160       </_CoreCompileResourceInputs>
3161       <_CoreCompileResourceInputs Include="@(ManifestNonResxWithNoCultureOnDisk)" Condition="'%(ManifestNonResxWithNoCultureOnDisk.EmittedForCompatibilityOnly)'==''">
3162         <Type>Non-Resx</Type>
3163         <WithCulture>false</WithCulture>
3164       </_CoreCompileResourceInputs>
3165
3166     </ItemGroup>
3167
3168   </Target>
3169
3170   <!--
3171     ============================================================
3172                                         GenerateTargetFrameworkMonikerAttribute
3173
3174     Emit the target framework moniker attribute as  a code fragment into a temporary source file for the compiler.
3175     ============================================================
3176     -->
3177   <PropertyGroup Condition="'$(TargetFrameworkMoniker)' != ''">
3178     <!-- Do not clean if we are going to default the path to the temp directory -->
3179     <TargetFrameworkMonikerAssemblyAttributesFileClean Condition="'$(TargetFrameworkMonikerAssemblyAttributesFileClean)' == '' and '$(TargetFrameworkMonikerAssemblyAttributesPath)' != ''">true</TargetFrameworkMonikerAssemblyAttributesFileClean>
3180     <TargetFrameworkMonikerAssemblyAttributesPath Condition="'$(TargetFrameworkMonikerAssemblyAttributesPath)' == ''">$([System.IO.Path]::Combine('$([System.IO.Path]::GetTempPath())','$(TargetFrameworkMoniker).AssemblyAttributes$(DefaultLanguageSourceExtension)'))</TargetFrameworkMonikerAssemblyAttributesPath>
3181   </PropertyGroup>
3182
3183   <PropertyGroup>
3184     <GenerateTargetFrameworkAttribute Condition="'$(GenerateTargetFrameworkAttribute)' == '' and '$(TargetFrameworkMoniker)' != '' and '$(TargetingClr2Framework)' != 'true'">true</GenerateTargetFrameworkAttribute>
3185   </PropertyGroup>
3186
3187   <ItemGroup Condition="'$(TargetFrameworkMonikerAssemblyAttributesFileClean)' == 'true'">
3188     <Clean Include="$(TargetFrameworkMonikerAssemblyAttributesPath)"/>
3189   </ItemGroup>
3190
3191   <Target Name="GenerateTargetFrameworkMonikerAttribute"
3192           BeforeTargets="BeforeCompile"
3193           DependsOnTargets="PrepareForBuild;GetReferenceAssemblyPaths"
3194           Inputs="$(MSBuildToolsPath)\Microsoft.Common.targets"
3195           Outputs="$(TargetFrameworkMonikerAssemblyAttributesPath)"
3196           Condition="'$(GenerateTargetFrameworkAttribute)' == 'true'">
3197
3198     <!-- This is a file shared between projects so we have to take care to handle simultaneous writes (by ContinueOnError)
3199              and a race between clean from one project and build from another (by not adding to FilesWritten so it doesn't clean) -->
3200     <WriteLinesToFile
3201         File="$(TargetFrameworkMonikerAssemblyAttributesPath)"
3202         Lines="$(TargetFrameworkMonikerAssemblyAttributeText)"
3203         Overwrite="true"
3204         ContinueOnError="true"
3205         Condition="'@(Compile)' != '' and '$(TargetFrameworkMonikerAssemblyAttributeText)' != ''"
3206         />
3207
3208     <ItemGroup Condition="'@(Compile)' != '' and '$(TargetFrameworkMonikerAssemblyAttributeText)' != ''">
3209       <Compile Include="$(TargetFrameworkMonikerAssemblyAttributesPath)"/>
3210       <!-- Do not put in FileWrites: this is a file shared between projects in %temp%, and cleaning it would create a race between projects during rebuild -->
3211     </ItemGroup>
3212   </Target>
3213
3214
3215   <!--
3216     ============================================================
3217                                         GenerateAdditionalSources
3218
3219     Emit any specified code fragments into a temporary source file for the compiler.
3220     ============================================================
3221     -->
3222
3223   <PropertyGroup Condition="'$(AssemblyAttributesPath)' != ''">
3224     <GenerateAdditionalSources Condition="'$(GenerateAdditionalSources)' == ''">true</GenerateAdditionalSources>
3225   </PropertyGroup>
3226
3227   <ItemGroup Condition="'$(AssemblyAttributesPath)' != ''">
3228     <Clean Include="$(AssemblyAttributesPath)" Condition="'$(AssemblyAttributesFileClean)' != 'false'" />
3229   </ItemGroup>
3230
3231   <Target Name="GenerateAdditionalSources"
3232           BeforeTargets="BeforeCompile"
3233           DependsOnTargets="PrepareForBuild;GetReferenceAssemblyPaths"
3234           Inputs="$(MSBuildAllProjects)"
3235           Outputs="$(AssemblyAttributesPath)"
3236           Condition="'@(AssemblyAttributes)' != '' and '$(GenerateAdditionalSources)' == 'true'">
3237     <WriteCodeFragment
3238           AssemblyAttributes="@(AssemblyAttributes)"
3239           OutputFile="$(AssemblyAttributesPath)"
3240           Language="$(Language)">
3241
3242       <Output TaskParameter="OutputFile" ItemName="Compile"/>
3243       <Output TaskParameter="OutputFile" ItemName="FileWrites"/>
3244     </WriteCodeFragment>
3245   </Target>
3246
3247   <!--
3248     ============================================================
3249                                         BeforeCompile
3250
3251     Redefine this target in your project in order to run tasks just before Compile.
3252     ============================================================
3253     -->
3254   <Target Name="BeforeCompile"/>
3255
3256   <!--
3257     ============================================================
3258                                         AfterCompile
3259
3260     Redefine this target in your project in order to run tasks just after Compile.
3261     ============================================================
3262     -->
3263   <Target Name="AfterCompile"/>
3264
3265   <!--
3266     ============================================================
3267                                         _TimeStampBeforeCompile
3268
3269     If post-build events are set to fire "OnOutputUpdated", then take before
3270     and after timestamps so that we can compare them.
3271     ============================================================
3272     -->
3273   <Target
3274       Name="_TimeStampBeforeCompile"
3275       Condition="'$(RunPostBuildEvent)'=='OnOutputUpdated' or ('$(RegisterForComInterop)'=='true' and '$(OutputType)'=='library')">
3276
3277     <PropertyGroup>
3278       <_AssemblyTimestampBeforeCompile>%(IntermediateAssembly.ModifiedTime)</_AssemblyTimestampBeforeCompile>
3279     </PropertyGroup>
3280
3281   </Target>
3282
3283   <!--
3284     ============================================================
3285                                         _GenerateCompileDependencyCache
3286
3287     Generate a file used to track compiler dependencies between incremental build
3288     executions. This handles cases where items are added or removed from a glob (e.g.
3289     <Compile Include="**\*.cs" />) and can't otherwise be detected with timestamp 
3290     comparisons. The file contains a hash of compiler inputs that are known to 
3291     contribute to incremental build inconsistencies.
3292     ============================================================
3293     -->
3294   <Target Name="_GenerateCompileDependencyCache" DependsOnTargets="ResolveAssemblyReferences">
3295     <ItemGroup>
3296       <CustomAdditionalCompileInputs Include="$(IntermediateOutputPath)$(MSBuildProjectFile).CoreCompileInputs.cache" />
3297       <CoreCompileCache Include="@(Compile->'%(FullPath)')" />
3298       <CoreCompileCache Include="@(ReferencePath->'%(FullPath)')" />
3299     </ItemGroup>
3300
3301     <Hash ItemsToHash="@(CoreCompileCache)">
3302       <Output TaskParameter="HashResult" PropertyName="CoreCompileDependencyHash" />
3303     </Hash>
3304
3305     <WriteLinesToFile Lines="$(CoreCompileDependencyHash)" File="$(IntermediateOutputPath)$(MSBuildProjectFile).CoreCompileInputs.cache" Overwrite="True" WriteOnlyWhenDifferent="True" />
3306
3307     <ItemGroup>
3308       <FileWrites Include="$(IntermediateOutputPath)$(MSBuildProjectFile).CoreCompileInputs.cache" />
3309     </ItemGroup>
3310   </Target>
3311
3312   <!--
3313     ============================================================
3314                                         _TimeStampAfterCompile
3315
3316     If post-build events are set to fire "OnOutputUpdated", then take before
3317     and after timestamps so that we can compare them.
3318     ============================================================
3319     -->
3320   <Target
3321       Name="_TimeStampAfterCompile"
3322       Condition="'$(RunPostBuildEvent)'=='OnOutputUpdated' or ('$(RegisterForComInterop)'=='true' and '$(OutputType)'=='library')">
3323
3324     <PropertyGroup>
3325       <_AssemblyTimestampAfterCompile>%(IntermediateAssembly.ModifiedTime)</_AssemblyTimestampAfterCompile>
3326     </PropertyGroup>
3327
3328   </Target>
3329
3330   <!--
3331     ================================================================
3332                                         _ComputeNonExistentFileProperty
3333
3334     There are certain situations in which we want to always run the CoreCompile target (and
3335     thus the Csc task), even if the timestamps of the outputs appear to be up-to-date on disk.
3336     If we're inside the IDE during design-time, then the Csc/Vbc/Vjc task is simply being used to
3337     initialize the host compiler, so we always want to run it.  Also, if we're inside the IDE, and
3338     the host compiler is responsible for doing the compilation during an actual build, we want to let
3339     the host compiler determine whether the output is up-to-date, because there may be source files
3340     in the IDE's in-memory buffers that we don't know about.
3341
3342     So, we always run the CoreCompile target if we're in the IDE, and either we're in design-time or
3343     we're delegating to the host compiler for the actual build.
3344
3345     We compare against BuildOutOfProcess != true because we cannot assume that the build process will
3346     have set BuildOutOfProcess to true or false. Therefore the default behavior should be to do the
3347     legacy behavior seen before BuildingOutOfProcess was introduced if the property is not set.
3348     ================================================================
3349     -->
3350   <Target
3351       Name="_ComputeNonExistentFileProperty"
3352       Condition="('$(BuildingInsideVisualStudio)' == 'true') and ('$(BuildingOutOfProcess)' != 'true') and (('$(BuildingProject)' == 'false') or ('$(UseHostCompilerIfAvailable)' == 'true'))">
3353
3354     <PropertyGroup>
3355       <NonExistentFile>__NonExistentSubDir__\__NonExistentFile__</NonExistentFile>
3356     </PropertyGroup>
3357
3358   </Target>
3359
3360
3361
3362
3363   <!--
3364     ***********************************************************************************************
3365     ***********************************************************************************************
3366                                                                 GenerateSerializationAssemblies Section
3367     ***********************************************************************************************
3368     ***********************************************************************************************
3369     -->
3370
3371   <PropertyGroup>
3372     <_SGenDllName>$(TargetName).XmlSerializers.dll</_SGenDllName>
3373     <_SGenDllCreated>false</_SGenDllCreated>
3374     <_SGenGenerateSerializationAssembliesConfig>$(GenerateSerializationAssemblies)</_SGenGenerateSerializationAssembliesConfig>
3375     <_SGenGenerateSerializationAssembliesConfig Condition="'$(GenerateSerializationAssemblies)' == ''">Auto</_SGenGenerateSerializationAssembliesConfig>
3376     <_SGenGenerateSerializationAssembliesConfig Condition="'$(ConfigurationName)'=='Debug' and '$(_SGenGenerateSerializationAssembliesConfig)' == 'Auto'">Off</_SGenGenerateSerializationAssembliesConfig>
3377     <SGenUseProxyTypes Condition="'$(SGenUseProxyTypes)' == ''">true</SGenUseProxyTypes>
3378     <SGenUseKeep Condition="'$(SGenUseKeep)'==''">false</SGenUseKeep>
3379     <SGenShouldGenerateSerializer Condition="'$(SGenShouldGenerateSerializer)' == ''">true</SGenShouldGenerateSerializer>
3380   </PropertyGroup>
3381
3382   <!--
3383     ============================================================
3384                                         GenerateSerializationAssemblies
3385
3386     Run GenerateSerializationAssemblies on the assembly produced by this build.
3387
3388         [IN]
3389         @(BuildAssemblyName) - The assembly generated by this build.
3390         @(BuildAssemblyPath) - The path where the assembly resides.
3391         @(ReferencePath) - The list of references used by this assembly.
3392
3393         [OUT]
3394         @(SerializationAssembly) - The path to the serialization assembly.  Maybe we'll just append to an existing list.
3395     ============================================================
3396     -->
3397   <Target
3398       Name="GenerateSerializationAssemblies"
3399       Condition="'$(_SGenGenerateSerializationAssembliesConfig)' == 'On' or ('@(WebReferenceUrl)'!='' and '$(_SGenGenerateSerializationAssembliesConfig)' == 'Auto')"
3400       DependsOnTargets="AssignTargetPaths;Compile;ResolveKeySource"
3401       Inputs="$(MSBuildAllProjects);@(IntermediateAssembly)"
3402       Outputs="$(IntermediateOutputPath)$(_SGenDllName)">
3403
3404     <PropertyGroup>
3405       <SGenMSBuildArchitecture Condition="'$(SGenMSBuildArchitecture)' == ''">$(PlatformTargetAsMSBuildArchitecture)</SGenMSBuildArchitecture>
3406     </PropertyGroup>
3407
3408     <SGen
3409         BuildAssemblyName="$(TargetFileName)"
3410         BuildAssemblyPath="$(IntermediateOutputPath)"
3411         References="@(ReferencePath)"
3412         ShouldGenerateSerializer="$(SGenShouldGenerateSerializer)"
3413         UseProxyTypes="$(SGenUseProxyTypes)"
3414         UseKeep="$(SGenUseKeep)"
3415         KeyContainer="$(KeyContainerName)"
3416         KeyFile="$(KeyOriginatorFile)"
3417         DelaySign="$(DelaySign)"
3418         ToolPath="$(SGenToolPath)"
3419         SdkToolsPath="$(TargetFrameworkSDKToolsDirectory)"
3420         EnvironmentVariables="$(SGenEnvironment)"
3421         MSBuildArchitecture="$(SGenMSBuildArchitecture)"
3422         SerializationAssembly="$(IntermediateOutputPath)$(_SGenDllName)"
3423         Platform="$(SGenPlatformTarget)"
3424         Types="$(SGenSerializationTypes)">
3425
3426       <Output TaskParameter="SerializationAssembly" ItemName="SerializationAssembly"/>
3427
3428     </SGen>
3429
3430   </Target>
3431
3432   <!--
3433     ***********************************************************************************************
3434     ***********************************************************************************************
3435                                                                 CreateSatelliteAssemblies Section
3436     ***********************************************************************************************
3437     ***********************************************************************************************
3438     -->
3439
3440   <!--
3441     ============================================================
3442                                         CreateSatelliteAssemblies
3443
3444     Create one satellite assembly for every unique culture in the resources.
3445     ============================================================
3446     -->
3447   <PropertyGroup>
3448     <CreateSatelliteAssembliesDependsOn>
3449       _GenerateSatelliteAssemblyInputs;
3450       ComputeIntermediateSatelliteAssemblies;
3451       GenerateSatelliteAssemblies
3452     </CreateSatelliteAssembliesDependsOn>
3453   </PropertyGroup>
3454   <Target
3455       Name="CreateSatelliteAssemblies"
3456       DependsOnTargets="$(CreateSatelliteAssembliesDependsOn)" />
3457
3458   <!--
3459     ============================================================
3460                                         _GenerateSatelliteAssemblyInputs
3461
3462     Create the _SatelliteAssemblyResourceInputs list of inputs to the CreateSatelliteAssemblies target.
3463     ============================================================
3464     -->
3465   <Target Name="_GenerateSatelliteAssemblyInputs">
3466
3467     <Warning Condition="'@(ManifestResourceWithCulture)'!='' and '%(ManifestResourceWithCulture.EmittedForCompatibilityOnly)'==''" Code="MSB9006" Text="ManifestResourceWithCulture item type is deprecated. Emit EmbeddedResource items instead, with metadata WithCulture='true', Type='Resx', and optional LogicalName."/>
3468     <Warning Condition="'@(ManifestNonResxWithCultureOnDisk)'!='' and '%(ManifestNonResxWithCultureOnDisk.EmittedForCompatibilityOnly)'==''" Code="MSB9007" Text="ManifestNonResxWithCultureOnDisk item type is deprecated. Emit EmbeddedResource items instead, with metadata WithCulture='true', Type='Non-Resx', and optional LogicalName."/>
3469
3470     <ItemGroup>
3471       <!-- _SatelliteAssemblyResourceInputs is the list of TLDA inputs that should trigger CreateSatelliteAssemblies, so listed as inputs to that target -->
3472       <_SatelliteAssemblyResourceInputs Include="@(EmbeddedResource->'%(OutputResource)')" Condition="'%(EmbeddedResource.WithCulture)' == 'true' and '%(EmbeddedResource.Type)' == 'Resx'" />
3473       <_SatelliteAssemblyResourceInputs Include="@(EmbeddedResource)" Condition="'%(EmbeddedResource.WithCulture)' == 'true' and '%(EmbeddedResource.Type)' == 'Non-Resx'" />
3474
3475       <!-- CONSUMED FOR COMPATIBILITY REASONS ONLY. EMIT EMBEDDEDRESOURCE INSTEAD -->
3476       <_SatelliteAssemblyResourceInputs Include="@(ManifestResourceWithCulture)" Condition="'%(ManifestResourceWithCulture.EmittedForCompatibilityOnly)'==''">
3477         <Type>Resx</Type>
3478         <WithCulture>true</WithCulture>
3479       </_SatelliteAssemblyResourceInputs>
3480       <_SatelliteAssemblyResourceInputs Include="@(ManifestNonResxWithCultureOnDisk)" Condition="'%(ManifestNonResxWithCultureOnDisk.EmittedForCompatibilityOnly)'==''">
3481         <Type>Non-Resx</Type>
3482         <WithCulture>true</WithCulture>
3483       </_SatelliteAssemblyResourceInputs>
3484
3485     </ItemGroup>
3486   </Target>
3487
3488   <!--
3489     ============================================================
3490                                         GenerateSatelliteAssemblies
3491
3492     Actually run al.exe to create the satellite assemblies.
3493     ============================================================
3494     -->
3495   <Target Name="GenerateSatelliteAssemblies"
3496           Inputs="$(MSBuildAllProjects);@(_SatelliteAssemblyResourceInputs);$(IntermediateOutputPath)$(TargetName)$(TargetExt)"
3497           Outputs="$(IntermediateOutputPath)%(Culture)\$(TargetName).resources.dll"
3498           Condition="'@(_SatelliteAssemblyResourceInputs)' != '' and '$(MSBuildRuntimeType)' != 'Core'">
3499
3500     <MakeDir
3501         Directories="@(EmbeddedResource->'$(IntermediateOutputPath)%(Culture)')" />
3502
3503     <AL AlgorithmId="$(Satellite_AlgorithmId)"
3504         BaseAddress="$(Satellite_BaseAddress)"
3505         CompanyName="$(Satellite_CompanyName)"
3506         Configuration="$(Satellite_Configuration)"
3507         Copyright="$(Satellite_Copyright)"
3508         Culture="%(Culture)"
3509         DelaySign="$(DelaySign)"
3510         Description="$(Satellite_Description)"
3511         EmbedResources="@(_SatelliteAssemblyResourceInputs)"
3512         EnvironmentVariables="$(AlEnvironment)"
3513         EvidenceFile="$(Satellite_EvidenceFile)"
3514         FileVersion="$(Satellite_FileVersion)"
3515         Flags="$(Satellite_Flags)"
3516         GenerateFullPaths="$(Satellite_GenerateFullPaths)"
3517         KeyContainer="$(KeyContainerName)"
3518         KeyFile="$(KeyOriginatorFile)"
3519         LinkResources="@(Satellite_LinkResource)"
3520         MainEntryPoint="$(Satellite_MainEntryPoint)"
3521         OutputAssembly="$(IntermediateOutputPath)%(Culture)\$(TargetName).resources.dll"
3522         Platform="$(PlatformTarget)"
3523         ProductName="$(Satellite_ProductName)"
3524         ProductVersion="$(Satellite_ProductVersion)"
3525         ResponseFiles="@(AlResponseFile)"
3526         SourceModules="@(Satellite_SourceModule)"
3527         TargetType="$(Satellite_TargetType)"
3528         TemplateFile="$(IntermediateOutputPath)$(TargetName)$(TargetExt)"
3529         Title="$(Satellite_Title)"
3530         ToolPath="$(AlToolPath)"
3531         ToolExe ="$(AlToolExe)"
3532         SdkToolsPath="$(TargetFrameworkSDKToolsDirectory)"
3533         Trademark="$(Satellite_Trademark)"
3534         Version="$(Satellite_Version)"
3535         Win32Icon="$(Satellite_Win32Icon)"
3536         Win32Resource="$(Satellite_Win32Resource)">
3537
3538       <Output TaskParameter="OutputAssembly" ItemName="FileWrites"/>
3539
3540     </AL>
3541
3542   </Target>
3543   <!--
3544     ============================================================
3545                                         ComputeIntermediateSatelliteAssemblies
3546
3547     Compute the paths to the intermediate satellite assemblies,
3548     with culture attributes so we can copy them to the right place.
3549     ============================================================
3550     -->
3551   <PropertyGroup>
3552     <ComputeIntermediateSatelliteAssembliesDependsOn>
3553       CreateManifestResourceNames
3554     </ComputeIntermediateSatelliteAssembliesDependsOn>
3555   </PropertyGroup>
3556   <Target
3557       Name="ComputeIntermediateSatelliteAssemblies"
3558       Condition="@(EmbeddedResource->'%(WithCulture)') != ''"
3559       DependsOnTargets="$(ComputeIntermediateSatelliteAssembliesDependsOn)">
3560
3561     <ItemGroup>
3562       <IntermediateSatelliteAssembliesWithTargetPath Include="$(IntermediateOutputPath)%(EmbeddedResource.Culture)\$(TargetName).resources.dll"
3563                                                      Condition="'%(EmbeddedResource.Culture)' != ''">
3564         <Culture>%(EmbeddedResource.Culture)</Culture>
3565         <TargetPath>%(EmbeddedResource.Culture)\$(TargetName).resources.dll</TargetPath>
3566       </IntermediateSatelliteAssembliesWithTargetPath>
3567     </ItemGroup>
3568   </Target>
3569
3570   <!--
3571     ***********************************************************************************************
3572     ***********************************************************************************************
3573                                                                 SetWin32ManifestProperties Section
3574     ***********************************************************************************************
3575     ***********************************************************************************************
3576     -->
3577
3578   <PropertyGroup>
3579     <EmbeddedWin32Manifest>$(Win32Manifest)</EmbeddedWin32Manifest>
3580   </PropertyGroup>
3581
3582   <!--
3583     ============================================================
3584                                         SetWin32ManifestProperties
3585
3586     Set Win32Manifest and EmbeddedManifest properties to be used later in the build.
3587     ============================================================
3588     -->
3589   <Target
3590       Name="SetWin32ManifestProperties"
3591       Condition="'$(Win32Manifest)'==''"
3592       DependsOnTargets="ResolveComReferences;ResolveNativeReferences;_SetExternalWin32ManifestProperties;_SetEmbeddedWin32ManifestProperties" />
3593
3594   <Target
3595       Name="_SetExternalWin32ManifestProperties"
3596       Condition="'$(GenerateClickOnceManifests)'=='true' or '@(NativeReference)'!='' or '@(ResolvedIsolatedComModules)'!=''" >
3597
3598     <PropertyGroup>
3599       <!-- set _DeploymentBaseManifest property to the value of $(ApplicationManifest) if the property is set,
3600                  but use _DeploymentBaseManifestWithTargetPath item-group if the property is not set to support backwards
3601                  compat with earlier MSBuild versions when manifest files were determined by the item-group. If the newer
3602                  property is set though, prefer that one be used to specify the manifest. -->
3603       <_DeploymentBaseManifest>$(ApplicationManifest)</_DeploymentBaseManifest>
3604       <_DeploymentBaseManifest Condition="'$(_DeploymentBaseManifest)'==''">@(_DeploymentBaseManifestWithTargetPath)</_DeploymentBaseManifest>
3605
3606       <!-- when using external manifests, always set the NoWin32Manifest property to
3607                  true if there is no value set in the incoming project file so the
3608                  compilers that support manifest embedding know not to add
3609                  a manifest to their built assemblies -->
3610       <NoWin32Manifest Condition="'$(NoWin32Manifest)'==''">true</NoWin32Manifest>
3611     </PropertyGroup>
3612
3613   </Target>
3614
3615   <Target
3616       Name="_SetEmbeddedWin32ManifestProperties"
3617       Condition="'$(GenerateClickOnceManifests)'!='true' and '@(NativeReference)'=='' and '@(ResolvedIsolatedComModules)'==''" >
3618
3619     <PropertyGroup>
3620       <EmbeddedWin32Manifest>$(ApplicationManifest)</EmbeddedWin32Manifest>
3621       <Win32Manifest>$(ApplicationManifest)</Win32Manifest>
3622     </PropertyGroup>
3623
3624     <GetFrameworkPath Condition="'$(ApplicationManifest)'=='' and '$(NoWin32Manifest)'!='true'">
3625       <Output TaskParameter="FrameworkVersion40Path"  PropertyName="_FrameworkVersion40Path" />
3626     </GetFrameworkPath>
3627
3628     <PropertyGroup>
3629       <EmbeddedWin32Manifest  Condition="'$(ApplicationManifest)'=='' and '$(NoWin32Manifest)'!='true' and Exists('$(_FrameworkVersion40Path)\default.win32manifest')">$(_FrameworkVersion40Path)\default.win32manifest</EmbeddedWin32Manifest>
3630     </PropertyGroup>
3631
3632   </Target>
3633
3634
3635
3636
3637   <!--
3638     ***********************************************************************************************
3639     ***********************************************************************************************
3640                                                                 GenerateManifests Section
3641     ***********************************************************************************************
3642     ***********************************************************************************************
3643     -->
3644
3645   <!--
3646     ============================================================
3647                                         GenerateManifests
3648
3649     Generates ClickOnce application and deployment manifests or a native manifest.
3650     ============================================================
3651     -->
3652   <PropertyGroup>
3653     <GenerateManifestsDependsOn>
3654       SetWin32ManifestProperties;
3655       GenerateApplicationManifest;
3656       GenerateDeploymentManifest
3657     </GenerateManifestsDependsOn>
3658   </PropertyGroup>
3659
3660   <!--
3661     ============================================================
3662                   _GenerateResolvedDeploymentManifestEntryPoint
3663
3664     Use the ResolveManifestFiles to generate the GenerateResolvedDeploymentManifestEntryPoint
3665
3666     ============================================================
3667     -->
3668   <Target
3669       Name="_GenerateResolvedDeploymentManifestEntryPoint">
3670     <ItemGroup>
3671       <_DeploymentPublishFileOfTypeManifestEntryPoint Include="@(PublishFile)" Condition="'%(FileType)'=='ManifestEntryPoint'"/>
3672     </ItemGroup>
3673
3674     <ResolveManifestFiles
3675         TargetFrameworkVersion="$(TargetFrameworkVersion)"
3676         SigningManifests="$(SignManifests)"
3677         DeploymentManifestEntryPoint="@(ApplicationManifest)"
3678         PublishFiles="@(_DeploymentPublishFileOfTypeManifestEntryPoint)">
3679
3680       <Output TaskParameter="OutputDeploymentManifestEntryPoint" ItemName="_DeploymentResolvedDeploymentManifestEntryPoint"/>
3681
3682     </ResolveManifestFiles>
3683   </Target>
3684
3685   <Target
3686       Name="GenerateManifests"
3687       Condition="'$(GenerateClickOnceManifests)'=='true' or '@(NativeReference)'!='' or '@(ResolvedIsolatedComModules)'!='' or '$(GenerateAppxManifest)' == 'true'"
3688       DependsOnTargets="$(GenerateManifestsDependsOn)"/>
3689
3690   <!--
3691     ============================================================
3692                                         GenerateApplicationManifest
3693
3694     Generates a ClickOnce or native application manifest.
3695     An application manifest specifies declarative application identity, dependency and security information.
3696
3697         [IN]
3698         $(_DeploymentBaseManifest) - The base app.manifest from project.
3699         @(ResolvedIsolatedComModules) - The list of COM references to be isolated as reg-free COM dependencies for native assembly loader.
3700         @(_DeploymentManifestFiles) - The list of loose files (content, pdb, xml, etc.) for ClickOnce.
3701         @(_DeploymentManifestDependencies) - The list of application dependencies (typically this is the set of assembly dependencies in bin\) for ClickOnce.
3702         @(AppConfigWithTargetPath) - App config file, if present.
3703         $(_DeploymentManifestType) - Type of manifest to be generated, either "Native" or "ClickOnce".
3704
3705         [OUT]
3706         @(ApplicationManifest) - Generated native or ClickOnce application manifest, i.e. WindowsApplication1.exe.manifest
3707     ============================================================
3708     -->
3709   <Target
3710       Name="GenerateApplicationManifest"
3711       DependsOnTargets="
3712             _DeploymentComputeNativeManifestInfo;
3713             _DeploymentComputeClickOnceManifestInfo;
3714             ResolveComReferences;
3715             ResolveNativeReferences;
3716             _GenerateResolvedDeploymentManifestEntryPoint"
3717       Inputs="
3718             $(MSBuildAllProjects);
3719             @(AppConfigWithTargetPath);
3720             $(_DeploymentBaseManifest);
3721             @(ResolvedIsolatedComModules);
3722             @(_DeploymentManifestDependencies);
3723             @(_DeploymentResolvedManifestEntryPoint);
3724             @(_DeploymentManifestFiles)"
3725       Outputs="@(ApplicationManifest)">
3726
3727     <RequiresFramework35SP1Assembly
3728       ReferencedAssemblies="@(Reference)"
3729         ErrorReportUrl="$(_DeploymentFormattedErrorReportUrl)"
3730         TargetFrameworkVersion="$(TargetFrameworkVersion)"
3731         CreateDesktopShortcut="$(CreateDesktopShortcut)"
3732         SigningManifests="$(SignManifests)"
3733         Assemblies="@(_DeploymentManifestDependencies)"
3734         DeploymentManifestEntryPoint="@(_DeploymentResolvedDeploymentManifestEntryPoint)"
3735         EntryPoint="@(_DeploymentResolvedManifestEntryPoint)"
3736         Files="@(_DeploymentManifestFiles)"
3737         SuiteName="$(SuiteName)" >
3738
3739       <Output TaskParameter="RequiresMinimumFramework35SP1" PropertyName="_DeploymentRequiresMinimumFramework35SP1" />
3740     </RequiresFramework35SP1Assembly>
3741
3742     <GenerateApplicationManifest
3743         AssemblyName="$(_DeploymentApplicationManifestIdentity)"
3744         AssemblyVersion="$(_DeploymentManifestVersion)"
3745         ConfigFile="@(AppConfigWithTargetPath)"
3746         ClrVersion="$(ClrVersion)"
3747         Dependencies="@(_DeploymentManifestDependencies)"
3748         Description="$(Description)"
3749         EntryPoint="@(_DeploymentResolvedManifestEntryPoint)"
3750         ErrorReportUrl="$(_DeploymentFormattedErrorReportUrl)"
3751         FileAssociations="@(FileAssociation)"
3752         Files="@(_DeploymentManifestFiles)"
3753         HostInBrowser="$(HostInBrowser)"
3754         IconFile="@(_DeploymentManifestIconFile)"
3755         InputManifest="$(_DeploymentBaseManifest)"
3756         IsolatedComReferences="@(ResolvedIsolatedComModules)"
3757         ManifestType="$(_DeploymentManifestType)"
3758         MaxTargetPath="$(MaxTargetPath)"
3759         OutputManifest="@(ApplicationManifest)"
3760         OSVersion="$(OSVersion)"
3761         Platform="$(PlatformTarget)"
3762         Product="$(ProductName)"
3763         Publisher="$(PublisherName)"
3764         RequiresMinimumFramework35SP1="$(_DeploymentRequiresMinimumFramework35SP1)"
3765         SuiteName="$(SuiteName)"
3766         SupportUrl="$(_DeploymentFormattedSupportUrl)"
3767         TargetCulture="$(TargetCulture)"
3768         TargetFrameworkSubset="$(TargetFrameworkSubset)"
3769         TargetFrameworkProfile="$(TargetFrameworkProfile)"
3770         TargetFrameworkVersion="$(TargetFrameworkVersion)"
3771         TrustInfoFile="@(_DeploymentIntermediateTrustInfoFile)"
3772         UseApplicationTrust="$(UseApplicationTrust)">
3773
3774       <Output TaskParameter="OutputManifest" ItemName="FileWrites"/>
3775
3776     </GenerateApplicationManifest>
3777
3778     <PropertyGroup>
3779       <_DeploymentCopyApplicationManifest>true</_DeploymentCopyApplicationManifest>
3780     </PropertyGroup>
3781
3782   </Target>
3783
3784   <!--
3785     ============================================================
3786                                         _DeploymentComputeNativeManifestInfo
3787
3788     Compute info for native manifest generation
3789     ============================================================
3790     -->
3791   <Target
3792       Name="_DeploymentComputeNativeManifestInfo"
3793       Condition="'$(GenerateClickOnceManifests)'!='true'">
3794
3795     <!-- Create list of items for manifest generation -->
3796     <ResolveManifestFiles NativeAssemblies="@(NativeReferenceFile);@(_DeploymentNativePrerequisite)">
3797       <Output TaskParameter="OutputAssemblies" ItemName="_DeploymentManifestDependencies"/>
3798     </ResolveManifestFiles>
3799
3800     <PropertyGroup>
3801       <_DeploymentManifestType>Native</_DeploymentManifestType>
3802     </PropertyGroup>
3803
3804     <!-- Obtain manifest version from the built assembly -->
3805     <GetAssemblyIdentity AssemblyFiles="@(IntermediateAssembly)">
3806       <Output TaskParameter="Assemblies" ItemName="_IntermediateAssemblyIdentity"/>
3807     </GetAssemblyIdentity>
3808
3809     <PropertyGroup>
3810       <_DeploymentManifestVersion>@(_IntermediateAssemblyIdentity->'%(Version)')</_DeploymentManifestVersion>
3811     </PropertyGroup>
3812
3813   </Target>
3814
3815   <!--
3816     ============================================================
3817                                         _DeploymentComputeClickOnceManifestInfo
3818
3819     Compute info for  ClickOnce manifest generation
3820     ============================================================
3821     -->
3822   <Target
3823       Name="_DeploymentComputeClickOnceManifestInfo"
3824       Condition="'$(GenerateClickOnceManifests)'=='true'"
3825       DependsOnTargets="
3826             CleanPublishFolder;
3827             _DeploymentGenerateTrustInfo">
3828
3829     <!-- Grab just the serialization assemblies for a referenced assembly.  There may also be a symbols file in ReferenceRelatedPaths -->
3830     <ItemGroup>
3831       <_SGenDllsRelatedToCurrentDll Include="@(_ReferenceSerializationAssemblyPaths->'%(FullPath)')" Condition="'%(Extension)' == '.dll'"/>
3832       <_SGenDllsRelatedToCurrentDll Include="@(SerializationAssembly->'%(FullPath)')" Condition="'%(Extension)' == '.dll'"/>
3833     </ItemGroup>
3834
3835     <!-- Flag primary dependencies-certain warnings emitted during application manifest generation apply only to them. -->
3836     <ItemGroup>
3837       <_DeploymentReferencePaths Include="@(ReferencePath)">
3838         <IsPrimary>true</IsPrimary>
3839       </_DeploymentReferencePaths>
3840     </ItemGroup>
3841
3842     <!-- Copy the application executable from Obj folder to app.publish folder.
3843     This is being done to avoid Windows Forms designer memory issues that can arise while operating directly on files located in Obj directory. -->
3844     <Copy
3845       SourceFiles="@(_DeploymentManifestEntryPoint)"
3846       DestinationFolder="$(PublishDir)">
3847
3848       <Output TaskParameter="DestinationFiles" ItemName="_DeploymentClickOnceApplicationExecutable" />
3849     </Copy>
3850
3851     <!-- Sign the application executable located in app.publish folder.  Signing this file is done to comply with SmartScreen. -->
3852     <SignFile
3853       CertificateThumbprint="$(_DeploymentResolvedManifestCertificateThumbprint)"
3854       TimestampUrl="$(ManifestTimestampUrl)"
3855       SigningTarget="@(_DeploymentClickOnceApplicationExecutable)"
3856       Condition="'$(_DeploymentResolvedManifestCertificateThumbprint)'!='' and '$(_DeploymentSignClickOnceManifests)'=='true' and '$(TargetExt)' == '.exe'"
3857       />
3858
3859     <!-- Create list of items for manifest generation -->
3860     <ResolveManifestFiles
3861         TargetFrameworkVersion="$(TargetFrameworkVersion)"
3862         SigningManifests="$(SignManifests)"
3863         EntryPoint="@(_DeploymentClickOnceApplicationExecutable)"
3864         ExtraFiles="@(_DebugSymbolsIntermediatePath);$(IntermediateOutputPath)$(TargetName).xml;@(_ReferenceRelatedPaths)"
3865         Files="@(ContentWithTargetPath);@(_DeploymentManifestIconFile);@(AppConfigWithTargetPath)"
3866         ManagedAssemblies="@(_DeploymentReferencePaths);@(ReferenceDependencyPaths);@(_SGenDllsRelatedToCurrentDll);@(SerializationAssembly)"
3867         NativeAssemblies="@(NativeReferenceFile);@(_DeploymentNativePrerequisite)"
3868         PublishFiles="@(PublishFile)"
3869         SatelliteAssemblies="@(IntermediateSatelliteAssembliesWithTargetPath);@(ReferenceSatellitePaths)"
3870         TargetCulture="$(TargetCulture)">
3871
3872       <Output TaskParameter="OutputAssemblies" ItemName="_DeploymentManifestDependencies"/>
3873       <Output TaskParameter="OutputFiles" ItemName="_DeploymentManifestFiles"/>
3874       <Output TaskParameter="OutputEntryPoint" ItemName="_DeploymentResolvedManifestEntryPoint"/>
3875
3876     </ResolveManifestFiles>
3877
3878     <PropertyGroup>
3879       <_DeploymentManifestType>ClickOnce</_DeploymentManifestType>
3880     </PropertyGroup>
3881
3882     <!-- Obtain manifest version from ApplicationVersion and ApplicationRevision properties -->
3883     <FormatVersion Version="$(ApplicationVersion)" Revision="$(ApplicationRevision)">
3884       <Output TaskParameter="OutputVersion" PropertyName="_DeploymentManifestVersion"/>
3885     </FormatVersion>
3886
3887     <FormatUrl InputUrl="$(_DeploymentUrl)">
3888       <Output TaskParameter="OutputUrl" PropertyName="_DeploymentFormattedDeploymentUrl"/>
3889     </FormatUrl>
3890
3891     <FormatUrl InputUrl="$(SupportUrl)">
3892       <Output TaskParameter="OutputUrl" PropertyName="_DeploymentFormattedSupportUrl"/>
3893     </FormatUrl>
3894
3895     <FormatUrl InputUrl="$(ErrorReportUrl)">
3896       <Output TaskParameter="OutputUrl" PropertyName="_DeploymentFormattedErrorReportUrl"/>
3897     </FormatUrl>
3898
3899   </Target>
3900
3901   <!--
3902     ============================================================
3903                                         _DeploymentGenerateTrustInfo
3904
3905     Generates the application permission set for inclusion in the generated ClickOnce application manifest.
3906     ============================================================
3907     -->
3908   <Target
3909       Name="_DeploymentGenerateTrustInfo"
3910       Condition="'$(TargetZone)'!=''"
3911       Inputs="
3912             $(MSBuildAllProjects);
3913             $(_DeploymentBaseManifest);
3914             "
3915       Outputs="@(_DeploymentIntermediateTrustInfoFile)">
3916
3917     <GenerateTrustInfo
3918         BaseManifest="$(_DeploymentBaseManifest)"
3919         ApplicationDependencies="@(ReferencePath);@(ReferenceDependencyPaths)"
3920         ExcludedPermissions="$(ExcludedPermissions)"
3921         TargetFrameworkMoniker="$(TargetFrameworkMoniker)"
3922         TargetZone="$(TargetZone)"
3923         TrustInfoFile="@(_DeploymentIntermediateTrustInfoFile)">
3924
3925       <Output TaskParameter="TrustInfoFile" ItemName="FileWrites"/>
3926
3927     </GenerateTrustInfo>
3928
3929   </Target>
3930
3931   <!--
3932     ============================================================
3933                                         GenerateDeploymentManifest
3934
3935     Generates a ClickOnce deployment manifest.
3936     An deployment manifest specifies declarative application identity and application update information.
3937     ============================================================
3938     -->
3939   <Target
3940       Name="GenerateDeploymentManifest"
3941       DependsOnTargets="GenerateApplicationManifest"
3942       Inputs="
3943             $(MSBuildAllProjects);
3944             @(ApplicationManifest)
3945             "
3946       Outputs="@(DeployManifest)">
3947
3948     <GenerateDeploymentManifest
3949           AssemblyName="$(_DeploymentDeployManifestIdentity)"
3950           AssemblyVersion="$(_DeploymentManifestVersion)"
3951           CreateDesktopShortcut="$(CreateDesktopShortcut)"
3952           DeploymentUrl="$(_DeploymentFormattedDeploymentUrl)"
3953           Description="$(Description)"
3954           DisallowUrlActivation="$(DisallowUrlActivation)"
3955           EntryPoint="@(_DeploymentResolvedDeploymentManifestEntryPoint)"
3956           ErrorReportUrl="$(_DeploymentFormattedErrorReportUrl)"
3957           Install="$(Install)"
3958           MapFileExtensions="$(MapFileExtensions)"
3959           MaxTargetPath="$(MaxTargetPath)"
3960           MinimumRequiredVersion="$(_DeploymentBuiltMinimumRequiredVersion)"
3961           OutputManifest="@(DeployManifest)"
3962           Platform="$(PlatformTarget)"
3963           Product="$(ProductName)"
3964           Publisher="$(PublisherName)"
3965           SuiteName="$(SuiteName)"
3966           SupportUrl="$(_DeploymentFormattedSupportUrl)"
3967           TargetCulture="$(TargetCulture)"
3968           TargetFrameworkVersion="$(TargetFrameworkVersion)"
3969           TargetFrameworkMoniker="$(TargetFrameworkMoniker)"
3970           TrustUrlParameters="$(TrustUrlParameters)"
3971           UpdateEnabled="$(UpdateEnabled)"
3972           UpdateInterval="$(_DeploymentBuiltUpdateInterval)"
3973           UpdateMode="$(UpdateMode)"
3974           UpdateUnit="$(_DeploymentBuiltUpdateIntervalUnits)"
3975           Condition="'$(GenerateClickOnceManifests)'=='true'">
3976
3977       <Output TaskParameter="OutputManifest" ItemName="FileWrites"/>
3978
3979     </GenerateDeploymentManifest>
3980
3981   </Target>
3982
3983
3984
3985
3986   <!--
3987     ***********************************************************************************************
3988     ***********************************************************************************************
3989                                                                 PrepareForRun Section
3990     ***********************************************************************************************
3991     ***********************************************************************************************
3992     -->
3993
3994   <PropertyGroup>
3995     <SkipCopyUnchangedFiles Condition="'$(SkipCopyUnchangedFiles)' == ''">true</SkipCopyUnchangedFiles>
3996     <UseCommonOutputDirectory Condition="'$(UseCommonOutputDirectory)' == ''">false</UseCommonOutputDirectory>
3997   </PropertyGroup>
3998
3999   <!--
4000     ============================================================
4001                                         PrepareForRun
4002
4003     Copy the build outputs to the final directory if they have changed.
4004     ============================================================
4005     -->
4006   <PropertyGroup>
4007     <PrepareForRunDependsOn>
4008       CopyFilesToOutputDirectory
4009     </PrepareForRunDependsOn>
4010   </PropertyGroup>
4011   <Target
4012       Name="PrepareForRun"
4013       DependsOnTargets="$(PrepareForRunDependsOn)"/>
4014
4015   <!--
4016     ============================================================
4017                                         CopyFilesToOutputDirectory
4018
4019     Copy all build outputs, satellites and other necessary files to the final directory.
4020     ============================================================
4021     -->
4022   <PropertyGroup>
4023     <!-- By default we're not using Hard or Symbolic Links to copy to the output directory, and never when building in VS -->
4024     <CreateHardLinksForCopyAdditionalFilesIfPossible Condition="'$(BuildingInsideVisualStudio)' == 'true' or '$(CreateHardLinksForCopyAdditionalFilesIfPossible)' == ''">false</CreateHardLinksForCopyAdditionalFilesIfPossible>
4025     <CreateSymbolicLinksForCopyAdditionalFilesIfPossible Condition="'$(BuildingInsideVisualStudio)' == 'true' or '$(CreateSymbolicLinksForCopyAdditionalFilesIfPossible)' == ''">false</CreateSymbolicLinksForCopyAdditionalFilesIfPossible>
4026   </PropertyGroup>
4027
4028   <Target
4029       Name="CopyFilesToOutputDirectory"
4030       DependsOnTargets="
4031             ComputeIntermediateSatelliteAssemblies;
4032             _CopyFilesMarkedCopyLocal;
4033             _CopySourceItemsToOutputDirectory;
4034             _CopyAppConfigFile;
4035             _CopyManifestFiles;
4036             _CheckForCompileOutputs;
4037             _SGenCheckForOutputs">
4038
4039     <PropertyGroup>
4040       <!-- By default we're not using Hard Links to copy to the output directory, and never when building in VS -->
4041       <CreateHardLinksForCopyFilesToOutputDirectoryIfPossible Condition="'$(BuildingInsideVisualStudio)' == 'true' or '$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)' == ''">false</CreateHardLinksForCopyFilesToOutputDirectoryIfPossible>
4042       <CreateSymbolicLinksForCopyFilesToOutputDirectoryIfPossible Condition="'$(BuildingInsideVisualStudio)' == 'true' or '$(CreateSymbolicLinksForCopyFilesToOutputDirectoryIfPossible)' == ''">false</CreateSymbolicLinksForCopyFilesToOutputDirectoryIfPossible>
4043     </PropertyGroup>
4044
4045     <PropertyGroup>
4046       <CopyBuildOutputToOutputDirectory Condition="'$(CopyBuildOutputToOutputDirectory)'==''">true</CopyBuildOutputToOutputDirectory>
4047       <CopyOutputSymbolsToOutputDirectory Condition="'$(CopyOutputSymbolsToOutputDirectory)'==''">true</CopyOutputSymbolsToOutputDirectory>
4048     </PropertyGroup>
4049
4050     <!-- Copy the build product (.dll or .exe). -->
4051     <Copy
4052         SourceFiles="@(IntermediateAssembly)"
4053         DestinationFolder="$(OutDir)"
4054         SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
4055         OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
4056         Retries="$(CopyRetryCount)"
4057         RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
4058         UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)"
4059         UseSymboliclinksIfPossible="$(CreateSymbolicLinksForCopyFilesToOutputDirectoryIfPossible)"
4060         Condition="'$(CopyBuildOutputToOutputDirectory)' == 'true' and '$(SkipCopyBuildProduct)' != 'true'"
4061             >
4062
4063       <Output TaskParameter="DestinationFiles" ItemName="MainAssembly"/>
4064       <Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
4065
4066     </Copy>
4067
4068     <!-- Copy the reference assembly build product (.dll or .exe). -->
4069     <CopyRefAssembly
4070         SourcePath="@(IntermediateRefAssembly)"
4071         DestinationPath="$(TargetRefPath)"
4072         Condition="'$(ProduceReferenceAssembly)' == 'true' and '$(CopyBuildOutputToOutputDirectory)' == 'true' and '$(SkipCopyBuildProduct)' != 'true'"
4073             >
4074
4075       <Output TaskParameter="DestinationPath" ItemName="ReferenceAssembly"/>
4076       <Output TaskParameter="DestinationPath" ItemName="FileWrites"/>
4077
4078     </CopyRefAssembly>
4079
4080     <Message Importance="High" Text="$(MSBuildProjectName) -&gt; @(MainAssembly->'%(FullPath)')" Condition="'$(CopyBuildOutputToOutputDirectory)' == 'true' and '$(SkipCopyBuildProduct)'!='true'" />
4081
4082     <!-- Copy the additional modules. -->
4083     <Copy
4084         SourceFiles="@(AddModules)"
4085         DestinationFolder="$(OutDir)"
4086         SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
4087         OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
4088         Retries="$(CopyRetryCount)"
4089         RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
4090         UseHardlinksIfPossible="$(CreateHardLinksForCopyAdditionalFilesIfPossible)"
4091         UseSymboliclinksIfPossible="$(CreateSymbolicLinksForCopyAdditionalFilesIfPossible)"
4092         Condition="'@(AddModules)' != ''"
4093             >
4094
4095       <Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
4096
4097     </Copy>
4098
4099     <!-- Copy the serialization assembly if it exists. -->
4100     <Copy
4101         SourceFiles="$(IntermediateOutputPath)$(_SGenDllName)"
4102         DestinationFiles="$(OutDir)$(_SGenDllName)"
4103         SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
4104         OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
4105         Retries="$(CopyRetryCount)"
4106         RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
4107         UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)"
4108         UseSymboliclinksIfPossible="$(CreateSymbolicLinksForCopyFilesToOutputDirectoryIfPossible)"
4109         Condition="'$(_SGenDllCreated)'=='true'">
4110
4111       <Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
4112
4113     </Copy>
4114
4115     <!-- Copy the debug information file (.pdb), if any -->
4116     <Copy
4117         SourceFiles="@(_DebugSymbolsIntermediatePath)"
4118         DestinationFiles="@(_DebugSymbolsOutputPath)"
4119         SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
4120         OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
4121         Retries="$(CopyRetryCount)"
4122         RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
4123         UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)"
4124         UseSymboliclinksIfPossible="$(CreateSymbolicLinksForCopyFilesToOutputDirectoryIfPossible)"
4125         Condition="'$(_DebugSymbolsProduced)'=='true' and '$(SkipCopyingSymbolsToOutputDirectory)' != 'true' and '$(CopyOutputSymbolsToOutputDirectory)'=='true'">
4126
4127       <Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
4128
4129     </Copy>
4130
4131     <!-- Copy the resulting XML documentation file, if any. -->
4132     <Copy
4133         SourceFiles="@(DocFileItem)"
4134         DestinationFiles="@(FinalDocFile)"
4135         SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
4136         OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
4137         Retries="$(CopyRetryCount)"
4138         RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
4139         UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)"
4140         UseSymboliclinksIfPossible="$(CreateSymbolicLinksForCopyFilesToOutputDirectoryIfPossible)"
4141         Condition="'$(_DocumentationFileProduced)'=='true'">
4142
4143       <Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
4144
4145     </Copy>
4146
4147     <!-- Copy satellite assemblies. -->
4148     <Copy
4149         SourceFiles="@(IntermediateSatelliteAssembliesWithTargetPath)"
4150         DestinationFiles="@(IntermediateSatelliteAssembliesWithTargetPath->'$(OutDir)%(Culture)\$(TargetName).resources.dll')"
4151         SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
4152         OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
4153         Retries="$(CopyRetryCount)"
4154         RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
4155         UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)"
4156         UseSymboliclinksIfPossible="$(CreateSymbolicLinksForCopyFilesToOutputDirectoryIfPossible)"
4157         Condition="'@(IntermediateSatelliteAssembliesWithTargetPath)' != ''"
4158             >
4159
4160       <Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
4161
4162     </Copy>
4163
4164     <!--
4165         Copy COM reference wrappers, isolated COM references, COM references included by
4166         native (manifest) references, native (manifest) reference files themselves.
4167         -->
4168     <Copy
4169         SourceFiles="@(ReferenceComWrappersToCopyLocal); @(ResolvedIsolatedComModules); @(_DeploymentLooseManifestFile); @(NativeReferenceFile)"
4170         DestinationFolder="$(OutDir)"
4171         SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
4172         OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
4173         Retries="$(CopyRetryCount)"
4174         RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
4175         UseHardlinksIfPossible="$(CreateHardLinksForCopyAdditionalFilesIfPossible)"
4176         UseSymboliclinksIfPossible="$(CreateSymbolicLinksForCopyAdditionalFilesIfPossible)"
4177         Condition="'@(ReferenceComWrappersToCopyLocal)' != '' or '@(ResolvedIsolatedComModules)' != '' or '@(_DeploymentLooseManifestFile)' != '' or '@(NativeReferenceFile)' != '' "
4178             >
4179
4180       <Output TaskParameter="DestinationFiles" ItemName="FileWritesShareable"/>
4181
4182     </Copy>
4183
4184     <!-- Copy the build product of WinMDExp. -->
4185     <Copy
4186         SourceFiles="@(WinMDExpArtifacts)"
4187         DestinationFolder="$(OutDir)"
4188         SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
4189         OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
4190         Retries="$(CopyRetryCount)"
4191         RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
4192         UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)"
4193         UseSymboliclinksIfPossible="$(CreateSymbolicLinksForCopyFilesToOutputDirectoryIfPossible)"
4194         Condition="'$(SkipCopyWinMDArtifact)' != 'true' and '@(WinMDExpArtifacts)' != ''"
4195             >
4196       <Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
4197       <Output TaskParameter="DestinationFiles" ItemName="FinalWinmdExpArtifacts" />
4198     </Copy>
4199
4200     <Message Importance="High" Text="$(MSBuildProjectName) -&gt; $([System.IO.Path]::GetFullPath('$(_WindowsMetadataOutputPath)'))" Condition="'$(SkipCopyWinMDArtifact)' != 'true' and '$(_WindowsMetadataOutputPath)' != ''" />
4201
4202   </Target>
4203
4204   <!--
4205     ============================================================
4206                                         _CopyFilesMarkedCopyLocal
4207
4208     Copy references that are marked as "CopyLocal" and their dependencies, including .pdbs, .xmls and satellites.
4209     ============================================================
4210     -->
4211   <Target
4212       Name="_CopyFilesMarkedCopyLocal"
4213       Condition="'@(ReferenceCopyLocalPaths)' != ''"
4214         >
4215
4216     <PropertyGroup>
4217       <!-- By default we're not using Hard Links to copy to the output directory, and never when building in VS -->
4218       <CreateHardLinksForCopyLocalIfPossible Condition="'$(BuildingInsideVisualStudio)' == 'true' or '$(CreateHardLinksForCopyLocalIfPossible)' == ''">false</CreateHardLinksForCopyLocalIfPossible>
4219       <CreateSymbolicLinksForCopyLocalIfPossible Condition="'$(BuildingInsideVisualStudio)' == 'true' or '$(CreateSymbolicLinksForCopyLocalIfPossible)' == ''">false</CreateSymbolicLinksForCopyLocalIfPossible>
4220     </PropertyGroup>
4221
4222     <Copy
4223         SourceFiles="@(ReferenceCopyLocalPaths)"
4224         DestinationFiles="@(ReferenceCopyLocalPaths->'$(OutDir)%(DestinationSubDirectory)%(Filename)%(Extension)')"
4225         SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
4226         OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
4227         Retries="$(CopyRetryCount)"
4228         RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
4229         UseHardlinksIfPossible="$(CreateHardLinksForCopyLocalIfPossible)"
4230         UseSymboliclinksIfPossible="$(CreateSymbolicLinksForCopyLocalIfPossible)"
4231         Condition="'$(UseCommonOutputDirectory)' != 'true'"
4232             >
4233
4234       <Output TaskParameter="DestinationFiles" ItemName="FileWritesShareable"/>
4235       <Output TaskParameter="CopiedFiles" ItemName="ReferencesCopiedInThisBuild"/>
4236
4237     </Copy>
4238
4239     <!-- If this project produces reference assemblies *and* copied (possibly transitive)
4240          references on this build, subsequent builds of projects that depend on it must
4241          not be considered up to date, so touch this marker file that is considered an
4242          input to projects that reference this one. -->
4243     <Touch Files="@(CopyUpToDateMarker)"
4244            AlwaysCreate="true"
4245            Condition="'@(ReferencesCopiedInThisBuild)' != ''" />
4246
4247   </Target>
4248
4249   <!--
4250     ============================================================
4251                                         _CopySourceItemsToOutputDirectory
4252     ============================================================
4253     -->
4254   <Target
4255       Name="_CopySourceItemsToOutputDirectory"
4256       DependsOnTargets="
4257             GetCopyToOutputDirectoryItems;
4258             _CopyOutOfDateSourceItemsToOutputDirectory;
4259             _CopyOutOfDateSourceItemsToOutputDirectoryAlways"/>
4260
4261
4262   <!--
4263     ============================================================
4264                                         GetCopyToOutputDirectoryItems
4265
4266     Get all project items that may need to be transferred to the output directory.
4267     This includes baggage items from transitively referenced projects. It would appear
4268     that this target computes full transitive closure of content items for all referenced
4269     projects; however that is not the case. It only collects the content items from its
4270     immediate children and not children of children. The reason this happens is that
4271     the ProjectReferenceWithConfiguration list that is consumed by _SplitProjectReferencesByFileExistence
4272     is only populated in the current project and is empty in the children. The empty list
4273     causes _MSBuildProjectReferenceExistent to be empty and terminates the recursion.
4274     ============================================================
4275     -->
4276   <PropertyGroup>
4277     <GetCopyToOutputDirectoryItemsDependsOn>
4278       AssignTargetPaths;
4279       _SplitProjectReferencesByFileExistence;
4280       _GetProjectReferenceTargetFrameworkProperties
4281     </GetCopyToOutputDirectoryItemsDependsOn>
4282   </PropertyGroup>
4283   <Target
4284       Name="GetCopyToOutputDirectoryItems"
4285       Returns="@(AllItemsFullPathWithTargetPath)"
4286       KeepDuplicateOutputs=" '$(MSBuildDisableGetCopyToOutputDirectoryItemsOptimization)' == '' "
4287       DependsOnTargets="$(GetCopyToOutputDirectoryItemsDependsOn)">
4288
4289
4290     <!-- In the general case, clients need very little of the metadata which is generated by invoking this target on this project and its children.  For those
4291          cases, we can immediately discard the unwanted metadata, reducing memory usage, particularly in very large and interconnected systems of projects.
4292          However, if some client does require the original functionality, it is sufficient to set MSBuildDisableGetCopyToOutputDirectoryItemsOptimization to
4293          a non-empty value and the original behavior will be restored. -->
4294     <PropertyGroup Condition=" '$(MSBuildDisableGetCopyToOutputDirectoryItemsOptimization)' == '' ">
4295       <_GCTODIKeepDuplicates>false</_GCTODIKeepDuplicates>
4296       <_GCTODIKeepMetadata>CopyToOutputDirectory;TargetPath</_GCTODIKeepMetadata>
4297     </PropertyGroup>
4298
4299     <!-- Get items from child projects first. -->
4300     <MSBuild
4301         Projects="@(_MSBuildProjectReferenceExistent)"
4302         Targets="GetCopyToOutputDirectoryItems"
4303         BuildInParallel="$(BuildInParallel)"
4304         Properties="%(_MSBuildProjectReferenceExistent.SetConfiguration); %(_MSBuildProjectReferenceExistent.SetPlatform); %(_MSBuildProjectReferenceExistent.SetTargetFramework)"
4305         Condition="'@(_MSBuildProjectReferenceExistent)' != '' and '$(_GetChildProjectCopyToOutputDirectoryItems)' == 'true' and '%(_MSBuildProjectReferenceExistent.Private)' != 'false' and '$(UseCommonOutputDirectory)' != 'true'"
4306         ContinueOnError="$(ContinueOnError)"
4307         RemoveProperties="%(_MSBuildProjectReferenceExistent.GlobalPropertiesToRemove)">
4308
4309       <Output TaskParameter="TargetOutputs" ItemName="_AllChildProjectItemsWithTargetPath"/>
4310
4311     </MSBuild>
4312
4313     <!-- Target outputs must be full paths because they will be consumed by a different project. -->
4314     <ItemGroup>
4315       <_SourceItemsToCopyToOutputDirectoryAlways KeepDuplicates=" '$(_GCTODIKeepDuplicates)' != 'false' " KeepMetadata="$(_GCTODIKeepMetadata)" Include="@(_AllChildProjectItemsWithTargetPath->'%(FullPath)')" Condition="'%(_AllChildProjectItemsWithTargetPath.CopyToOutputDirectory)'=='Always'"/>
4316       <_SourceItemsToCopyToOutputDirectory       KeepDuplicates=" '$(_GCTODIKeepDuplicates)' != 'false' " KeepMetadata="$(_GCTODIKeepMetadata)" Include="@(_AllChildProjectItemsWithTargetPath->'%(FullPath)')" Condition="'%(_AllChildProjectItemsWithTargetPath.CopyToOutputDirectory)'=='PreserveNewest'"/>
4317     </ItemGroup>
4318
4319     <!-- Remove items which we will never again use - they just sit around taking up memory otherwise -->
4320     <ItemGroup>
4321       <_AllChildProjectItemsWithTargetPath Remove="@(_AllChildProjectItemsWithTargetPath)"/>
4322     </ItemGroup>
4323
4324     <!-- Get items from this project last so that they will be copied last. -->
4325     <ItemGroup>
4326       <_SourceItemsToCopyToOutputDirectoryAlways KeepMetadata="$(_GCTODIKeepMetadata)" Include="@(ContentWithTargetPath->'%(FullPath)')" Condition="'%(ContentWithTargetPath.CopyToOutputDirectory)'=='Always'"/>
4327       <_SourceItemsToCopyToOutputDirectory       KeepMetadata="$(_GCTODIKeepMetadata)" Include="@(ContentWithTargetPath->'%(FullPath)')" Condition="'%(ContentWithTargetPath.CopyToOutputDirectory)'=='PreserveNewest'"/>
4328     </ItemGroup>
4329
4330     <ItemGroup>
4331       <_SourceItemsToCopyToOutputDirectoryAlways KeepMetadata="$(_GCTODIKeepMetadata)" Include="@(EmbeddedResource->'%(FullPath)')" Condition="'%(EmbeddedResource.CopyToOutputDirectory)'=='Always'"/>
4332       <_SourceItemsToCopyToOutputDirectory       KeepMetadata="$(_GCTODIKeepMetadata)" Include="@(EmbeddedResource->'%(FullPath)')" Condition="'%(EmbeddedResource.CopyToOutputDirectory)'=='PreserveNewest'"/>
4333     </ItemGroup>
4334
4335     <ItemGroup>
4336       <_CompileItemsToCopy Include="@(Compile->'%(FullPath)')" Condition="'%(Compile.CopyToOutputDirectory)'=='Always' or '%(Compile.CopyToOutputDirectory)'=='PreserveNewest'"/>
4337     </ItemGroup>
4338
4339     <AssignTargetPath Files="@(_CompileItemsToCopy)" RootFolder="$(MSBuildProjectDirectory)">
4340       <Output TaskParameter="AssignedFiles" ItemName="_CompileItemsToCopyWithTargetPath" />
4341     </AssignTargetPath>
4342
4343     <ItemGroup>
4344       <_SourceItemsToCopyToOutputDirectoryAlways KeepMetadata="$(_GCTODIKeepMetadata)" Include="@(_CompileItemsToCopyWithTargetPath)" Condition="'%(_CompileItemsToCopyWithTargetPath.CopyToOutputDirectory)'=='Always'"/>
4345       <_SourceItemsToCopyToOutputDirectory       KeepMetadata="$(_GCTODIKeepMetadata)" Include="@(_CompileItemsToCopyWithTargetPath)" Condition="'%(_CompileItemsToCopyWithTargetPath.CopyToOutputDirectory)'=='PreserveNewest'"/>
4346     </ItemGroup>
4347
4348     <ItemGroup>
4349       <_SourceItemsToCopyToOutputDirectoryAlways KeepMetadata="$(_GCTODIKeepMetadata)" Include="@(_NoneWithTargetPath->'%(FullPath)')" Condition="'%(_NoneWithTargetPath.CopyToOutputDirectory)'=='Always'"/>
4350       <_SourceItemsToCopyToOutputDirectory       KeepMetadata="$(_GCTODIKeepMetadata)" Include="@(_NoneWithTargetPath->'%(FullPath)')" Condition="'%(_NoneWithTargetPath.CopyToOutputDirectory)'=='PreserveNewest'"/>
4351     </ItemGroup>
4352
4353     <ItemGroup>
4354       <AllItemsFullPathWithTargetPath            Include="@(_SourceItemsToCopyToOutputDirectoryAlways->'%(FullPath)');@(_SourceItemsToCopyToOutputDirectory->'%(FullPath)')"/>
4355     </ItemGroup>
4356
4357   </Target>
4358
4359   <!--
4360     ============================================================
4361                                         GetCopyToPublishDirectoryItems
4362
4363     Default implementation of GetCopyToPublishDirectoryItems for projects that do not 
4364     use Microsoft.NET.Sdk. It simply returns whatever GetCopyToOutputDirectoryItems 
4365     does with CopyToPublishDirectory implied  by CopyToOutputDirectory, which is the 
4366     same as Microsoft.NET.Sdk default when its CopyToPublishDirectory is not used. 
4367
4368     Microsoft.NET.Sdk projects  will override this to allow the publish output to be
4369     customized independently from the build output.
4370
4371     Having a default implementation here allows the Microsoft.NET.Sdk Publish target
4372     to work when a Microsoft.NET.Sdk-based project references a non-Microsoft.NET.Sdk-based
4373     project.
4374     ============================================================
4375     -->
4376     <Target
4377       Name="GetCopyToPublishDirectoryItems" 
4378       DependsOnTargets="GetCopyToOutputDirectoryItems"
4379       Returns="@(AllPublishItemsFullPathWithTargetPath)">
4380
4381     <ItemGroup>
4382       <AllPublishItemsFullPathWithTargetPath Include="@(AllItemsFullPathWithTargetPath)">
4383         <CopyToPublishDirectory>%(CopyToOutputDirectory)</CopyToPublishDirectory>
4384       </AllPublishItemsFullPathWithTargetPath>
4385     </ItemGroup>
4386   </Target>
4387
4388   <!--
4389     ============================================================
4390                                         _CopyOutOfDateSourceItemsToOutputDirectory
4391
4392     Copy files that have the CopyToOutputDirectory attribute set to 'PreserveNewest'.
4393     ============================================================
4394     -->
4395   <Target
4396       Name="_CopyOutOfDateSourceItemsToOutputDirectory"
4397       Condition=" '@(_SourceItemsToCopyToOutputDirectory)' != '' "
4398       Inputs="@(_SourceItemsToCopyToOutputDirectory)"
4399       Outputs="@(_SourceItemsToCopyToOutputDirectory->'$(OutDir)%(TargetPath)')">
4400
4401     <!--
4402         Not using SkipUnchangedFiles="true" because the application may want to change
4403         one of these files and not have an incremental build replace it.
4404         -->
4405     <Copy
4406         SourceFiles = "@(_SourceItemsToCopyToOutputDirectory)"
4407         DestinationFiles = "@(_SourceItemsToCopyToOutputDirectory->'$(OutDir)%(TargetPath)')"
4408         OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
4409         Retries="$(CopyRetryCount)"
4410         RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
4411         UseHardlinksIfPossible="$(CreateHardLinksForAdditionalFilesIfPossible)"
4412         UseSymboliclinksIfPossible="$(CreateSymbolicLinksForAdditionalFilesIfPossible)"
4413             >
4414
4415       <Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
4416
4417     </Copy>
4418
4419   </Target>
4420
4421   <!--
4422     ============================================================
4423                                         _CopyOutOfDateSourceItemsToOutputDirectoryAlways
4424
4425     Copy files that have the CopyToOutputDirectory attribute set to 'Always'.
4426     ============================================================
4427     -->
4428   <Target
4429       Name="_CopyOutOfDateSourceItemsToOutputDirectoryAlways"
4430       Condition=" '@(_SourceItemsToCopyToOutputDirectoryAlways)' != '' ">
4431
4432     <!--
4433         Not using SkipUnchangedFiles="true" because the application may want to change
4434         one of these files and not have an incremental build replace it.
4435         -->
4436     <Copy
4437         SourceFiles = "@(_SourceItemsToCopyToOutputDirectoryAlways)"
4438         DestinationFiles = "@(_SourceItemsToCopyToOutputDirectoryAlways->'$(OutDir)%(TargetPath)')"
4439         OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
4440         Retries="$(CopyRetryCount)"
4441         RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
4442         UseHardlinksIfPossible="$(CreateHardLinksForAdditionalFilesIfPossible)"
4443         UseSymboliclinksIfPossible="$(CreateSymbolicLinksForAdditionalFilesIfPossible)"
4444             >
4445
4446       <Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
4447
4448     </Copy>
4449
4450   </Target>
4451
4452   <!--
4453     ============================================================
4454                                         _CopyAppConfigFile
4455
4456     Copy the application config file.
4457     ============================================================
4458     -->
4459   <Target
4460       Name="_CopyAppConfigFile"
4461       Condition=" '@(AppConfigWithTargetPath)' != '' "
4462       Inputs="@(AppConfigWithTargetPath)"
4463       Outputs="@(AppConfigWithTargetPath->'$(OutDir)%(TargetPath)')">
4464
4465     <!--
4466         Copy the application's .config file, if any.
4467         Not using SkipUnchangedFiles="true" because the application may want to change
4468         the app.config and not have an incremental build replace it.
4469         -->
4470     <Copy
4471         SourceFiles="@(AppConfigWithTargetPath)"
4472         DestinationFiles="@(AppConfigWithTargetPath->'$(OutDir)%(TargetPath)')"
4473         OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
4474         Retries="$(CopyRetryCount)"
4475         RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
4476         UseHardlinksIfPossible="$(CreateHardLinksForAdditionalFilesIfPossible)"
4477         UseSymboliclinksIfPossible="$(CreateSymbolicLinksForAdditionalFilesIfPossible)"
4478             >
4479
4480       <Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
4481
4482     </Copy>
4483
4484   </Target>
4485
4486   <!--
4487     ================================================================
4488                                          _CopyManifestFiles
4489     ================================================================
4490
4491     Copy the built manifests (.exe.manifest, .application/.xbap) to the final directory.
4492     -->
4493   <Target
4494       Name="_CopyManifestFiles"
4495       Condition=" '$(_DeploymentCopyApplicationManifest)'=='true' or '$(GenerateClickOnceManifests)'=='true' "
4496       DependsOnTargets="PrepareForBuild">
4497
4498     <Copy
4499         SourceFiles="@(ApplicationManifest)"
4500         DestinationFolder="$(OutDir)"
4501         SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
4502         OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
4503         Retries="$(CopyRetryCount)"
4504         RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
4505         UseHardlinksIfPossible="$(CreateHardLinksForAdditionalFilesIfPossible)"
4506         UseSymboliclinksIfPossible="$(CreateSymbolicLinksForAdditionalFilesIfPossible)"
4507         Condition="'$(GenerateClickOnceManifests)'=='true' or '$(_DeploymentCopyApplicationManifest)'=='true'">
4508
4509       <Output TaskParameter="DestinationFiles" ItemName="_DeploymentMainApplicationManifest"/>
4510       <Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
4511
4512     </Copy>
4513
4514     <Message Importance="Normal" Condition="'$(_DeploymentCopyApplicationManifest)'=='true'" Text="$(MSBuildProjectName) -&gt; @(_DeploymentMainApplicationManifest->'%(FullPath)')" />
4515
4516     <Copy
4517         SourceFiles="@(DeployManifest)"
4518         DestinationFolder="$(OutDir)"
4519         SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
4520         OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
4521         Retries="$(CopyRetryCount)"
4522         RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
4523         UseHardlinksIfPossible="$(CreateHardLinksForAdditionalFilesIfPossible)"
4524         UseSymboliclinksIfPossible="$(CreateSymbolicLinksForAdditionalFilesIfPossible)"
4525         Condition="'$(GenerateClickOnceManifests)'=='true'">
4526
4527       <Output TaskParameter="DestinationFiles" ItemName="_DeploymentMainDeployManifest"/>
4528       <Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
4529
4530     </Copy>
4531
4532     <Message Importance="Normal" Condition="'$(GenerateClickOnceManifests)'=='true'" Text="$(MSBuildProjectName) -&gt; @(_DeploymentMainDeployManifest->'%(FullPath)')" />
4533
4534   </Target>
4535
4536   <!--
4537     ================================================================
4538                                          _CheckForCompileOutputs
4539
4540     Checks each file output from the main "Compile" target to make sure they really exist.
4541     If they do, then record them in the clean cache.
4542     ============================================================
4543     -->
4544   <Target
4545       Name="_CheckForCompileOutputs">
4546
4547     <!--Record the main compile outputs.-->
4548     <ItemGroup>
4549       <FileWrites Include="@(IntermediateAssembly)" Condition="Exists('@(IntermediateAssembly)')"/>
4550       <FileWrites Include="@(IntermediateRefAssembly)" Condition="'$(ProduceReferenceAssembly)' == 'true' and Exists('@(IntermediateRefAssembly)')"/>
4551     </ItemGroup>
4552
4553     <!-- Record the .xml if one was produced. -->
4554     <PropertyGroup>
4555       <_DocumentationFileProduced Condition="!Exists('@(DocFileItem)')">false</_DocumentationFileProduced>
4556     </PropertyGroup>
4557
4558     <ItemGroup>
4559       <FileWrites Include="@(DocFileItem)" Condition="'$(_DocumentationFileProduced)'=='true'"/>
4560     </ItemGroup>
4561
4562     <!-- Record the .pdb if one was produced. -->
4563     <PropertyGroup>
4564       <_DebugSymbolsProduced Condition="!Exists('@(_DebugSymbolsIntermediatePath)')">false</_DebugSymbolsProduced>
4565     </PropertyGroup>
4566
4567     <ItemGroup>
4568       <FileWrites Include="@(_DebugSymbolsIntermediatePath)" Condition="'$(_DebugSymbolsProduced)'=='true'"/>
4569     </ItemGroup>
4570   </Target>
4571
4572   <!--
4573     ============================================================
4574                                         _SGenCheckForOutputs
4575
4576     Checks each file output from the "GenerateSerializationAssemblies" target to make sure they really exist.
4577     If they do, then record them in the clean cache.
4578     ============================================================
4579     -->
4580   <Target
4581       Name="_SGenCheckForOutputs"
4582       Condition="'$(_SGenGenerateSerializationAssembliesConfig)' == 'On' or ('@(WebReferenceUrl)'!='' and '$(_SGenGenerateSerializationAssembliesConfig)' == 'Auto')"
4583         >
4584
4585     <!-- Record the serializer .dll if one was produced.-->
4586     <PropertyGroup>
4587       <_SGenDllCreated Condition="Exists('$(IntermediateOutputPath)$(_SGenDllName)')">true</_SGenDllCreated>
4588     </PropertyGroup>
4589
4590     <ItemGroup>
4591       <FileWrites Include="$(IntermediateOutputPath)$(_SGenDllName)" Condition="Exists('$(IntermediateOutputPath)$(_SGenDllName)')"/>
4592     </ItemGroup>
4593
4594   </Target>
4595
4596
4597
4598
4599   <!--
4600     ***********************************************************************************************
4601     ***********************************************************************************************
4602                                                                 UnmanagedRegistration Section
4603     ***********************************************************************************************
4604     ***********************************************************************************************
4605     -->
4606
4607   <!--
4608     ============================================================
4609                                         UnmanagedRegistration
4610
4611     Registers the main assembly for COM interop.
4612     ============================================================
4613     -->
4614   <PropertyGroup>
4615     <UnmanagedRegistrationDependsOn></UnmanagedRegistrationDependsOn>
4616   </PropertyGroup>
4617   <Target
4618       Name="UnmanagedRegistration"
4619       Condition="'$(RegisterForComInterop)'=='true' and '$(OutputType)'=='library'"
4620       DependsOnTargets="$(UnmanagedRegistrationDependsOn)"
4621         >
4622
4623     <PropertyGroup>
4624       <RegisterAssemblyMSBuildArchitecture Condition="'$(RegisterAssemblyMSBuildArchitecture)' == ''">$(PlatformTargetAsMSBuildArchitecture)</RegisterAssemblyMSBuildArchitecture>
4625     </PropertyGroup>
4626
4627     <PropertyGroup Condition="'$(TargetFrameworkAsMSBuildRuntime)' != '' and '$(RegisterAssemblyMSBuildArchitecture)' != ''">
4628       <!-- Falling back to the current runtime if we are targeting CLR2 and the task host doesn't exist will lead to
4629            incorrect behavior in some cases, but it's the same incorrect behavior as Visual Studio 2010, and thus better
4630            than causing build breaks on upgrade to Win8 the way not doing so would.  For more details, see the
4631            corresponding comment in GenerateResource. -->
4632       <RegisterAssemblyMSBuildRuntime
4633           Condition="'$(RegisterAssemblyMSBuildRuntime)' == '' and
4634                      $([MSBuild]::DoesTaskHostExist(`$(TargetFrameworkAsMSBuildRuntime)`, `$(RegisterAssemblyMSBuildArchitecture)`))">$(TargetFrameworkAsMSBuildRuntime)</RegisterAssemblyMSBuildRuntime>
4635
4636       <!-- If the targeted runtime doesn't exist, fall back to current -->
4637       <RegisterAssemblyMSBuildRuntime Condition="'$(RegisterAssemblyMSBuildRuntime)' == ''">CurrentRuntime</RegisterAssemblyMSBuildRuntime>
4638     </PropertyGroup>
4639
4640     <RegisterAssembly
4641         Assemblies="@(_OutputPathItem->'%(FullPath)$(TargetFileName)')"
4642         TypeLibFiles="@(_OutputPathItem->'%(FullPath)$(TargetName).tlb')"
4643         AssemblyListFile="@(_UnmanagedRegistrationCache)"
4644         CreateCodeBase="true"
4645         MSBuildRuntime="$(RegisterAssemblyMSBuildRuntime)"
4646         MSBuildArchitecture="$(RegisterAssemblyMSBuildArchitecture)"
4647         Condition="!Exists('@(_UnmanagedRegistrationCache)')"/>
4648
4649     <ItemGroup>
4650       <FileWrites Include="@(_OutputPathItem->'%(FullPath)$(TargetName).tlb')"/>
4651     </ItemGroup>
4652   </Target>
4653
4654
4655
4656
4657
4658   <!--
4659     ***********************************************************************************************
4660     ***********************************************************************************************
4661                                                                 IncrementalClean Section
4662     ***********************************************************************************************
4663     ***********************************************************************************************
4664     -->
4665
4666   <!--
4667     ============================================================
4668                                         IncrementalClean
4669
4670     Remove files that were produced in a prior build but weren't produced in the current build.
4671     The reason is that if, for example, the name of the .exe has changed we want to delete the
4672     old copy.
4673
4674     Leave the Clean cache file containing only the files produced in the current build.
4675     ============================================================
4676     -->
4677   <Target
4678        Name="IncrementalClean"
4679        DependsOnTargets="_CleanGetCurrentAndPriorFileWrites">
4680
4681     <!-- Subtract list of files produced in prior builds from list of files produced in this build. -->
4682     <ItemGroup>
4683       <_CleanOrphanFileWrites Include="@(_CleanPriorFileWrites)" Exclude="@(_CleanCurrentFileWrites)"/>
4684     </ItemGroup>
4685
4686     <!-- Find all files in the final output directory. -->
4687     <FindUnderPath Path="$(OutDir)" Files="@(_CleanOrphanFileWrites)">
4688       <Output TaskParameter="InPath" ItemName="_CleanOrphanFileWritesInOutput"/>
4689     </FindUnderPath>
4690
4691     <!-- Find all files in the intermediate output directory. -->
4692     <FindUnderPath Path="$(IntermediateOutputPath)"    Files="@(_CleanOrphanFileWrites)">
4693       <Output TaskParameter="InPath" ItemName="_CleanOrphanFileWritesInIntermediate"/>
4694     </FindUnderPath>
4695
4696     <!-- Delete the orphaned files. -->
4697     <Delete
4698         Files="@(_CleanOrphanFileWritesInIntermediate);@(_CleanOrphanFileWritesInOutput)"
4699         TreatErrorsAsWarnings="true">
4700
4701       <Output TaskParameter="DeletedFiles" ItemName="_CleanOrphanFilesDeleted"/>
4702
4703     </Delete>
4704
4705     <!-- Create a list of everything that wasn't deleted or was outside
4706              the current final output and intermediate output directories. -->
4707     <ItemGroup>
4708       <_CleanRemainingFileWritesAfterIncrementalClean Include="@(_CleanPriorFileWrites);@(_CleanCurrentFileWrites)" Exclude="@(_CleanOrphanFilesDeleted)"/>
4709     </ItemGroup>
4710
4711     <!-- Remove duplicates. -->
4712     <RemoveDuplicates Inputs="@(_CleanRemainingFileWritesAfterIncrementalClean)">
4713       <Output TaskParameter="Filtered" ItemName="_CleanUniqueRemainingFileWritesAfterIncrementalClean"/>
4714     </RemoveDuplicates>
4715
4716     <!-- Write new list of current files back to disk, replacing the existing list.-->
4717     <WriteLinesToFile
4718         File="$(IntermediateOutputPath)$(CleanFile)"
4719         Lines="@(_CleanUniqueRemainingFileWritesAfterIncrementalClean)"
4720         Condition="'@(_CleanUnfilteredPriorFileWrites)'!='@(_CleanUniqueRemainingFileWritesAfterIncrementalClean)'"
4721         Overwrite="true"/>
4722
4723   </Target>
4724
4725   <!--
4726     ============================================================
4727                                         _CleanGetCurrentAndPriorFileWrites
4728
4729     Get the list of files built in the current build and in prior builds.
4730     ============================================================
4731     -->
4732   <Target
4733        Name="_CleanGetCurrentAndPriorFileWrites"
4734        DependsOnTargets="_CheckForCompileOutputs;_SGenCheckForOutputs">
4735
4736     <!-- Read the list of files produced by a prior builds from disk. -->
4737     <ReadLinesFromFile File="$(IntermediateOutputPath)$(CleanFile)">
4738       <Output TaskParameter="Lines" ItemName="_CleanUnfilteredPriorFileWrites"/>
4739     </ReadLinesFromFile>
4740
4741     <!--
4742         Convert the list of references to the absolute paths so we can make valid comparisons
4743         across two lists
4744          -->
4745     <ConvertToAbsolutePath Paths="@(_ResolveAssemblyReferenceResolvedFiles)">
4746       <Output TaskParameter="AbsolutePaths" ItemName="_ResolveAssemblyReferenceResolvedFilesAbsolute"/>
4747     </ConvertToAbsolutePath>
4748
4749     <!--
4750         Subtract any resolved assembly files from *prior* file writes because deleting
4751         these would break subsequent builds because the assemblies would be unresolvable.
4752          -->
4753     <ItemGroup>
4754       <_CleanPriorFileWrites Include="@(_CleanUnfilteredPriorFileWrites)" Exclude="@(_ResolveAssemblyReferenceResolvedFilesAbsolute)"/>
4755     </ItemGroup>
4756
4757     <!--
4758         Of shareable files, keep only those that are in the project's directory.
4759         We never clean shareable files outside of the project directory because
4760         the build may be to a common output directory and other projects may need
4761         them.
4762
4763         Only subtract the outputs from ResolveAssemblyReferences target because that's the
4764         only "Resolve" target that tries to resolve assemblies directly from the output
4765         directory.
4766         -->
4767     <FindUnderPath Path="$(MSBuildProjectDirectory)" Files="@(FileWritesShareable)" UpdateToAbsolutePaths="true">
4768       <Output TaskParameter="InPath" ItemName="FileWrites"/>
4769     </FindUnderPath>
4770
4771     <!-- Find all files in the final output directory. -->
4772     <FindUnderPath Path="$(OutDir)" Files="@(FileWrites)" UpdateToAbsolutePaths="true">
4773       <Output TaskParameter="InPath" ItemName="_CleanCurrentFileWritesInOutput"/>
4774     </FindUnderPath>
4775
4776     <!-- Find all files in the intermediate output directory. -->
4777     <FindUnderPath Path="$(IntermediateOutputPath)" Files="@(FileWrites)" UpdateToAbsolutePaths="true">
4778       <Output TaskParameter="InPath" ItemName="_CleanCurrentFileWritesInIntermediate"/>
4779     </FindUnderPath>
4780
4781     <!--
4782         Subtract any resolved assembly files from *current* file writes because deleting
4783         these would break subsequent builds because the assemblies would be unresolvable.
4784
4785         Only subtract the outputs from ResolveAssemblyReferences target because that's the
4786         only "Resolve" target that tries to resolve assemblies directly from the output
4787         directory.
4788          -->
4789     <ItemGroup>
4790       <_CleanCurrentFileWritesWithNoReferences Include="@(_CleanCurrentFileWritesInOutput);@(_CleanCurrentFileWritesInIntermediate)" Exclude="@(_ResolveAssemblyReferenceResolvedFilesAbsolute)"/>
4791     </ItemGroup>
4792
4793     <!-- Remove duplicates from files produced in this build. -->
4794     <RemoveDuplicates Inputs="@(_CleanCurrentFileWritesWithNoReferences)" >
4795       <Output TaskParameter="Filtered" ItemName="_CleanCurrentFileWrites"/>
4796     </RemoveDuplicates>
4797
4798   </Target>
4799
4800   <!--
4801     ***********************************************************************************************
4802     ***********************************************************************************************
4803                                                                 Clean Section
4804     ***********************************************************************************************
4805     ***********************************************************************************************
4806     -->
4807
4808   <!--
4809     ============================================================
4810                                         Clean
4811
4812     Delete all intermediate and final build outputs.
4813     ============================================================
4814     -->
4815   <PropertyGroup>
4816     <CleanDependsOn>
4817       BeforeClean;
4818       UnmanagedUnregistration;
4819       CoreClean;
4820       CleanReferencedProjects;
4821       CleanPublishFolder;
4822       AfterClean
4823     </CleanDependsOn>
4824   </PropertyGroup>
4825   <Target
4826       Name="Clean"
4827       Condition=" '$(_InvalidConfigurationWarning)' != 'true' "
4828       DependsOnTargets="$(CleanDependsOn)" />
4829
4830   <!--
4831     ============================================================
4832                                         BeforeClean
4833
4834     Redefine this target in your project in order to run tasks just before Clean.
4835     ============================================================
4836     -->
4837   <Target Name="BeforeClean"/>
4838
4839   <!--
4840     ============================================================
4841                                         AfterClean
4842
4843     Redefine this target in your project in order to run tasks just after Clean.
4844     ============================================================
4845     -->
4846   <Target Name="AfterClean"/>
4847
4848   <!--
4849     ============================================================
4850                                         CleanReferencedProjects
4851
4852     Call Clean target on all Referenced Projects.
4853     ============================================================
4854     -->
4855   <Target
4856       Name="CleanReferencedProjects"
4857       DependsOnTargets="PrepareProjectReferences">
4858
4859     <!--
4860         When building the project directly from the command-line, clean those referenced projects
4861         that exist on disk.  For IDE builds and command-line .SLN builds, the solution build manager
4862         takes care of this.
4863         -->
4864     <MSBuild
4865         Projects="@(_MSBuildProjectReferenceExistent)"
4866         Targets="Clean"
4867         Properties="%(_MSBuildProjectReferenceExistent.SetConfiguration); %(_MSBuildProjectReferenceExistent.SetPlatform); %(_MSBuildProjectReferenceExistent.SetTargetFramework)"
4868         BuildInParallel="$(BuildInParallel)"
4869         Condition="'$(BuildingInsideVisualStudio)' != 'true' and '$(BuildProjectReferences)' == 'true' and '@(_MSBuildProjectReferenceExistent)' != ''"
4870         ContinueOnError="$(ContinueOnError)"
4871         RemoveProperties="%(_MSBuildProjectReferenceExistent.GlobalPropertiesToRemove)"/>
4872
4873   </Target>
4874
4875   <!--
4876     ============================================================
4877                                         CoreClean
4878     ============================================================
4879     -->
4880   <PropertyGroup>
4881     <CoreCleanDependsOn></CoreCleanDependsOn>
4882   </PropertyGroup>
4883   <Target
4884       Name="CoreClean"
4885       DependsOnTargets="$(CoreCleanDependsOn)">
4886
4887     <!-- First clean any explicitly specified cleanable files.
4888              Declare items of this type if you want Clean to delete them. -->
4889     <Delete
4890         Files="@(Clean)"
4891         TreatErrorsAsWarnings="true"/>
4892
4893     <!-- Read in list of files that were written to disk in past builds. -->
4894     <ReadLinesFromFile File="$(IntermediateOutputPath)$(CleanFile)">
4895       <Output TaskParameter="Lines" ItemName="_CleanPriorFileWrites"/>
4896     </ReadLinesFromFile>
4897
4898     <!-- Find all files in the final output directory. -->
4899     <FindUnderPath Path="$(OutDir)" Files="@(_CleanPriorFileWrites)">
4900       <Output TaskParameter="InPath" ItemName="_CleanPriorFileWritesInOutput"/>
4901     </FindUnderPath>
4902
4903     <!-- Find all files in the intermediate output directory. -->
4904     <FindUnderPath Path="$(IntermediateOutputPath)"    Files="@(_CleanPriorFileWrites)">
4905       <Output TaskParameter="InPath" ItemName="_CleanPriorFileWritesInIntermediate"/>
4906     </FindUnderPath>
4907
4908     <!-- Delete those files. -->
4909     <Delete
4910         Files="@(_CleanPriorFileWritesInOutput);@(_CleanPriorFileWritesInIntermediate)"
4911         TreatErrorsAsWarnings="true">
4912
4913       <Output TaskParameter="DeletedFiles" ItemName="_CleanPriorFileWritesDeleted"/>
4914
4915     </Delete>
4916
4917     <!-- Create a list of everything that wasn't deleted. -->
4918     <ItemGroup>
4919       <_CleanRemainingFileWritesAfterClean Include="@(_CleanPriorFileWrites)" Exclude="@(_CleanPriorFileWritesDeleted)"/>
4920     </ItemGroup>
4921
4922     <!-- Remove duplicates. -->
4923     <RemoveDuplicates Inputs="@(_CleanRemainingFileWritesAfterClean)">
4924       <Output TaskParameter="Filtered" ItemName="_CleanUniqueRemainingFileWrites"/>
4925     </RemoveDuplicates>
4926
4927     <!-- Make sure the directory exists. -->
4928     <MakeDir Directories="$(IntermediateOutputPath)"/>
4929
4930     <!-- Write new list of current files back to disk. -->
4931     <WriteLinesToFile File="$(IntermediateOutputPath)$(CleanFile)" Lines="@(_CleanUniqueRemainingFileWrites)" Overwrite="true" />
4932
4933   </Target>
4934
4935   <!--
4936     ============================================================
4937                                         _CleanRecordFileWrites
4938
4939     Save the list of all files written to disk so that it can be used for "Clean" later.
4940
4941     Files written in prior builds are not removed from Clean cache.
4942     ============================================================
4943     -->
4944   <Target
4945        Name="_CleanRecordFileWrites"
4946        DependsOnTargets="_CleanGetCurrentAndPriorFileWrites">
4947
4948     <!--
4949         Merge list of files from prior builds with the current build and then
4950         remove duplicates.
4951         -->
4952     <RemoveDuplicates Inputs="@(_CleanPriorFileWrites);@(_CleanCurrentFileWrites)">
4953       <Output TaskParameter="Filtered" ItemName="_CleanUniqueFileWrites"/>
4954     </RemoveDuplicates>
4955
4956     <!-- Make sure the directory exists. -->
4957     <MakeDir Directories="$(IntermediateOutputPath)"/>
4958
4959     <!-- Write merged file list back to disk, replacing existing contents. -->
4960     <WriteLinesToFile
4961         File="$(IntermediateOutputPath)$(CleanFile)"
4962         Lines="@(_CleanUniqueFileWrites)"
4963         Overwrite="true" />
4964
4965   </Target>
4966
4967   <!--
4968     ============================================================
4969                                         CleanPublishFolder
4970     ============================================================
4971     -->
4972   <Target
4973       Name="CleanPublishFolder">
4974
4975     <RemoveDir
4976         Directories="$(PublishDir)"
4977         Condition="'$(PublishDir)'=='$(OutputPath)app.publish\' and Exists('$(PublishDir)')"/>
4978
4979   </Target>
4980
4981
4982
4983
4984   <!--
4985     ***********************************************************************************************
4986     ***********************************************************************************************
4987                                                                 PostBuildEvent Section
4988     ***********************************************************************************************
4989     ***********************************************************************************************
4990     -->
4991
4992   <!--
4993     ============================================================
4994                                         PostBuildEvent
4995
4996     Run the post-build event. This step is driven by two parameters:
4997
4998     (1) The $(RunPostBuildEvent) property is set by the user through the IDE and can be one of four values.
4999
5000         - OnBuildSuccess: In this case, every step of the build must succeed for the post-build step to run.
5001         - <Blank>: This is the same as OnBuildSuccess.
5002         - OnOutputUpdated: In this case, the post-build step will run only if the main output assembly was
5003         actually updated.
5004         - Always: The post-build step is always run.
5005
5006     (2) The $(_AssemblyTimestampBeforeCompile) and $(_AssemblyTimestampAfterCompile) values are
5007         set by the _TimeStampBeforeCompile and _TimeStampAfterCompile targets.  If the assembly was actually
5008         rebuilt during this build, then the two values will be different.
5009     ============================================================
5010     -->
5011   <PropertyGroup>
5012     <PostBuildEventDependsOn></PostBuildEventDependsOn>
5013   </PropertyGroup>
5014   <Target
5015       Name="PostBuildEvent"
5016       Condition="'$(PostBuildEvent)' != '' and ('$(RunPostBuildEvent)' != 'OnOutputUpdated' or '$(_AssemblyTimestampBeforeCompile)' != '$(_AssemblyTimestampAfterCompile)')"
5017       DependsOnTargets="$(PostBuildEventDependsOn)">
5018
5019     <Exec WorkingDirectory="$(OutDir)" Command="$(PostBuildEvent)" />
5020
5021   </Target>
5022
5023
5024
5025
5026   <!--
5027     ***********************************************************************************************
5028     ***********************************************************************************************
5029                                                                 Publish Section
5030     ***********************************************************************************************
5031     ***********************************************************************************************
5032     -->
5033
5034   <!--
5035     ============================================================
5036                                         Publish
5037
5038     This target is only called when doing ClickOnce publishing outside the IDE, which implicitly builds before publishing.
5039     ============================================================
5040     -->
5041   <PropertyGroup>
5042     <PublishDependsOn Condition="'$(PublishableProject)'=='true'">
5043       SetGenerateManifests;
5044       Build;
5045       PublishOnly
5046     </PublishDependsOn>
5047     <PublishDependsOn Condition="'$(PublishableProject)'!='true'">
5048       _DeploymentUnpublishable
5049     </PublishDependsOn>
5050   </PropertyGroup>
5051   <Target
5052       Name="Publish"
5053       DependsOnTargets="$(PublishDependsOn)"/>
5054
5055   <!--
5056     ============================================================
5057                                         _DeploymentUnpublishable
5058
5059     This target is used to block an attempt to ClickOnce publish a non-publishable project, such as a ClassLibrary, when building outside the IDE.
5060     ============================================================
5061     -->
5062   <Target
5063       Name="_DeploymentUnpublishable">
5064
5065     <Message Text="Skipping unpublishable project."/>
5066
5067   </Target>
5068
5069   <!--
5070     ============================================================
5071                                         SetGenerateManifests
5072
5073     This target simply assures the GenerateClickOnceManifests property is set whenever the publish target is invoked.
5074     ============================================================
5075     -->
5076   <Target
5077       Name="SetGenerateManifests">
5078
5079     <Error Condition="'$(OutputType)'!='winexe' and '$(OutputType)'!='exe' and '$(OutputType)'!='appcontainerexe'" Text="Publish is only valid for 'Windows Application' or 'Console Application' project types."/>
5080     <Error Condition="'$(_DeploymentSignClickOnceManifests)'=='true' and '$(ManifestCertificateThumbprint)'=='' and '$(ManifestKeyFile)'==''" Text="A signing key is required in order to publish this project. Please specify a ManifestKeyFile or ManifestCertificateThumbprint value. Publishing from Visual Studio will automatically configure a signing key for this project."/>
5081
5082     <PropertyGroup>
5083       <GenerateClickOnceManifests>true</GenerateClickOnceManifests>
5084     </PropertyGroup>
5085
5086   </Target>
5087
5088   <!--
5089     ============================================================
5090                                         PublishOnly
5091
5092     The "PublishOnly" target is intended for ClickOnce publishing inside the IDE, where the build has already been done
5093     by the BuildManager.
5094     ============================================================
5095     -->
5096   <PropertyGroup>
5097     <PublishOnlyDependsOn>
5098       SetGenerateManifests;
5099       PublishBuild;
5100       BeforePublish;
5101       GenerateManifests;
5102       CopyFilesToOutputDirectory;
5103       _CopyFilesToPublishFolder;
5104       _DeploymentGenerateBootstrapper;
5105       ResolveKeySource;
5106       _DeploymentSignClickOnceDeployment;
5107       AfterPublish
5108     </PublishOnlyDependsOn>
5109   </PropertyGroup>
5110   <Target
5111       Name="PublishOnly"
5112       DependsOnTargets="$(PublishOnlyDependsOn)"/>
5113
5114   <!--
5115     ============================================================
5116                                         BeforePublish
5117
5118     Redefine this target in your project in order to run tasks just before Publish.
5119     ============================================================
5120     -->
5121   <Target Name="BeforePublish"/>
5122
5123   <!--
5124     ============================================================
5125                                         AfterPublish
5126
5127     Redefine this target in your project in order to run tasks just after Publish.
5128     ============================================================
5129     -->
5130   <Target Name="AfterPublish"/>
5131
5132   <!--
5133     ============================================================
5134                                         PublishBuild
5135
5136     Defines the set of targets that publishing is directly dependent on.
5137     ============================================================
5138     -->
5139   <PropertyGroup>
5140     <PublishBuildDependsOn>
5141       BuildOnlySettings;
5142       PrepareForBuild;
5143       ResolveReferences;
5144       PrepareResources;
5145       ResolveKeySource;
5146       GenerateSerializationAssemblies;
5147       CreateSatelliteAssemblies;
5148     </PublishBuildDependsOn>
5149   </PropertyGroup>
5150   <Target
5151       Name="PublishBuild"
5152       DependsOnTargets="$(PublishBuildDependsOn)"/>
5153
5154   <!--
5155     ============================================================
5156                                         _CopyFilesToPublishFolder
5157     ============================================================
5158     -->
5159   <Target
5160       Name="_CopyFilesToPublishFolder">
5161
5162     <!-- Compute name of application folder, which includes the assembly name plus formatted application version.
5163              The application version is formatted to use "_" in place of "." chars (i.e. "1_0_0_0" instead of "1.0.0.0").
5164              This is done because some servers misinterpret "." as a file extension. -->
5165     <FormatVersion Version="$(ApplicationVersion)" Revision="$(ApplicationRevision)" FormatType="Path">
5166       <Output TaskParameter="OutputVersion" PropertyName="_DeploymentApplicationVersionFragment"/>
5167     </FormatVersion>
5168
5169     <PropertyGroup>
5170       <_DeploymentApplicationFolderName>Application Files\$(AssemblyName)_$(_DeploymentApplicationVersionFragment)</_DeploymentApplicationFolderName>
5171       <_DeploymentApplicationDir>$(PublishDir)$(_DeploymentApplicationFolderName)\</_DeploymentApplicationDir>
5172     </PropertyGroup>
5173
5174     <PropertyGroup>
5175       <!-- By default we're not using Hard or Symbolic Links to copy to the publish directory, and never when building in VS -->
5176       <CreateHardLinksForPublishFilesIfPossible Condition="'$(BuildingInsideVisualStudio)' == 'true' or '$(CreateHardLinksForPublishFilesIfPossible)' == ''">false</CreateHardLinksForPublishFilesIfPossible>
5177       <CreateSymbolicLinksForPublishFilesIfPossible Condition="'$(BuildingInsideVisualStudio)' == 'true' or '$(CreateSymbolicLinksForPublishFilesIfPossible)' == ''">false</CreateSymbolicLinksForPublishFilesIfPossible>
5178     </PropertyGroup>
5179
5180     <!-- Copy files to publish folder -->
5181     <Copy
5182         SourceFiles=
5183                 "@(_ApplicationManifestFinal);
5184                 @(_DeploymentResolvedManifestEntryPoint);
5185                 @(_DeploymentManifestFiles);
5186                 @(ReferenceComWrappersToCopyLocal);
5187                 @(ResolvedIsolatedComModules);
5188                 @(_DeploymentLooseManifestFile)"
5189         DestinationFiles=
5190                 "@(_ApplicationManifestFinal->'$(_DeploymentApplicationDir)%(TargetPath)');
5191                 @(_DeploymentManifestEntryPoint->'$(_DeploymentApplicationDir)%(TargetPath)$(_DeploymentFileMappingExtension)');
5192                 @(_DeploymentManifestFiles->'$(_DeploymentApplicationDir)%(TargetPath)$(_DeploymentFileMappingExtension)');
5193                 @(ReferenceComWrappersToCopyLocal->'$(_DeploymentApplicationDir)%(FileName)%(Extension)$(_DeploymentFileMappingExtension)');
5194                 @(ResolvedIsolatedComModules->'$(_DeploymentApplicationDir)%(FileName)%(Extension)$(_DeploymentFileMappingExtension)');
5195                 @(_DeploymentLooseManifestFile->'$(_DeploymentApplicationDir)%(FileName)%(Extension)$(_DeploymentFileMappingExtension)')"
5196         SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
5197         OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
5198         Retries="$(CopyRetryCount)"
5199         UseHardlinksIfPossible="$(CreateHardLinksForPublishFilesIfPossible)"
5200         UseSymboliclinksIfPossible="$(CreateSymbolicLinksForPublishFilesIfPossible)"
5201         RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
5202
5203     <Copy
5204         SourceFiles="@(_DeploymentManifestDependencies)"
5205         DestinationFiles="@(_DeploymentManifestDependencies->'$(_DeploymentApplicationDir)%(TargetPath)$(_DeploymentFileMappingExtension)')"
5206         SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
5207         OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
5208         Retries="$(CopyRetryCount)"
5209         RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
5210         UseHardlinksIfPossible="$(CreateHardLinksForPublishFilesIfPossible)"
5211         UseSymboliclinksIfPossible="$(CreateSymbolicLinksForPublishFilesIfPossible)"
5212         Condition="'%(_DeploymentManifestDependencies.DependencyType)'=='Install'"/>
5213
5214     <Copy
5215         SourceFiles="@(_ReferenceScatterPaths)"
5216         DestinationFiles="@(_ReferenceScatterPaths->'$(_DeploymentApplicationDir)%(Filename)%(Extension)$(_DeploymentFileMappingExtension)')"
5217         SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
5218         OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
5219         Retries="$(CopyRetryCount)"
5220         RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
5221         UseHardlinksIfPossible="$(CreateHardLinksForPublishFilesIfPossible)"
5222         UseSymboliclinksIfPossible="$(CreateSymbolicLinksForPublishFilesIfPossible)"
5223             />
5224
5225     <FormatUrl InputUrl="$(_DeploymentApplicationUrl)">
5226       <Output TaskParameter="OutputUrl" PropertyName="_DeploymentFormattedApplicationUrl"/>
5227     </FormatUrl>
5228
5229     <FormatUrl InputUrl="$(_DeploymentComponentsUrl)">
5230       <Output TaskParameter="OutputUrl" PropertyName="_DeploymentFormattedComponentsUrl"/>
5231     </FormatUrl>
5232
5233   </Target>
5234
5235   <!--
5236     ============================================================
5237                                         _DeploymentGenerateBootstrapper
5238     ============================================================
5239     -->
5240   <Target
5241       Name="_DeploymentGenerateBootstrapper">
5242
5243     <!-- Build setup.exe bootstrapper and copy referenced packages -->
5244     <GenerateBootstrapper
5245         ApplicationFile="$(TargetDeployManifestFileName)"
5246         ApplicationName="$(AssemblyName)"
5247         ApplicationUrl="$(_DeploymentFormattedApplicationUrl)"
5248         BootstrapperItems="@(BootstrapperPackage)"
5249         ComponentsLocation="$(BootstrapperComponentsLocation)"
5250         ComponentsUrl="$(_DeploymentFormattedComponentsUrl)"
5251         Culture="$(TargetCulture)"
5252         FallbackCulture="$(FallbackCulture)"
5253         OutputPath="$(PublishDir)"
5254         SupportUrl="$(_DeploymentFormattedSupportUrl)"
5255         Path="$(GenerateBootstrapperSdkPath)"
5256         VisualStudioVersion="$(VisualStudioVersion)"
5257         Condition="'$(BootstrapperEnabled)'=='true'"/>
5258
5259   </Target>
5260
5261   <!--
5262     ============================================================
5263                                         _DeploymentSignClickOnceDeployment
5264     ============================================================
5265     -->
5266   <Target
5267       Name="_DeploymentSignClickOnceDeployment">
5268
5269     <!-- Sign manifests and the bootstrapper -->
5270     <SignFile
5271         CertificateThumbprint="$(_DeploymentResolvedManifestCertificateThumbprint)"
5272         TimestampUrl="$(ManifestTimestampUrl)"
5273         SigningTarget="$(_DeploymentApplicationDir)$(_DeploymentTargetApplicationManifestFileName)"
5274         TargetFrameworkVersion="$(TargetFrameworkVersion)"
5275         Condition="'$(_DeploymentSignClickOnceManifests)'=='true'" />
5276
5277     <!-- Update entry point path in deploy manifest -->
5278     <UpdateManifest
5279         ApplicationPath="$(_DeploymentApplicationFolderName)\$(_DeploymentTargetApplicationManifestFileName)"
5280         TargetFrameworkVersion="$(TargetFrameworkVersion)"
5281         ApplicationManifest="$(_DeploymentApplicationDir)$(_DeploymentTargetApplicationManifestFileName)"
5282         InputManifest="$(OutDir)$(TargetDeployManifestFileName)"
5283         OutputManifest="$(PublishDir)$(TargetDeployManifestFileName)">
5284
5285       <Output TaskParameter="OutputManifest" ItemName="PublishedDeployManifest"/>
5286
5287     </UpdateManifest>
5288
5289     <SignFile
5290         CertificateThumbprint="$(_DeploymentResolvedManifestCertificateThumbprint)"
5291         TimestampUrl="$(ManifestTimestampUrl)"
5292         SigningTarget="$(PublishDir)$(TargetDeployManifestFileName)"
5293         TargetFrameworkVersion="$(TargetFrameworkVersion)"
5294         Condition="'$(_DeploymentSignClickOnceManifests)'=='true'" />
5295
5296     <SignFile
5297         CertificateThumbprint="$(_DeploymentResolvedManifestCertificateThumbprint)"
5298         TimestampUrl="$(ManifestTimestampUrl)"
5299         SigningTarget="$(PublishDir)\setup.exe"
5300         Condition="'$(BootstrapperEnabled)'=='true' and '$(_DeploymentSignClickOnceManifests)'=='true'" />
5301
5302
5303   </Target>
5304
5305
5306
5307
5308   <!--
5309     ***********************************************************************************************
5310     ***********************************************************************************************
5311                                                                 AllProjectOutputGroups Section
5312     ***********************************************************************************************
5313     ***********************************************************************************************
5314     -->
5315
5316   <!--
5317     ============================================================
5318                                         AllProjectOutputGroups
5319
5320     The targets below drive output groups, which provide generic information about a
5321     project's inputs (e.g., content files, compilation sources, etc.) and built outputs
5322     (e.g., built EXE/DLL, PDB, XML documentation files, etc.)
5323
5324     Each target may produce two kinds of items:  outputs and dependencies.  Outputs are
5325     items from the current project; dependencies are items that are brought into the
5326     current project as a result of referencing other projects or components.
5327
5328     For both outputs and dependencies, the Include attribute
5329     specifies the location of the output/dependency; it must be a full path.  Any number
5330     of additional attributes may be placed on an output/dependency item.
5331     ============================================================
5332     -->
5333   <Target
5334       Name="AllProjectOutputGroups"
5335       DependsOnTargets="
5336             BuiltProjectOutputGroup;
5337             DebugSymbolsProjectOutputGroup;
5338             DocumentationProjectOutputGroup;
5339             SatelliteDllsProjectOutputGroup;
5340             SourceFilesProjectOutputGroup;
5341             ContentFilesProjectOutputGroup;
5342             SGenFilesOutputGroup"/>
5343
5344   <!--
5345     This is the key output for the BuiltProjectOutputGroup and is meant to be read directly from the IDE.
5346     Reading an item is faster than invoking a target.
5347     -->
5348   <ItemGroup Condition=" '$(OutputType)' != 'winmdobj' ">
5349     <BuiltProjectOutputGroupKeyOutput Include="@(IntermediateAssembly->'%(FullPath)')">
5350       <IsKeyOutput>true</IsKeyOutput>
5351       <FinalOutputPath>$(TargetPath)</FinalOutputPath>
5352       <TargetPath>$(TargetFileName)</TargetPath>
5353       <COM2REG Condition="'$(RegisterForComInterop)'=='true' and '$(OutputType)'=='library'">true</COM2REG>
5354     </BuiltProjectOutputGroupKeyOutput>
5355   </ItemGroup>
5356
5357   <ItemGroup Condition=" '$(OutputType)' == 'winmdobj' ">
5358     <WinMDExpOutputWindowsMetadataFileItem Include="$(_IntermediateWindowsMetadataPath)" Condition="'$(_IntermediateWindowsMetadataPath)' != ''" />
5359     <BuiltProjectOutputGroupKeyOutput Include="@(WinMDExpOutputWindowsMetadataFileItem->'%(FullPath)')">
5360       <IsKeyOutput>true</IsKeyOutput>
5361       <FinalOutputPath>$(TargetPath)</FinalOutputPath>
5362       <TargetPath>$(TargetFileName)</TargetPath>
5363     </BuiltProjectOutputGroupKeyOutput>
5364   </ItemGroup>
5365
5366   <!--
5367     ============================================================
5368                                         BuiltProjectOutputGroup
5369     ============================================================
5370     -->
5371   <PropertyGroup>
5372     <BuiltProjectOutputGroupDependsOn>PrepareForBuild</BuiltProjectOutputGroupDependsOn>
5373     <AddAppConfigToBuildOutputs Condition="('$(AddAppConfigToBuildOutputs)'=='') and ('$(OutputType)'!='library' and '$(OutputType)'!='winmdobj')">true</AddAppConfigToBuildOutputs>
5374   </PropertyGroup>
5375   <Target
5376       Name="BuiltProjectOutputGroup"
5377       Returns="@(BuiltProjectOutputGroupOutput)"
5378       DependsOnTargets="$(BuiltProjectOutputGroupDependsOn)">
5379
5380     <ItemGroup>
5381       <_BuiltProjectOutputGroupOutputIntermediate Include="@(BuiltProjectOutputGroupKeyOutput)"/>
5382     </ItemGroup>
5383
5384     <!-- This item represents the app.config file -->
5385     <ItemGroup>
5386       <_BuiltProjectOutputGroupOutputIntermediate Include="$(AppConfig)"  Condition="'$(AddAppConfigToBuildOutputs)'=='true'">
5387         <FinalOutputPath>$(TargetDir)$(TargetFileName).config</FinalOutputPath>
5388         <TargetPath>$(TargetFileName).config</TargetPath>
5389         <!-- For compatibility with 2.0 -->
5390         <OriginalItemSpec>$(AppConfig)</OriginalItemSpec>
5391       </_BuiltProjectOutputGroupOutputIntermediate>
5392     </ItemGroup>
5393
5394     <ItemGroup>
5395       <_IsolatedComReference Include="@(COMReference)" Condition=" '%(COMReference.Isolated)' == 'true' "/>
5396       <_IsolatedComReference Include="@(COMFileReference)" Condition=" '%(COMFileReference.Isolated)' == 'true' "/>
5397     </ItemGroup>
5398
5399     <!-- This item represents the native manifest, example: WindowsApplication1.exe.manifest or Native.ClassLibrary1.manifest -->
5400     <ItemGroup>
5401       <_BuiltProjectOutputGroupOutputIntermediate Include="$(OutDir)$(_DeploymentTargetApplicationManifestFileName)" Condition="'@(NativeReference)'!='' or '@(_IsolatedComReference)'!=''">
5402         <TargetPath>$(_DeploymentTargetApplicationManifestFileName)</TargetPath>
5403         <!-- For compatibility with 2.0 -->
5404         <OriginalItemSpec>$(OutDir)$(_DeploymentTargetApplicationManifestFileName)</OriginalItemSpec>
5405       </_BuiltProjectOutputGroupOutputIntermediate>
5406     </ItemGroup>
5407
5408     <!-- Convert intermediate items into final items; this way we can get the full path for each item -->
5409     <ItemGroup>
5410       <BuiltProjectOutputGroupOutput Include="@(_BuiltProjectOutputGroupOutputIntermediate->'%(FullPath)')">
5411         <!-- For compatibility with 2.0 -->
5412         <OriginalItemSpec Condition="'%(_BuiltProjectOutputGroupOutputIntermediate.OriginalItemSpec)' == ''">%(_BuiltProjectOutputGroupOutputIntermediate.FullPath)</OriginalItemSpec>
5413       </BuiltProjectOutputGroupOutput>
5414     </ItemGroup>
5415
5416   </Target>
5417
5418   <!--
5419     ============================================================
5420                                         DebugSymbolsProjectOutputGroup
5421
5422     This target performs population of the Debug Symbols project output group.
5423     ============================================================
5424     -->
5425   <PropertyGroup>
5426     <DebugSymbolsProjectOutputGroupDependsOn></DebugSymbolsProjectOutputGroupDependsOn>
5427   </PropertyGroup>
5428   <ItemGroup Condition="'$(_DebugSymbolsProduced)' != 'false' and '$(OutputType)' != 'winmdobj'">
5429     <DebugSymbolsProjectOutputGroupOutput Include="@(_DebugSymbolsIntermediatePath->'%(FullPath)')">
5430       <FinalOutputPath>@(_DebugSymbolsOutputPath->'%(FullPath)')</FinalOutputPath>
5431       <TargetPath>@(_DebugSymbolsIntermediatePath->'%(Filename)%(Extension)')</TargetPath>
5432     </DebugSymbolsProjectOutputGroupOutput>
5433   </ItemGroup>
5434   <ItemGroup Condition="'$(_DebugSymbolsProduced)' != 'false' and '$(OutputType)' == 'winmdobj'">
5435     <WinMDExpOutputPdbItem Include="$(WinMDExpOutputPdb)" Condition="'$(WinMDExpOutputPdb)' != ''" />
5436     <WinMDExpFinalOutputPdbItem Include="$(_WinMDDebugSymbolsOutputPath)" Condition="'$(_WinMDDebugSymbolsOutputPath)' != ''" />
5437     <DebugSymbolsProjectOutputGroupOutput Include="@(WinMDExpOutputPdbItem->'%(FullPath)')">
5438       <FinalOutputPath>@(WinMDExpFinalOutputPdbItem->'%(FullPath)')</FinalOutputPath>
5439       <TargetPath>@(WinMDExpOutputPdbItem->'%(Filename)%(Extension)')</TargetPath>
5440     </DebugSymbolsProjectOutputGroupOutput>
5441   </ItemGroup>
5442   <Target
5443       Name="DebugSymbolsProjectOutputGroup"
5444       Returns="@(DebugSymbolsProjectOutputGroupOutput)"
5445       DependsOnTargets="$(DebugSymbolsProjectOutputGroupDependsOn)"/>
5446
5447   <!--
5448     ============================================================
5449                                         DocumentationProjectOutputGroup
5450
5451     This target performs population of the Documentation project output group.
5452     ============================================================
5453     -->
5454   <PropertyGroup>
5455     <DocumentationProjectOutputGroupDependsOn></DocumentationProjectOutputGroupDependsOn>
5456   </PropertyGroup>
5457   <ItemGroup Condition="'$(DocumentationFile)'!='' and '$(OutputType)' != 'winmdobj'">
5458     <DocumentationProjectOutputGroupOutput Include="@(DocFileItem->'%(FullPath)')">
5459       <FinalOutputPath>@(FinalDocFile->'%(FullPath)')</FinalOutputPath>
5460       <IsKeyOutput>true</IsKeyOutput>
5461       <TargetPath>@(DocFileItem->'%(Filename)%(Extension)')</TargetPath>
5462     </DocumentationProjectOutputGroupOutput>
5463   </ItemGroup>
5464   <ItemGroup Condition="'$(DocumentationFile)' != '' and '$(OutputType)' == 'winmdobj'">
5465     <WinMDOutputDocumentationFileItem Include="$(WinMDOutputDocumentationFile)" Condition="'$(WinMDOutputDocumentationFile)' != ''" />
5466     <WinMDExpFinalOutputDocItem Include="$(_WinMDDocFileOutputPath)" Condition="'$(_WinMDDocFileOutputPath)' != ''" />
5467     <DocumentationProjectOutputGroupOutput Include="@(WinMDOutputDocumentationFileItem->'%(FullPath)')">
5468       <FinalOutputPath>@(WinMDExpFinalOutputDocItem->'%(FullPath)')</FinalOutputPath>
5469       <TargetPath>@(WinMDOutputDocumentationFileItem->'%(Filename)%(Extension)')</TargetPath>
5470     </DocumentationProjectOutputGroupOutput>
5471   </ItemGroup>
5472   <Target
5473       Name="DocumentationProjectOutputGroup"
5474       Returns="@(DocumentationProjectOutputGroupOutput)"
5475       DependsOnTargets="$(DocumentationProjectOutputGroupDependsOn)"/>
5476
5477   <!--
5478     ============================================================
5479                                         SatelliteDllsProjectOutputGroup
5480
5481     This target performs population of the Satellite Files project output group.
5482     ============================================================
5483     -->
5484   <PropertyGroup>
5485     <SatelliteDllsProjectOutputGroupDependsOn>PrepareForBuild;PrepareResourceNames</SatelliteDllsProjectOutputGroupDependsOn>
5486   </PropertyGroup>
5487   <Target
5488       Name="SatelliteDllsProjectOutputGroup"
5489       Returns="@(SatelliteDllsProjectOutputGroupOutput)"
5490       DependsOnTargets="$(SatelliteDllsProjectOutputGroupDependsOn)">
5491
5492     <ItemGroup>
5493       <SatelliteDllsProjectOutputGroupOutputIntermediate Include="$(IntermediateOutputPath)%(EmbeddedResource.Culture)\$(TargetName).resources.dll"
5494                                                          Condition="'%(EmbeddedResource.WithCulture)' == 'true'">
5495         <TargetPath>%(EmbeddedResource.Culture)\$(TargetName).resources.dll</TargetPath>
5496         <Culture>%(EmbeddedResource.Culture)</Culture>
5497       </SatelliteDllsProjectOutputGroupOutputIntermediate>
5498     </ItemGroup>
5499
5500     <!-- Convert intermediate items into final items; this way we can get the full path for each item. -->
5501     <ItemGroup>
5502       <SatelliteDllsProjectOutputGroupOutput Include="@(SatelliteDllsProjectOutputGroupOutputIntermediate->'%(FullPath)')">
5503         <FinalOutputPath Condition=" '%(SatelliteDllsProjectOutputGroupOutputIntermediate.FinalOutputPath)' == '' ">$(TargetDir)%(SatelliteDllsProjectOutputGroupOutputIntermediate.TargetPath)</FinalOutputPath>
5504         <!-- For compatibility with 2.0 -->
5505         <OriginalItemSpec>%(SatelliteDllsProjectOutputGroupOutputIntermediate.Identity)</OriginalItemSpec>
5506       </SatelliteDllsProjectOutputGroupOutput>
5507     </ItemGroup>
5508
5509   </Target>
5510
5511   <!--
5512     ============================================================
5513                                         SourceFilesProjectOutputGroup
5514
5515     This target performs population of the Source Files project output group.
5516     Source files are items in the project whose type is "Compile" and "EmbeddedResource".
5517     ============================================================
5518     -->
5519   <PropertyGroup>
5520     <SourceFilesProjectOutputGroupDependsOn>PrepareForBuild;AssignTargetPaths</SourceFilesProjectOutputGroupDependsOn>
5521   </PropertyGroup>
5522   <Target
5523       Name="SourceFilesProjectOutputGroup"
5524       Returns="@(SourceFilesProjectOutputGroupOutput)"
5525       DependsOnTargets="$(SourceFilesProjectOutputGroupDependsOn)">
5526
5527     <AssignTargetPath Files="@(Compile)" RootFolder="$(MSBuildProjectDirectory)">
5528       <Output TaskParameter="AssignedFiles" ItemName="_CompileWithTargetPath" />
5529     </AssignTargetPath>
5530
5531     <ItemGroup>
5532       <!-- First we deal with Compile, EmbeddedResource and AppConfig -->
5533       <SourceFilesProjectOutputGroupOutput Include="@(_CompileWithTargetPath->'%(FullPath)');@(EmbeddedResource->'%(FullPath)');@(_LicxFile->'%(FullPath)');@(AppConfigWithTargetPath->'%(FullPath)')"/>
5534
5535       <!-- Include the project file -->
5536       <SourceFilesProjectOutputGroupOutput Include="$(MSBuildProjectFullPath)">
5537         <!-- For compatibility with 2.0 -->
5538         <OriginalItemSpec>$(MSBuildProjectFullPath)</OriginalItemSpec>
5539         <TargetPath>$(ProjectFileName)</TargetPath>
5540       </SourceFilesProjectOutputGroupOutput>
5541     </ItemGroup>
5542
5543   </Target>
5544
5545   <!-- Get just the compile items -->
5546   <Target Name="GetCompile" Returns="@(Compile)"/>
5547
5548   <!--
5549     ============================================================
5550                                         ContentFilesProjectOutputGroup
5551
5552     This target performs population of the Content Files project output group.
5553     Content files are items in the project whose type is "Content".
5554     ============================================================
5555     -->
5556   <PropertyGroup>
5557     <ContentFilesProjectOutputGroupDependsOn>PrepareForBuild;AssignTargetPaths</ContentFilesProjectOutputGroupDependsOn>
5558   </PropertyGroup>
5559   <Target
5560       Name="ContentFilesProjectOutputGroup"
5561       Returns="@(ContentFilesProjectOutputGroupOutput)"
5562       DependsOnTargets="$(ContentFilesProjectOutputGroupDependsOn)">
5563
5564     <!-- Convert items into final items; this way we can get the full path for each item. -->
5565     <ItemGroup>
5566       <ContentFilesProjectOutputGroupOutput Include="@(ContentWithTargetPath->'%(FullPath)')"/>
5567     </ItemGroup>
5568
5569   </Target>
5570
5571   <!--
5572     ============================================================
5573                                         SGenFilesOutputGroup
5574
5575     This target performs population of the GenerateSerializationAssemblies Files project output group.
5576     GenerateSerializationAssemblies files are those generated by the GenerateSerializationAssemblies target and task.
5577     ============================================================
5578     -->
5579   <PropertyGroup>
5580     <SGenFilesOutputGroupDependsOn></SGenFilesOutputGroupDependsOn>
5581   </PropertyGroup>
5582   <ItemGroup
5583       Condition="'$(_SGenGenerateSerializationAssembliesConfig)' == 'On' or ('@(WebReferenceUrl)'!='' and '$(_SGenGenerateSerializationAssembliesConfig)' == 'Auto')">
5584     <SGenFilesOutputGroupOutput Include="@(_OutputPathItem->'%(FullPath)$(_SGenDllName)')">
5585       <FinalOutputPath>@(_OutputPathItem->'%(FullPath)$(_SGenDllName)')</FinalOutputPath>
5586       <TargetPath>$(_SGenDllName)</TargetPath>
5587     </SGenFilesOutputGroupOutput>
5588   </ItemGroup>
5589   <Target
5590       Name="SGenFilesOutputGroup"
5591       Returns="@(SGenFilesOutputGroupOutput)"
5592       DependsOnTargets="$(SGenFilesOutputGroupDependsOn)"/>
5593
5594   <!--
5595     ============================================================
5596                                         SDKRelated Output groups
5597
5598     These targets are to gather information from the SDKs.
5599     ============================================================
5600    -->
5601   <!-- Get the resolved SDK reference items -->
5602   <Target Name="GetResolvedSDKReferences" DependsOnTargets="ResolveSDKReferences" Returns="@(ResolvedSDKReference)"/>
5603
5604   <!--
5605     ============================================================
5606                                         PriFilesOutputGroup
5607
5608     This target performs population of the pri files output group
5609     ============================================================
5610     -->
5611   <Target
5612       Name="PriFilesOutputGroup"
5613       Condition="'@(_ReferenceRelatedPaths)' != ''"
5614       DependsOnTargets="BuildOnlySettings;PrepareForBuild;AssignTargetPaths;ResolveReferences"
5615       Returns="@(PriFilesOutputGroupOutput)">
5616
5617     <!-- This item represents dependent pri file's -->
5618     <ItemGroup>
5619       <PriFilesOutputGroupOutput Include="@(_ReferenceRelatedPaths->'%(FullPath)')" Condition="'%(Extension)' == '.pri'"/>
5620     </ItemGroup>
5621
5622   </Target>
5623
5624   <PropertyGroup>
5625     <SDKRedistOutputGroupDependsOn>ResolveSDKReferences;ExpandSDKReferences</SDKRedistOutputGroupDependsOn>
5626   </PropertyGroup>
5627
5628   <!--
5629     ============================================================
5630                                         SDKRedistOutputGroup
5631
5632     This target gathers the Redist folders from the SDKs which have been resolved.
5633     ============================================================
5634   -->
5635   <Target
5636       Name="SDKRedistOutputGroup"
5637       Returns="@(SDKRedistOutputGroupOutput)"
5638       DependsOnTargets="$(SDKRedistOutputGroupDependsOn)">
5639
5640        <!-- This list starts with the least specific files to the most specific so that later files can overwrite earlier files-->
5641     <ItemGroup>
5642       <SDKRedistOutputGroupOutput Include="@(ResolvedRedistFiles)"/>
5643     </ItemGroup>
5644   </Target>
5645
5646   <!--
5647     ***********************************************************************************************
5648     ***********************************************************************************************
5649                                                                 AllProjectOutputGroupsDependencies Section
5650     ***********************************************************************************************
5651     ***********************************************************************************************
5652     -->
5653
5654   <!--
5655     ============================================================
5656                                         AllProjectOutputGroupsDependencies
5657     ============================================================
5658     -->
5659   <Target
5660       Name="AllProjectOutputGroupsDependencies"
5661       DependsOnTargets="
5662             BuiltProjectOutputGroupDependencies;
5663             DebugSymbolsProjectOutputGroupDependencies;
5664             SatelliteDllsProjectOutputGroupDependencies;
5665             DocumentationProjectOutputGroupDependencies;
5666             SGenFilesOutputGroupDependencies"/>
5667
5668   <!--
5669     ============================================================
5670                                         BuiltProjectOutputGroupDependencies
5671
5672     This target performs population of the Built project output group dependencies.
5673     ============================================================
5674     -->
5675   <Target
5676       Name="BuiltProjectOutputGroupDependencies"
5677       DependsOnTargets="BuildOnlySettings;PrepareForBuild;AssignTargetPaths;ResolveReferences"
5678       Returns="@(BuiltProjectOutputGroupDependency)">
5679
5680     <ItemGroup>
5681       <BuiltProjectOutputGroupDependency  Include="@(ReferencePath->'%(FullPath)');
5682                                                          @(ReferenceDependencyPaths->'%(FullPath)');
5683                                                          @(NativeReferenceFile->'%(FullPath)');
5684                                                          @(_DeploymentLooseManifestFile->'%(FullPath)');
5685                                                          @(ResolvedIsolatedComModules->'%(FullPath)')"/>
5686     </ItemGroup>
5687
5688   </Target>
5689
5690   <!--
5691     ============================================================
5692                                         DebugSymbolsProjectOutputGroupDependencies
5693
5694     This target performs population of the dependencies for the debug symbols project output group.
5695     ============================================================
5696     -->
5697   <Target
5698       Name="DebugSymbolsProjectOutputGroupDependencies"
5699       Condition="'$(DebugSymbols)'!='false'"
5700       DependsOnTargets="BuildOnlySettings;PrepareForBuild;AssignTargetPaths;ResolveReferences"
5701       Returns="@(DebugSymbolsProjectOutputGroupDependency)">
5702
5703     <!-- This item represents dependent PDB's -->
5704     <ItemGroup>
5705       <DebugSymbolsProjectOutputGroupDependency Include="@(_ReferenceRelatedPaths->'%(FullPath)')" Condition="'%(Extension)' == '.pdb'"/>
5706     </ItemGroup>
5707
5708   </Target>
5709
5710   <!--
5711     ============================================================
5712                                         SatelliteDllsProjectOutputGroupDependencies
5713
5714     This target performs population of the dependencies for the satellite files project output group.
5715     ============================================================
5716     -->
5717   <Target
5718       Name="SatelliteDllsProjectOutputGroupDependencies"
5719       DependsOnTargets="BuildOnlySettings;PrepareForBuild;AssignTargetPaths;ResolveReferences"
5720       Returns="@(SatelliteDllsProjectOutputGroupDependency)">
5721
5722     <!-- This item represents dependent satellites -->
5723     <ItemGroup>
5724       <SatelliteDllsProjectOutputGroupDependency Include="@(ReferenceSatellitePaths->'%(FullPath)')"/>
5725     </ItemGroup>
5726
5727   </Target>
5728
5729   <!--
5730     ============================================================
5731                                         DocumentationProjectOutputGroupDependencies
5732
5733     This target performs population of the dependencies for the documentation project output group.
5734     ============================================================
5735     -->
5736   <Target
5737       Name="DocumentationProjectOutputGroupDependencies"
5738       Condition="'$(DocumentationFile)'!=''"
5739       DependsOnTargets="BuildOnlySettings;PrepareForBuild;AssignTargetPaths;ResolveReferences"
5740       Returns="@(DocumentationProjectOutputGroupDependency)">
5741
5742     <!-- This item represents dependent XMLs -->
5743     <ItemGroup>
5744       <DocumentationProjectOutputGroupDependency Include="@(_ReferenceRelatedPaths->'%(FullPath)')" Condition="'%(Extension)' == '.xml'"/>
5745     </ItemGroup>
5746
5747   </Target>
5748
5749   <!--
5750     ============================================================
5751                                         SGenFilesOutputGroupDependencies
5752
5753     This target performs population of the dependencies for the GenerateSerializationAssemblies project output group.
5754     ============================================================
5755     -->
5756   <Target
5757       Name="SGenFilesOutputGroupDependencies"
5758       DependsOnTargets="BuildOnlySettings;PrepareForBuild;AssignTargetPaths;ResolveReferences"
5759       Returns="@(SGenFilesOutputGroupDependency)">
5760
5761     <!-- This item represents sgen xml serializer dll's -->
5762     <ItemGroup>
5763       <SGenFilesOutputGroupDependency Include="@(_ReferenceSerializationAssemblyPaths->'%(FullPath)')" Condition="'%(Extension)' == '.dll'"/>
5764     </ItemGroup>
5765
5766   </Target>
5767
5768   <PropertyGroup>
5769     <CodeAnalysisTargets Condition="'$(CodeAnalysisTargets)'==''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeAnalysis\Microsoft.CodeAnalysis.targets</CodeAnalysisTargets>
5770   </PropertyGroup>
5771
5772   <Import Project="$(CodeAnalysisTargets)" Condition="Exists('$(CodeAnalysisTargets)')"/>
5773
5774   <Import Project="$(ReportingServicesTargets)" Condition="Exists('$(ReportingServicesTargets)')"/>
5775
5776   <Import Project="$(MSBuildToolsPath)\Microsoft.NETFramework.targets" Condition="('$(TargetFrameworkIdentifier)' == ''  or '$(TargetFrameworkIdentifier)' == '.NETFramework') and ('$(TargetRuntime)' == 'Managed')"/>
5777
5778   <PropertyGroup>
5779     <ImportXamlTargets Condition="'$(ImportXamlTargets)'=='' and ('$(TargetFrameworkVersion)' != 'v2.0' and '$(TargetFrameworkVersion)' != 'v3.5') and Exists('$(MSBuildToolsPath)\Microsoft.Xaml.targets')">true</ImportXamlTargets>
5780   </PropertyGroup>
5781
5782   <Import Project="$(MSBuildToolsPath)\Microsoft.Xaml.targets" Condition="('$(ImportXamlTargets)' == 'true')" />
5783
5784   <!-- imports Microsoft.WorkflowBuildExtensions.targets only if TargetFrameworkVersion is v4.5 or above or TargetFrameworkfVersion specified does not conform to the format of vX.X[.X.X] -->
5785   <!-- Underlying assumption is that there shouldn't be any other versions between v4.0.* and v4.5 -->
5786   <Import Project="$(MSBuildToolsPath)\Microsoft.WorkflowBuildExtensions.targets"
5787           Condition="('$(TargetFrameworkVersion)' != 'v2.0' and '$(TargetFrameworkVersion)' != 'v3.5' and (!$([System.String]::IsNullOrEmpty('$(TargetFrameworkVersion)')) and !$(TargetFrameworkVersion.StartsWith('v4.0')))) and Exists('$(MSBuildToolsPath)\Microsoft.WorkflowBuildExtensions.targets')"/>
5788
5789   <!-- This import is temporary and will be removed once it is moved into the silverlight targets -->
5790   <Import Project="$(MSBuildToolsPath)\Microsoft.WinFX.targets" Condition="'$(TargetFrameworkIdentifier)' == 'Silverlight' and Exists('$(MSBuildToolsPath)\Microsoft.WinFX.targets')"/>
5791
5792   <PropertyGroup>
5793     <MsTestToolsTargets Condition="'$(MsTestToolsTargets)'==''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TeamTest\Microsoft.TeamTest.targets</MsTestToolsTargets>
5794   </PropertyGroup>
5795
5796   <Import Project="$(MsTestToolsTargets)" Condition="Exists('$(MsTestToolsTargets)')" />
5797
5798   <!-- App packaging support -->
5799
5800   <!--
5801     Following two targets are needed to be present in every project being built
5802     because the app packaging targets recursively scan all projects referenced
5803     from projects that generate app packages for them.
5804   -->
5805   <Target Name="CleanAppxPackage" />
5806   <Target Name="GetPackagingOutputs" />
5807
5808   <PropertyGroup>
5809     <MsAppxPackageTargets Condition="'$(MsAppxPackageTargets)'==''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\AppxPackage\Microsoft.AppXPackage.Targets</MsAppxPackageTargets>
5810   </PropertyGroup>
5811
5812   <Import Project="$(MsAppxPackageTargets)" Condition="'$(WindowsAppContainer)' == 'true' and Exists('$(MsAppxPackageTargets)')" />
5813
5814   <!-- This import is temporary and will be removed once it is moved into the silverlight targets -->
5815   <Import Project="$(MSBuildToolsPath)\Microsoft.Data.Entity.targets" Condition="'$(TargetFrameworkIdentifier)' == 'Silverlight' and Exists('$(MSBuildToolsPath)\Microsoft.Data.Entity.targets')"/>
5816
5817   <Import Project="$(CustomAfterMicrosoftCommonTargets)" Condition="'$(CustomAfterMicrosoftCommonTargets)' != '' and Exists('$(CustomAfterMicrosoftCommonTargets)')"/>
5818
5819   <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.targets\ImportAfter\*" Condition="'$(ImportByWildcardAfterMicrosoftCommonTargets)' == 'true' and exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.targets\ImportAfter')"/>
5820   <Import Project="$(MSBuildUserExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.targets\ImportAfter\*" Condition="'$(ImportUserLocationsByWildcardAfterMicrosoftCommonTargets)' == 'true' and exists('$(MSBuildUserExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.targets\ImportAfter')"/>
5821
5822 </Project>