[xbuild] Add Microsoft.NuGet.Build.Tasks.dll MSBuild task
[mono.git] / mcs / tools / xbuild / data / 14.0 / Microsoft.Common.targets
index 36f1255986367683a50963fd20ef08531d383fc8..12ec8ec2393ef4d06b0db7a3bdb72819856a0bcb 100644 (file)
@@ -1,4 +1,6 @@
 <Project DefaultTargets="Build" InitialTargets="_ValidateEssentialProperties" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+       <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="'$(MicrosoftCommonPropsHasBeenImported)' != 'true' and Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+
        <PropertyGroup>
                <ImportByWildcardBeforeMicrosoftCommonTargets Condition="'$(ImportByWildcardBeforeMicrosoftCommonTargets)' == ''">true</ImportByWildcardBeforeMicrosoftCommonTargets>
                <ImportByWildcardAfterMicrosoftCommonTargets Condition="'$(ImportByWildcardAfterMicrosoftCommonTargets)' == ''">true</ImportByWildcardAfterMicrosoftCommonTargets>
@@ -30,7 +32,6 @@
                <AssemblyName Condition="'$(AssemblyName)' == ''">$(MSBuildProjectName)</AssemblyName>
                <OutputPath Condition="'$(OutputPath)' != '' and !HasTrailingSlash('$(OutputPath)')">$(OutputPath)\</OutputPath>
                <OutputPath Condition=" '$(Platform)'=='' and '$(Configuration)'=='' and '$(OutputPath)'=='' ">bin\Debug\</OutputPath>
-               <WarningLevel Condition="'$(WarningLevel)' == ''" >2</WarningLevel>
 
                <TargetFrameworkIdentifier Condition="'$(TargetFrameworkIdentifier)' == ''">.NETFramework</TargetFrameworkIdentifier>
                <TargetFrameworkVersion Condition="'$(TargetFrameworkVersion)' == ''">v4.0</TargetFrameworkVersion>
                        Text="OutDir property must end with a slash."/>
        </Target>
 
-       <Target Name="PrepareForBuild">
+       <PropertyGroup>
+               <PrepareForBuildDependsOn>AssignLinkMetadata</PrepareForBuildDependsOn>
+       </PropertyGroup>
+       <Target Name="PrepareForBuild" DependsOnTargets="$(PrepareForBuildDependsOn)">
                <Message Importance="High" Text="Configuration: $(Configuration) Platform: $(Platform)"/>
 
                <!-- Look for app.config, if $(AppConfig) is specified, then use that. Else look in
                />
        </Target>
 
+       <Target Name="AssignLinkMetadata">
+           <AssignLinkMetadata Items="@(EmbeddedResource)" Condition="'@(EmbeddedResource)' != '' and '%(EmbeddedResource.DefiningProjectFullPath)' != '$(MSBuildProjectFullPath)'">
+             <Output TaskParameter="OutputItems" ItemName="_EmbeddedResourceWithLinkAssigned" />
+           </AssignLinkMetadata>
+
+           <ItemGroup>
+               <EmbeddedResource Remove="@(_EmbeddedResourceWithLinkAssigned)" />
+               <EmbeddedResource Include="@(_EmbeddedResourceWithLinkAssigned)" />
+               <_EmbeddedResourceWithLinkAssigned Remove="@(_EmbeddedResourceWithLinkAssigned)" />
+           </ItemGroup>
+       </Target>
+
        <PropertyGroup>
                <GetFrameworkPathsDependsOn />
        </PropertyGroup>
                Condition="'$(TargetFrameworkIdentifier)' == '' or '$(TargetFrameworkIdentifier)' == '.NETFramework'"
                DependsOnTargets="$(GetFrameworkPathsDependsOn)">
                <GetFrameworkPath>
-                       <Output Condition="'$(TargetFrameworkVersion)' == 'v4.5' and '$(TargetFrameworkVersion)' == 'v4.5.1'"
+                       <Output Condition="'$(TargetFrameworkVersion)' == 'v4.5' or '$(TargetFrameworkVersion)' == 'v4.5.1' or '$(TargetFrameworkVersion)' == 'v4.5.2' or '$(TargetFrameworkVersion)' == 'v4.6' or '$(TargetFrameworkVersion)' == 'v4.6.1'"
                                TaskParameter="FrameworkVersion45Path"
                                ItemName="_CombinedTargetFrameworkDirectoriesItem"/>
                        <Output Condition="'$(TargetFrameworkVersion)' == 'v4.0'"
                </CreateProperty>
 
                <Warning Text="TargetFrameworkVersion '$(TargetFrameworkVersion)' not supported by this toolset (ToolsVersion: $(MSBuildToolsVersion))."
