Multitarget core sdk tasks

This commit is contained in:
Daniel Plaisted 2018-10-29 11:37:13 -07:00
parent f3a3130dbe
commit b155e4e8bf
3 changed files with 17 additions and 3 deletions

View file

@ -73,7 +73,13 @@ namespace Microsoft.DotNet.Build.Tasks
{
if (ValidateParameters())
{
#if NETFRAMEWORK
// .NET Framework doesn't have overload to overwrite files
ZipFile.ExtractToDirectory(SourceArchive, DestinationDirectory);
#else
ZipFile.ExtractToDirectory(SourceArchive, DestinationDirectory, overwriteFiles: true);
#endif
}
else
{

View file

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<TargetFramework>$(CoreSdkTargetFramework)</TargetFramework>
<TargetFrameworks>$(CoreSdkTargetFramework);net472</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
@ -8,4 +8,8 @@
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="15.7.177" />
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="2.0.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
<Reference Include="System.Net.Http" />
</ItemGroup>
</Project>

View file

@ -1,6 +1,10 @@
<Project>
<PropertyGroup>
<CoreSdkTaskDll>$(ArtifactsDir)tasks\bin\core-sdk-tasks\$(Configuration)\$(CoreSdkTargetFramework)\core-sdk-tasks.dll</CoreSdkTaskDll>
<!-- Tasks are multitargeted to support building in VS and with desktop MSBuild -->
<TaskTargetFramework>$(CoreSdkTargetFramework)</TaskTargetFramework>
<TaskTargetFramework Condition="'$(MSBuildRuntimeType)' != 'Core'">net472</TaskTargetFramework>
<CoreSdkTaskDll>$(ArtifactsDir)tasks\bin\core-sdk-tasks\$(Configuration)\$(TaskTargetFramework)\core-sdk-tasks.dll</CoreSdkTaskDll>
<CoreSdkTaskProject>$(RepoRoot)src\core-sdk-tasks\core-sdk-tasks.csproj</CoreSdkTaskProject>
</PropertyGroup>
<Target Name="BuildCoreSdkTasks" BeforeTargets="_CheckForInvalidConfigurationAndPlatform">