Unpack dotnet sdk zipfile and add documentation file to nupkg
[platform/core/dotnet/build-tools.git] / dotnet / sdk / 2.0.0-preview1-005700 / Sdks / Microsoft.NET.Sdk / build / Microsoft.NET.Sdk.DefaultItems.targets
1 <!--\r
2 ***********************************************************************************************\r
3 Microsoft.NET.Sdk.DefaultItems.targets\r
4 \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
8 \r
9 Copyright (c) .NET Foundation. All rights reserved. \r
10 ***********************************************************************************************\r
11 -->\r
12 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
13 \r
14   <PropertyGroup>\r
15     <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>\r
16   </PropertyGroup>\r
17 \r
18   <PropertyGroup>\r
19    <EnableDefaultItems Condition=" '$(EnableDefaultItems)' == '' ">true</EnableDefaultItems>\r
20    <EnableDefaultCompileItems Condition=" '$(EnableDefaultCompileItems)' == '' ">true</EnableDefaultCompileItems>\r
21     <EnableDefaultEmbeddedResourceItems Condition=" '$(EnableDefaultEmbeddedResourceItems)' == '' ">true</EnableDefaultEmbeddedResourceItems>\r
22     <EnableDefaultNoneItems Condition=" '$(EnableDefaultNoneItems)' == '' ">true</EnableDefaultNoneItems>\r
23   </PropertyGroup>\r
24 \r
25   <PropertyGroup>    \r
26     <!-- Set DefaultItemExcludes property for items that should be excluded from the default Compile, etc items.\r
27          This is in the .targets because it needs to come after the final BaseOutputPath has been evaluated. -->\r
28     \r
29     <!-- bin folder, by default -->\r
30     <DefaultItemExcludes>$(DefaultItemExcludes);$(BaseOutputPath)/**</DefaultItemExcludes>\r
31     <!-- obj folder, by default -->\r
32     <DefaultItemExcludes>$(DefaultItemExcludes);$(BaseIntermediateOutputPath)/**</DefaultItemExcludes>\r
33 \r
34     <!-- Various files that should generally always be ignored -->\r
35     <DefaultItemExcludes>$(DefaultItemExcludes);**/*.user</DefaultItemExcludes>\r
36     <DefaultItemExcludes>$(DefaultItemExcludes);**/*.*proj</DefaultItemExcludes>\r
37     <DefaultItemExcludes>$(DefaultItemExcludes);**/*.sln</DefaultItemExcludes>\r
38     <DefaultItemExcludes>$(DefaultItemExcludes);**/*.vssscc</DefaultItemExcludes>\r
39     \r
40     <!-- WARNING: This pattern is there to ignore folders such as .git and .vs, but it will also match items included with a\r
41          relative path outside the project folder (for example "..\Shared\Shared.cs").  So be sure only to apply it to items\r
42          that are in the project folder. -->\r
43     <DefaultExcludesInProjectFolder>$(DefaultItemExcludesInProjectFolder);**/.*/**</DefaultExcludesInProjectFolder>\r
44 \r
45     <!-- TODO: Verify why this was originally added and whether we really need it -->\r
46     <DefaultItemExcludes>$(DefaultItemExcludes);packages/**</DefaultItemExcludes>\r
47     \r
48   </PropertyGroup>\r
49 \r
50   <!-- Set the default versions of the NETStandard.Library or Microsoft.NETCore.App packages to reference.\r
51        The implicit package references themselves are defined in Microsoft.NET.Sdk.props, so that they can be overridden\r
52        in the project file. -->\r
53   <PropertyGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETStandard'">\r
54     <!-- If targeting the same release that is bundled with the .NET Core SDK, use the bundled package version provided by Microsoft.NETCoreSdk.BundledVersions.props -->\r
55     <NETStandardImplicitPackageVersion Condition="'$(NETStandardImplicitPackageVersion)' =='' And '$(_TargetFrameworkVersionWithoutV)' == '$(BundledNETStandardTargetFrameworkVersion)'">$(BundledNETStandardPackageVersion)</NETStandardImplicitPackageVersion>\r
56 \r
57     <!-- Default to use v1.6.1 (latest stable release) -->\r
58     <NETStandardImplicitPackageVersion Condition="'$(NETStandardImplicitPackageVersion)' ==''">1.6.1</NETStandardImplicitPackageVersion>\r
59   </PropertyGroup>\r
60   \r
61   <!--  \r
62     Determine the NetCoreImplicitPackageVersion and RuntimeFrameworkVersion when targeting .NET Core\r
63     \r
64     When targeting .NET Core, the TargetFramework is generally used to specify which version of the runtime to use.\r
65     \r
66     In order to target a specific patch version, or to float the version number (2.0-*), the RuntimeFrameworkVersion\r
67     property can be used.\r
68     \r
69     The framework version that is written to the runtimeconfig.json file is based on the actual resolved package version\r
70     of Microsoft.NETCore.App.  This is to allow floating the verion number.\r
71   \r
72   -->\r
73 \r
74   <PropertyGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'">\r
75     <!-- If targeting .NET Core, and the RuntimeFrameworkVersion is not specified, use the latest patch version of that runtime that we know about.\r
76     \r
77       This ensures that if a self-contained app is published where RuntimeFrameworkVersion is not specified, the latest patch\r
78       version of the runtime (that the SDK knew about when it shipped) will be used.\r
79       \r
80       This also will fix an issue where Microsoft.NETCore.App 1.1.0 included a version of the Microsoft.DiaSymReader.Native package\r
81       that was authored in such a way that Microsoft.DiaSymReader.Native.amd64.dll and Microsoft.DiaSymReader.Native.x86.dll would\r
82       be copied to the output folder.  Using Microsoft.NETCore.App 1.1.1 fixes this, as it references an updated version of the\r
83       DiaSymReader package with the issue fixed.  (See https://github.com/dotnet/corefx/issues/14627)\r
84       \r
85       Using the latest patch version that the SDK knows about does mean that an update to the SDK could change the version of\r
86       the runtime that a project targets.  In general, this should be OK.  If a project wants to opt out of this, it can specify\r
87       the exact version of the runtime to use with the RuntimeFrameworkVersion property.    \r
88     -->\r
89     <!-- If targeting netcoreapp1.1, and RuntimeFrameworkVersion is not specified, use version 1.1.1 -->\r
90     <RuntimeFrameworkVersion Condition="'$(RuntimeFrameworkVersion)' == '' And '$(_TargetFrameworkVersionWithoutV)' == '1.0'">1.0.4</RuntimeFrameworkVersion>\r
91     <RuntimeFrameworkVersion Condition="'$(RuntimeFrameworkVersion)' == '' And '$(_TargetFrameworkVersionWithoutV)' == '1.1'">1.1.1</RuntimeFrameworkVersion>\r
92 \r
93     <!-- If targeting the same release that is bundled with the .NET Core SDK, use the bundled package version provided by Microsoft.NETCoreSdk.BundledVersions.props -->\r
94     <RuntimeFrameworkVersion Condition="'$(RuntimeFrameworkVersion)' == '' And '$(_TargetFrameworkVersionWithoutV)' == '$(BundledNETCoreAppTargetFrameworkVersion)'">$(BundledNETCoreAppPackageVersion)</RuntimeFrameworkVersion>\r
95     \r
96     <!-- Default to use the version of the framework runtime matching the target framework version-->\r
97     <RuntimeFrameworkVersion Condition="'$(RuntimeFrameworkVersion)' == ''">$(_TargetFrameworkVersionWithoutV)</RuntimeFrameworkVersion>\r
98   </PropertyGroup>\r
99 \r
100   <UsingTask TaskName="CheckForImplicitPackageReferenceOverrides" AssemblyFile="$(MicrosoftNETBuildTasksAssembly)" />\r
101 \r
102   <!-- Remove package references with metadata IsImplicitlyDefined = true, if there are other PackageReference items with the same identity -->\r
103   <Target Name="CheckForImplicitPackageReferenceOverrides" BeforeTargets="_CheckForInvalidConfigurationAndPlatform;CollectPackageReferences">\r
104     <PropertyGroup>\r
105       <ImplicitPackageReferenceInformationLink>https://aka.ms/sdkimplicitrefs</ImplicitPackageReferenceInformationLink>\r
106     </PropertyGroup>\r
107 \r
108     <CheckForImplicitPackageReferenceOverrides\r
109         PackageReferenceItems="@(PackageReference)"\r
110         MoreInformationLink="$(ImplicitPackageReferenceInformationLink)">\r
111       <Output TaskParameter="ItemsToRemove" ItemName="_PackageReferenceToRemove" />\r
112     </CheckForImplicitPackageReferenceOverrides>\r
113 \r
114     <ItemGroup>\r
115       <!-- Note that the condition here is important, otherwise the Remove will operate based just on item identity and remove all items\r
116            that had duplicates, instead of leaving the ones without IsImplicitlyDefined set to true. -->\r
117       <PackageReference Remove="@(_PackageReferenceToRemove)" Condition="'%(PackageReference.IsImplicitlyDefined)' == 'true' "/>\r
118     </ItemGroup>\r
119 \r
120   </Target>\r
121 \r
122   <!-- Running an SDK task before the NuGet restore task causes issues when running on .NET Framework because it causes the\r
123       .NET Standard NuGet DLLs to be loaded from the SDK path rather than the .NET Framework versions from the NuGet targets\r
124       path.  To avoid this, we create a separate target to run before NuGet restore which deduplicates the items without\r
125       causing the SDK tasks to be loaded (but doesn't generate a warning message, because we need to load the tasks for that). -->\r
126   <PropertyGroup Condition="'$(DisableImplicitFrameworkReferences)' != 'true'">\r
127     <_ImplicitPackageName Condition="'$(TargetFrameworkIdentifier)' == '.NETStandard'">NETStandard.Library</_ImplicitPackageName>\r
128     <_ImplicitPackageName Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'">Microsoft.NETCore.App</_ImplicitPackageName>\r
129   </PropertyGroup>\r
130 \r
131   <ItemGroup Condition="'$(_ImplicitPackageName)' != ''">\r
132     <!-- Filter PackageReference to items where the ItemSpec matches the implicit package name, and add IsImplicitlyDefined metadata\r
133          for items that don't have it-->\r
134     <_ImplicitPackageReferenceCheck\r
135         Include="@(PackageReference->WithMetadataValue('Identity', '$(_ImplicitPackageName)'))">\r
136       <IsImplicitlyDefined Condition="'%(IsImplicitlyDefined)' != 'true' ">false</IsImplicitlyDefined>\r
137     </_ImplicitPackageReferenceCheck>\r
138 \r
139     <!-- Now filter down to an item with just the implicit reference and another one with just the overriding reference -->\r
140     <_ImplicitPackageReference Include="@(_ImplicitPackageReferenceCheck->WithMetadataValue('IsImplicitlyDefined', 'true'))"/>\r
141     <_OverridingPackageReference Include="@(_ImplicitPackageReferenceCheck->WithMetadataValue('IsImplicitlyDefined', 'false'))"/>\r
142   </ItemGroup>\r
143 \r
144   <Target Name="CheckForImplicitPackageReferenceOverridesBeforeRestore" BeforeTargets="_GetRestoreProjectStyle">\r
145     <ItemGroup>\r
146       <!-- Remove both the implicit and the override item, if there was both an implicit and an override item -->\r
147       <PackageReference Remove="@(PackageReference->WithMetadataValue('Identity', '$(_ImplicitPackageName)'))"\r
148                         Condition="'@(_ImplicitPackageReference)' != '' And '@(_OverridingPackageReference)' != ''"\r
149                       />\r
150 \r
151       <!-- Add the override item back -->\r
152       <PackageReference Include="@(_OverridingPackageReference)"\r
153                         Condition="'@(_ImplicitPackageReference)' != '' And '@(_OverridingPackageReference)' != ''" />\r
154     </ItemGroup>\r
155   </Target>\r
156 \r
157   <UsingTask TaskName="CheckForDuplicateItems" AssemblyFile="$(MicrosoftNETBuildTasksAssembly)" />\r
158 \r
159   <Target Name="CheckForDuplicateItems" BeforeTargets="_CheckForInvalidConfigurationAndPlatform;CoreCompile">\r
160 \r
161     <PropertyGroup>\r
162       <DefaultItemsMoreInformationLink>https://aka.ms/sdkimplicititems</DefaultItemsMoreInformationLink>\r
163 \r
164       <!-- For the design-time build, we will continue on error and remove the duplicate items.\r
165            This is because otherwise there won't be any references to pass to the compiler, leading to design-time\r
166            compilation errors for every API that is used in the project.  Amidst all the compile errors, it would\r
167            be easy to miss the duplicate items error which is the real source of the problem. -->\r
168       <CheckForDuplicateItemsContinueOnError>false</CheckForDuplicateItemsContinueOnError>\r
169       <CheckForDuplicateItemsContinueOnError Condition="'$(DesignTimeBuild)' == 'true'">ErrorAndContinue</CheckForDuplicateItemsContinueOnError>\r
170     </PropertyGroup>\r
171 \r
172     <CheckForDuplicateItems\r
173       Items="@(Compile)"\r
174       ItemName="Compile"\r
175       DefaultItemsEnabled="$(EnableDefaultItems)"\r
176       DefaultItemsOfThisTypeEnabled="$(EnableDefaultCompileItems)"\r
177       PropertyNameToDisableDefaultItems="EnableDefaultCompileItems"\r
178       MoreInformationLink="$(DefaultItemsMoreInformationLink)"\r
179       ContinueOnError="$(CheckForDuplicateItemsContinueOnError)">\r
180       <Output TaskParameter="DeduplicatedItems" ItemName="DeduplicatedCompileItems" />\r
181     </CheckForDuplicateItems>\r
182 \r
183     <CheckForDuplicateItems\r
184       Items="@(EmbeddedResource)"\r
185       ItemName="EmbeddedResource"\r
186       DefaultItemsEnabled="$(EnableDefaultItems)"\r
187       DefaultItemsOfThisTypeEnabled="$(EnableDefaultEmbeddedResourceItems)"\r
188       PropertyNameToDisableDefaultItems="EnableDefaultEmbeddedResourceItems"\r
189       MoreInformationLink="$(DefaultItemsMoreInformationLink)"\r
190       ContinueOnError="$(CheckForDuplicateItemsContinueOnError)">\r
191       <Output TaskParameter="DeduplicatedItems" ItemName="DeduplicatedEmbeddedResourceItems" />\r
192     </CheckForDuplicateItems>\r
193     \r
194     <!-- Default content items are enabled by the Web SDK, not the .NET SDK, but we check it here for simplicity -->\r
195     <CheckForDuplicateItems\r
196       Items="@(Content)"\r
197       ItemName="Content"\r
198       DefaultItemsEnabled="$(EnableDefaultItems)"\r
199       DefaultItemsOfThisTypeEnabled="$(EnableDefaultContentItems)"\r
200       PropertyNameToDisableDefaultItems="EnableDefaultContentItems"\r
201       MoreInformationLink="$(DefaultItemsMoreInformationLink)"\r
202       ContinueOnError="$(CheckForDuplicateItemsContinueOnError)">\r
203       <Output TaskParameter="DeduplicatedItems" ItemName="DeduplicatedContentItems" />\r
204     </CheckForDuplicateItems>\r
205 \r
206     <ItemGroup Condition="'$(DesignTimeBuild)' == 'true' And '@(DeduplicatedCompileItems)' != ''">\r
207       <Compile Remove="@(Compile)" />\r
208       <Compile Include="@(DeduplicatedCompileItems)" />\r
209     </ItemGroup>\r
210 \r
211     <ItemGroup Condition="'$(DesignTimeBuild)' == 'true' And '@(DeduplicatedEmbeddedResourceItems)' != ''">\r
212       <EmbeddedResource Remove="@(EmbeddedResource)" />\r
213       <EmbeddedResource Include="@(DeduplicatedEmbeddedResourceItems)" />\r
214     </ItemGroup>\r
215 \r
216     <ItemGroup Condition="'$(DesignTimeBuild)' == 'true' And '@(DeduplicatedContentItems)' != ''">\r
217       <Content Remove="@(Content)" />\r
218       <Content Include="@(DeduplicatedContentItems)" />\r
219     </ItemGroup>\r
220     \r
221   </Target>\r
222 </Project>\r