-                       Condition="'$(TargetFrameworkVersion)' != 'v4.5.1' and '$(TargetFrameworkVersion)' != 'v4.5' and '$(TargetFrameworkVersion)' != 'v4.0' and '$(TargetFrameworkVersion)' != 'v3.5' and '$(TargetFrameworkVersion)' != 'v3.0' and '$(TargetFrameworkVersion)' != 'v2.0'"/>
+                       Condition="'$(TargetFrameworkVersion)' != 'v4.6.1' and '$(TargetFrameworkVersion)' != 'v4.6' and '$(TargetFrameworkVersion)' != 'v4.5.2' and '$(TargetFrameworkVersion)' != 'v4.5.1' and '$(TargetFrameworkVersion)' != 'v4.5' and '$(TargetFrameworkVersion)' != 'v4.0' and '$(TargetFrameworkVersion)' != 'v3.5' and '$(TargetFrameworkVersion)' != 'v3.0' and '$(TargetFrameworkVersion)' != 'v2.0'"/>
        </Target>
 
        <PropertyGroup>
                <AllowedReferenceRelatedFileExtensions Condition=" '$(AllowedReferenceRelatedFileExtensions)' == '' ">
                        .exe.mdb;
                        .dll.mdb;
+                       .pdb;
                        .xml
                </AllowedReferenceRelatedFileExtensions>
 
                        <Output TaskParameter="RelatedFiles" ItemName="_ReferenceRelatedPaths"/>
                        <Output TaskParameter="SatelliteFiles" ItemName="ReferenceSatellitePaths"/>
                        <Output TaskParameter="CopyLocalFiles" ItemName="ReferenceCopyLocalPaths"/>
-
+                       <Output TaskParameter="DependsOnSystemRuntime" PropertyName="DependsOnSystemRuntime"/>
+                       
                        <!-- FIXME: backwards compatibility -->
                        <Output TaskParameter="ResolvedDependencyFiles" ItemName="_ResolvedDependencyFiles"/>
                </ResolveAssemblyReference>
                <AssignProjectConfiguration
                        ProjectReferences = "@(ProjectReference)"
                        SolutionConfigurationContents = "$(CurrentSolutionConfigurationContents)"
-                       Condition="'$(BuildingSolutionFile)' == 'true' or '$(BuildingInsideVisualStudio)' == 'true'">
+                       Condition="$(CurrentSolutionConfigurationContents) != '' and ('$(BuildingSolutionFile)' == 'true' or '$(BuildingInsideVisualStudio)' == 'true')">
 
                        <Output TaskParameter = "AssignedProjects" ItemName = "ProjectReferenceWithConfiguration"/>
                </AssignProjectConfiguration>
 
                <!-- Else, just -->
-               <CreateItem Include="@(ProjectReference)" Condition="'$(BuildingSolutionFile)' != 'true' and '$(BuildingInsideVisualStudio)' != 'true'">
+               <CreateItem Include="@(ProjectReference)" Condition="$(CurrentSolutionConfigurationContents) == '' or ('$(BuildingSolutionFile)' != 'true' and '$(BuildingInsideVisualStudio)' != 'true')">
                        <Output TaskParameter="Include" ItemName="ProjectReferenceWithConfiguration"/>
                </CreateItem>
 
                        <Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
                </Copy>
 
+               <Copy
+                       SourceFiles="$(IntermediateOutputPath)$(AssemblyName).pdb"
+                       Condition="'$(OutDir)' != '' and Exists('$(IntermediateOutputPath)$(AssemblyName).pdb')"
+                       DestinationFolder="$(OutDir)"
+                       SkipUnchangedFiles="$(SkipCopyUnchangedFiles)" >
+                       <Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
+               </Copy>
+
                <Copy SourceFiles="@(IntermediateAssembly)" Condition="'$(OutDir)' != '' and Exists ('@(IntermediateAssembly)')" DestinationFolder="$(OutDir)" SkipUnchangedFiles="$(SkipCopyUnchangedFiles)">
                        <Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
                </Copy>
                        Condition="Exists('$(IntermediateOutputPath)$(AssemblyName)$(TargetExt).mdb')">
                        <Output TaskParameter="Include" ItemName="FileWrites"/>
                </CreateItem>
+
+               <CreateItem Include="$(IntermediateOutputPath)$(AssemblyName).pdb"
+                       Condition="Exists('$(IntermediateOutputPath)$(AssemblyName).pdb')">
+                       <Output TaskParameter="Include" ItemName="FileWrites"/>
+               </CreateItem>
        </Target>
 
        <!-- Get the list of files written, for clean -->
        <Target Name="ImplicitlyExpandDesignTimeFacades" Condition="'$(ImplicitlyExpandDesignTimeFacades)' == 'true'" DependsOnTargets="$(ImplicitlyExpandDesignTimeFacadesDependsOn)">
 
                <PropertyGroup>
-                       <_HasReferenceToSystemRuntime Condition="'%(_ResolvedDependencyFiles.Filename)' == 'System.Runtime'">true</_HasReferenceToSystemRuntime>
+                       <!-- Does one of our dependencies reference a System.Runtime-based portable library? -->
+                       <_HasReferenceToSystemRuntime Condition="'$(DependsOnSystemRuntime)' == 'true' or '%(_ResolvedProjectReferencePaths.TargetPlatformIdentifier)' == 'Portable'">true</_HasReferenceToSystemRuntime>
                </PropertyGroup>
 
                <ItemGroup Condition="'$(_HasReferenceToSystemRuntime)' == 'true'">