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
18 <Import Project="$(MSBuildThisFileDirectory)Microsoft.NET.DefaultAssemblyInfo.targets" />
\r
20 <!-- Set default intermediate and output paths -->
\r
21 <Import Project="$(MSBuildThisFileDirectory)Microsoft.NET.DefaultOutputPaths.targets" />
\r
24 Expand TargetFramework to TargetFrameworkIdentifier and TargetFrameworkVersion,
\r
25 and adjust intermediate and output paths to include it.
\r
27 <Import Project="$(MSBuildThisFileDirectory)Microsoft.NET.TargetFrameworkInference.targets" />
\r
30 Use RuntimeIdentifier to determine PlatformTarget.
\r
31 Also, enforce that RuntimeIdentifier is always specified for .NETFramework executables.
\r
33 <Import Project="$(MSBuildThisFileDirectory)Microsoft.NET.RuntimeIdentifierInference.targets" />
\r
35 <PropertyGroup Condition="'$(_IsNETCoreOrNETStandard)' == ''">
\r
36 <_IsNETCoreOrNETStandard Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'">true</_IsNETCoreOrNETStandard>
\r
37 <_IsNETCoreOrNETStandard Condition="'$(TargetFrameworkIdentifier)' == '.NETStandard'">true</_IsNETCoreOrNETStandard>
\r
40 <!-- Unification / automatic binding redirect logic -->
\r
42 <DesignTimeAutoUnify Condition="'$(DesignTimeAutoUnify)' == ''">true</DesignTimeAutoUnify>
\r
43 <AutoUnifyAssemblyReferences Condition="'$(AutoUnifyAssemblyReferences)' == '' and $(OutputType) == 'Library'">true</AutoUnifyAssemblyReferences>
\r
44 <AutoUnifyAssemblyReferences Condition="'$(AutoUnifyAssemblyReferences)' == '' and '$(_IsNETCoreOrNETStandard)' == 'true'">true</AutoUnifyAssemblyReferences>
\r
46 <PropertyGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework' and '$(OutputType)' == 'Exe'">
\r
47 <AutoGenerateBindingRedirects Condition="'$(AutoGenerateBindingRedirects)' == ''">true</AutoGenerateBindingRedirects>
\r
50 <!-- Default settings for .NET Core and .NET Standard build logic -->
\r
51 <PropertyGroup Condition="'$(_IsNETCoreOrNETStandard)' == 'true'">
\r
52 <GenerateDependencyFile Condition=" '$(GenerateDependencyFile)' == '' ">true</GenerateDependencyFile>
\r
54 <!-- Force .dll extension for .NETCoreApp and .NETStandard projects even if output type is exe. -->
\r
55 <TargetExt Condition="'$(TargetExt)' == ''">.dll</TargetExt>
\r
57 <!-- dependencies coming from the package manager lock file should not be copied locally for .NET Core and .NETStandard projects -->
\r
58 <CopyLocalLockFileAssemblies Condition="'$(CopyLocalLockFileAssemblies)' == ''">false</CopyLocalLockFileAssemblies>
\r
61 <!-- Regardless of platform, enable dependency file generation if PreserveCompilatioContext is set. -->
\r
63 <GenerateDependencyFile Condition="'$(GenerateDependencyFile)' == ''">$(PreserveCompilationContext)</GenerateDependencyFile>
\r
66 <!-- Set PublishDir here, before Microsoft.Common.targets, to avoid a competing default there. -->
\r
68 <PublishDirName Condition="'$(PublishDirName)' == ''">publish</PublishDirName>
\r
69 <!-- ensure the PublishDir is RID specific-->
\r
70 <PublishDir Condition="'$(PublishDir)' == '' and
\r
71 '$(AppendRuntimeIdentifierToOutputPath)' != 'true' and
\r
72 '$(RuntimeIdentifier)' != '' and
\r
73 '$(_UsingDefaultRuntimeIdentifier)' != 'true'">$(OutputPath)$(RuntimeIdentifier)\$(PublishDirName)\</PublishDir>
\r
74 <PublishDir Condition="'$(PublishDir)' == ''">$(OutputPath)$(PublishDirName)\</PublishDir>
\r
77 <!-- For .NET Framework, reference core assemblies -->
\r
80 <_TargetFrameworkVersionWithoutV>$(TargetFrameworkVersion)</_TargetFrameworkVersionWithoutV>
\r
81 <_TargetFrameworkVersionWithoutV Condition="$(TargetFrameworkVersion.StartsWith('v'))">$(TargetFrameworkVersion.Substring(1))</_TargetFrameworkVersionWithoutV>
\r
84 <ItemGroup Condition=" '$(DisableImplicitFrameworkReferences)' != 'true' and '$(TargetFrameworkIdentifier)' == '.NETFramework'">
\r
86 <Reference Include="System"/>
\r
87 <Reference Include="System.Data"/>
\r
88 <Reference Include="System.Drawing"/>
\r
89 <Reference Include="System.Xml"/>
\r
91 <!-- When doing greater than/less than comparisons between strings, MSBuild will try to parse the strings as Version objects and compare them as
\r
92 such if the parse succeeds. -->
\r
94 <!-- Framework assemblies introduced in .NET 3.5 -->
\r
95 <Reference Include="System.Core" Condition=" '$(_TargetFrameworkVersionWithoutV)' >= '3.5' "/>
\r
96 <Reference Include="System.Runtime.Serialization" Condition=" '$(_TargetFrameworkVersionWithoutV)' >= '3.5' "/>
\r
97 <Reference Include="System.Xml.Linq" Condition=" '$(_TargetFrameworkVersionWithoutV)' >= '3.5' "/>
\r
99 <!-- Framework assemblies introduced in .NET 4.0 -->
\r
100 <Reference Include="System.Numerics" Condition=" '$(_TargetFrameworkVersionWithoutV)' >= '4.0' "/>
\r
102 <!-- Framework assemblies introduced in .NET 4.5 -->
\r
103 <Reference Include="System.IO.Compression.FileSystem" Condition=" '$(_TargetFrameworkVersionWithoutV)' >= '4.5' "/>
\r
105 <!-- Don't automatically reference System.IO.Compression or System.Net.Http to help avoid hitting https://github.com/Microsoft/msbuild/issues/1329. -->
\r
106 <!--<Reference Include="System.IO.Compression" Condition=" '$(_TargetFrameworkVersionWithoutV)' >= '4.5' "/>
\r
107 <Reference Include="System.Net.Http" Condition=" '$(_TargetFrameworkVersionWithoutV)' >= '4.5' "/>-->
\r
111 <!-- Add conditional compilation symbols for the target framework (for example NET461, NETSTANDARD2_0, NETCOREAPP1_0) -->
\r
112 <PropertyGroup Condition=" '$(DisableImplicitFrameworkDefines)' != 'true' and '$(TargetFrameworkIdentifier)' != '.NETPortable'">
\r
113 <_FrameworkIdentifierForImplicitDefine>$(TargetFrameworkIdentifier.Replace('.', '').ToUpperInvariant())</_FrameworkIdentifierForImplicitDefine>
\r
114 <_FrameworkIdentifierForImplicitDefine Condition=" '$(TargetFrameworkIdentifier)' == '.NETFramework'">NET</_FrameworkIdentifierForImplicitDefine>
\r
116 <_FrameworkVersionForImplicitDefine Condition="$(TargetFrameworkVersion.StartsWith('v'))">$(TargetFrameworkVersion.SubString(1))</_FrameworkVersionForImplicitDefine>
\r
117 <_FrameworkVersionForImplicitDefine Condition="!$(TargetFrameworkVersion.StartsWith('v'))">$(TargetFrameworkVersion)</_FrameworkVersionForImplicitDefine>
\r
119 <_FrameworkVersionForImplicitDefine>$(_FrameworkVersionForImplicitDefine.Replace('.', '_'))</_FrameworkVersionForImplicitDefine>
\r
121 <_FrameworkVersionForImplicitDefine Condition=" '$(TargetFrameworkIdentifier)' == '.NETFramework'">$(_FrameworkVersionForImplicitDefine.Replace('_', ''))</_FrameworkVersionForImplicitDefine>
\r
123 <ImplicitFrameworkDefine>$(_FrameworkIdentifierForImplicitDefine)$(_FrameworkVersionForImplicitDefine)</ImplicitFrameworkDefine>
\r
126 <!-- Handle XML documentation file settings -->
\r
127 <PropertyGroup Condition="'$(GenerateDocumentationFile)' == ''">
\r
128 <GenerateDocumentationFile Condition="'$(DocumentationFile)' == ''">false</GenerateDocumentationFile>
\r
129 <GenerateDocumentationFile Condition="'$(DocumentationFile)' != ''">true</GenerateDocumentationFile>
\r
132 <PropertyGroup Condition="'$(GenerateDocumentationFile)' == 'true' and '$(DocumentationFile)' == ''">
\r
133 <DocumentationFile>$(IntermediateOutputPath)$(AssemblyName).xml</DocumentationFile>
\r
136 <PropertyGroup Condition="'$(GenerateDocumentationFile)' != 'true'">
\r
137 <DocumentationFile />
\r
140 <!-- 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
142 <ProjectCapability Include="GenerateDocumentationFile" />
\r