2 ***********************************************************************************************
\r
3 Microsoft.NET.Sdk.BeforeCommon.targets
\r
5 WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
\r
6 created a backup copy. Incorrect changes to this file will make it
\r
7 impossible to load or build your projects from the command-line or the IDE.
\r
9 Copyright (c) .NET Foundation. All rights reserved.
\r
10 ***********************************************************************************************
\r
12 <Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
\r
15 <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
\r
16 <_IsExecutable Condition="'$(OutputType)' == 'Exe' or '$(OutputType)'=='WinExe'">true</_IsExecutable>
\r
17 <_NugetFallbackFolder>$(MSBuildThisFileDirectory)..\..\..\..\NuGetFallbackFolder</_NugetFallbackFolder>
\r
20 <PropertyGroup Condition="'$(HasRuntimeOutput)' == ''">
\r
21 <HasRuntimeOutput>$(_IsExecutable)</HasRuntimeOutput>
\r
22 <_UsingDefaultForHasRuntimeOutput>true</_UsingDefaultForHasRuntimeOutput>
\r
25 <Import Project="$(MSBuildThisFileDirectory)Microsoft.NET.DefaultAssemblyInfo.targets" />
\r
27 <!-- Set default intermediate and output paths -->
\r
28 <Import Project="$(MSBuildThisFileDirectory)Microsoft.NET.DefaultOutputPaths.targets" />
\r
31 Expand TargetFramework to TargetFrameworkIdentifier and TargetFrameworkVersion,
\r
32 and adjust intermediate and output paths to include it.
\r
34 <Import Project="$(MSBuildThisFileDirectory)Microsoft.NET.TargetFrameworkInference.targets" />
\r
37 Use RuntimeIdentifier to determine PlatformTarget.
\r
38 Also, enforce that RuntimeIdentifier is always specified for .NETFramework executables.
\r
40 <Import Project="$(MSBuildThisFileDirectory)Microsoft.NET.RuntimeIdentifierInference.targets" />
\r
42 <PropertyGroup Condition="'$(_IsNETCoreOrNETStandard)' == ''">
\r
43 <_IsNETCoreOrNETStandard Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'">true</_IsNETCoreOrNETStandard>
\r
44 <_IsNETCoreOrNETStandard Condition="'$(TargetFrameworkIdentifier)' == '.NETStandard'">true</_IsNETCoreOrNETStandard>
\r
47 <!-- Unification / automatic binding redirect logic -->
\r
49 <DesignTimeAutoUnify Condition="'$(DesignTimeAutoUnify)' == ''">true</DesignTimeAutoUnify>
\r
50 <AutoUnifyAssemblyReferences Condition="'$(AutoUnifyAssemblyReferences)' == '' and $(OutputType) == 'Library'">true</AutoUnifyAssemblyReferences>
\r
51 <AutoUnifyAssemblyReferences Condition="'$(AutoUnifyAssemblyReferences)' == '' and '$(_IsNETCoreOrNETStandard)' == 'true'">true</AutoUnifyAssemblyReferences>
\r
53 <PropertyGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework' and '$(HasRuntimeOutput)' == 'true'">
\r
54 <AutoGenerateBindingRedirects Condition="'$(AutoGenerateBindingRedirects)' == ''">true</AutoGenerateBindingRedirects>
\r
57 <!-- Default settings for .NET Core and .NET Standard build logic -->
\r
58 <PropertyGroup Condition="'$(_IsNETCoreOrNETStandard)' == 'true'">
\r
59 <GenerateDependencyFile Condition=" '$(GenerateDependencyFile)' == '' ">true</GenerateDependencyFile>
\r
61 <!-- Force .dll extension for .NETCoreApp and .NETStandard projects even if output type is exe. -->
\r
62 <TargetExt Condition="'$(TargetExt)' == ''">.dll</TargetExt>
\r
64 <!-- dependencies coming from the package manager lock file should not be copied locally for .NET Core and .NETStandard projects -->
\r
65 <CopyLocalLockFileAssemblies Condition="'$(CopyLocalLockFileAssemblies)' == ''">false</CopyLocalLockFileAssemblies>
\r
68 <!-- Regardless of platform, enable dependency file generation if PreserveCompilatioContext is set. -->
\r
70 <GenerateDependencyFile Condition="'$(GenerateDependencyFile)' == ''">$(PreserveCompilationContext)</GenerateDependencyFile>
\r
73 <!-- Set PublishDir here, before Microsoft.Common.targets, to avoid a competing default there. -->
\r
75 <PublishDirName Condition="'$(PublishDirName)' == ''">publish</PublishDirName>
\r
76 <!-- ensure the PublishDir is RID specific-->
\r
77 <PublishDir Condition="'$(PublishDir)' == '' and
\r
78 '$(AppendRuntimeIdentifierToOutputPath)' != 'true' and
\r
79 '$(RuntimeIdentifier)' != '' and
\r
80 '$(_UsingDefaultRuntimeIdentifier)' != 'true'">$(OutputPath)$(RuntimeIdentifier)\$(PublishDirName)\</PublishDir>
\r
81 <PublishDir Condition="'$(PublishDir)' == ''">$(OutputPath)$(PublishDirName)\</PublishDir>
\r
84 <!-- For .NET Framework, reference core assemblies -->
\r
87 <_TargetFrameworkVersionWithoutV>$(TargetFrameworkVersion)</_TargetFrameworkVersionWithoutV>
\r
88 <_TargetFrameworkVersionWithoutV Condition="$(TargetFrameworkVersion.StartsWith('v'))">$(TargetFrameworkVersion.Substring(1))</_TargetFrameworkVersionWithoutV>
\r
91 <PropertyGroup Condition=" '$(DisableImplicitNuGetFallbackFolder)' != 'true' and '$(_IsNETCoreOrNETStandard)' == 'true' and Exists($(_NugetFallbackFolder)) ">
\r
92 <RestoreAdditionalProjectSources Condition=" '$(_TargetFrameworkVersionWithoutV)' < '2.0' ">$(RestoreAdditionalProjectSources);$(_NugetFallbackFolder)</RestoreAdditionalProjectSources>
\r
94 <RestoreAdditionalProjectFallbackFolders Condition=" '$(_TargetFrameworkVersionWithoutV)' >= '2.0' ">$(RestoreAdditionalProjectFallbackFolders);$(_NugetFallbackFolder)</RestoreAdditionalProjectFallbackFolders>
\r
97 <ItemGroup Condition=" '$(DisableImplicitFrameworkReferences)' != 'true' and '$(TargetFrameworkIdentifier)' == '.NETFramework'">
\r
99 <_SDKImplicitReference Include="System"/>
\r
100 <_SDKImplicitReference Include="System.Data"/>
\r
101 <_SDKImplicitReference Include="System.Drawing"/>
\r
102 <_SDKImplicitReference Include="System.Xml"/>
\r
104 <!-- When doing greater than/less than comparisons between strings, MSBuild will try to parse the strings as Version objects and compare them as
\r
105 such if the parse succeeds. -->
\r
107 <!-- Framework assemblies introduced in .NET 3.5 -->
\r
108 <_SDKImplicitReference Include="System.Core" Condition=" '$(_TargetFrameworkVersionWithoutV)' >= '3.5' "/>
\r
109 <_SDKImplicitReference Include="System.Runtime.Serialization" Condition=" '$(_TargetFrameworkVersionWithoutV)' >= '3.5' "/>
\r
110 <_SDKImplicitReference Include="System.Xml.Linq" Condition=" '$(_TargetFrameworkVersionWithoutV)' >= '3.5' "/>
\r
112 <!-- Framework assemblies introduced in .NET 4.0 -->
\r
113 <_SDKImplicitReference Include="System.Numerics" Condition=" '$(_TargetFrameworkVersionWithoutV)' >= '4.0' "/>
\r
115 <!-- Framework assemblies introduced in .NET 4.5 -->
\r
116 <_SDKImplicitReference Include="System.IO.Compression.FileSystem" Condition=" '$(_TargetFrameworkVersionWithoutV)' >= '4.5' "/>
\r
118 <!-- Don't automatically reference System.IO.Compression or System.Net.Http to help avoid hitting https://github.com/Microsoft/msbuild/issues/1329. -->
\r
119 <!--<Reference Include="System.IO.Compression" Condition=" '$(_TargetFrameworkVersionWithoutV)' >= '4.5' "/>
\r
120 <_SDKImplicitReference Include="System.Net.Http" Condition=" '$(_TargetFrameworkVersionWithoutV)' >= '4.5' "/>-->
\r
122 <!-- Set Pack=false on implicit references so they don't get added to NuGet packages as framework assemblies -->
\r
123 <_SDKImplicitReference Update="@(_SDKImplicitReference)"
\r
126 <!-- Don't duplicate any references that are explicit in the project file. This means that if you do want to include a framework assembly in your
\r
127 NuGet package, you can just add the Reference to your project file. -->
\r
128 <_SDKImplicitReference Remove="@(Reference)" />
\r
130 <!-- Add the implicit references to @(Reference) -->
\r
131 <Reference Include="@(_SDKImplicitReference)" />
\r
135 <!-- Prevent System.Core reference from being added separately (see Microsoft.NETFramework.CurrentVersion.props) -->
\r
136 <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
\r
139 <PropertyGroup Condition="'$(DisableImplicitAssetTargetFallback)' != 'true' and '$(_IsNETCoreOrNETStandard)' == 'true' and '$(_TargetFrameworkVersionWithoutV)' >= '2.0'">
\r
140 <AssetTargetFallback>$(AssetTargetFallback);net461</AssetTargetFallback>
\r
143 <!-- Add conditional compilation symbols for the target framework (for example NET461, NETSTANDARD2_0, NETCOREAPP1_0) -->
\r
144 <PropertyGroup Condition=" '$(DisableImplicitFrameworkDefines)' != 'true' and '$(TargetFrameworkIdentifier)' != '.NETPortable' and '$(TargetFrameworkIdentifier)' != ''">
\r
145 <_FrameworkIdentifierForImplicitDefine>$(TargetFrameworkIdentifier.Replace('.', '').ToUpperInvariant())</_FrameworkIdentifierForImplicitDefine>
\r
146 <_FrameworkIdentifierForImplicitDefine Condition=" '$(TargetFrameworkIdentifier)' == '.NETFramework'">NET</_FrameworkIdentifierForImplicitDefine>
\r
148 <_FrameworkVersionForImplicitDefine Condition="$(TargetFrameworkVersion.StartsWith('v'))">$(TargetFrameworkVersion.SubString(1))</_FrameworkVersionForImplicitDefine>
\r
149 <_FrameworkVersionForImplicitDefine Condition="!$(TargetFrameworkVersion.StartsWith('v'))">$(TargetFrameworkVersion)</_FrameworkVersionForImplicitDefine>
\r
151 <_FrameworkVersionForImplicitDefine>$(_FrameworkVersionForImplicitDefine.Replace('.', '_'))</_FrameworkVersionForImplicitDefine>
\r
153 <_FrameworkVersionForImplicitDefine Condition=" '$(TargetFrameworkIdentifier)' == '.NETFramework'">$(_FrameworkVersionForImplicitDefine.Replace('_', ''))</_FrameworkVersionForImplicitDefine>
\r
155 <ImplicitFrameworkDefine>$(_FrameworkIdentifierForImplicitDefine)$(_FrameworkVersionForImplicitDefine)</ImplicitFrameworkDefine>
\r
158 <!-- Handle XML documentation file settings -->
\r
159 <PropertyGroup Condition="'$(GenerateDocumentationFile)' == ''">
\r
160 <GenerateDocumentationFile Condition="'$(DocumentationFile)' == ''">false</GenerateDocumentationFile>
\r
161 <GenerateDocumentationFile Condition="'$(DocumentationFile)' != ''">true</GenerateDocumentationFile>
\r
164 <PropertyGroup Condition="'$(GenerateDocumentationFile)' == 'true' and '$(DocumentationFile)' == ''">
\r
165 <DocumentationFile>$(IntermediateOutputPath)$(AssemblyName).xml</DocumentationFile>
\r
168 <PropertyGroup Condition="'$(GenerateDocumentationFile)' != 'true'">
\r
169 <DocumentationFile />
\r
173 <PublishDocumentationFiles Condition="'$(PublishDocumentationFiles)' == ''">true</PublishDocumentationFiles>
\r
174 <PublishDocumentationFile Condition="'$(PublishDocumentationFile)' == '' and '$(PublishDocumentationFiles)' == 'true'">true</PublishDocumentationFile>
\r
175 <PublishReferencesDocumentationFiles Condition="'$(PublishReferencesDocumentationFiles)' == '' and '$(PublishDocumentationFiles)' == 'true'">true</PublishReferencesDocumentationFiles>
\r
178 <!-- Add a project capability so that the project properties in the IDE can show the option to generate an XML documentation file without specifying the filename -->
\r
180 <ProjectCapability Include="GenerateDocumentationFile" />
\r