Merge branch 'release/2.0.0' into loc

This commit is contained in:
Nick Guerrera 2017-06-16 18:20:44 -07:00
commit 11967b7d9c
92 changed files with 1150 additions and 158 deletions

View file

@ -59,6 +59,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{89905EC4
build\Test.targets = build\Test.targets
build\Version.props = build\Version.props
build\VersionBadge.props = build\VersionBadge.props
build\DerivedHostMachineInfo.props = build\DerivedHostMachineInfo.props
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "package", "package", "{FD7D515A-D10F-4F49-B8AE-21CF7ED071AE}"
@ -68,6 +69,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "package", "package", "{FD7D
build\package\Installer.DEB.targets = build\package\Installer.DEB.targets
build\package\Installer.MSI.targets = build\package\Installer.MSI.targets
build\package\Installer.PKG.targets = build\package\Installer.PKG.targets
build\package\Installer.RPM.props = build\package\Installer.RPM.props
build\package\Installer.RPM.targets = build\package\Installer.RPM.targets
build\package\Layout.targets = build\package\Layout.targets
build\package\Nupkg.targets = build\package\Nupkg.targets
EndProjectSection

View file

@ -4,7 +4,7 @@
<PropertyGroup>
<TargetFrameworks>netcoreapp2.0;net451</TargetFrameworks>
<OutputType>Exe</OutputType>
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">$(PackageTargetFallback);portable-net45+win8;dnxcore50</PackageTargetFallback>
<AssetTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">$(AssetTargetFallback);portable-net45+win8;dnxcore50</AssetTargetFallback>
<RuntimeIdentifiers>win7-x64;win7-x86;osx.10.10-x64;osx.10.11-x64;ubuntu.14.04-x64;ubuntu.16.04-x64;ubuntu.16.10-x64;centos.7-x64;rhel.7.2-x64;debian.8-x64;fedora.24-x64;opensuse.42.1-x64</RuntimeIdentifiers>
</PropertyGroup>

View file

@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFrameworks>netstandard1.6;net451</TargetFrameworks>
<OutputType>Library</OutputType>
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netstandard1.6' ">$(PackageTargetFallback);portable-net45+win8;dnxcore50;netcoreapp2.0</PackageTargetFallback>
<AssetTargetFallback Condition=" '$(TargetFramework)' == 'netstandard1.6' ">$(AssetTargetFallback);portable-net45+win8;dnxcore50;netcoreapp2.0</AssetTargetFallback>
</PropertyGroup>
<ItemGroup>

View file

@ -0,0 +1,24 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
namespace TestLibrary
{
public static class Helper
{
/// <summary>
/// Gets the message from the helper. This comment is here to help test XML documentation file generation, please do not remove it.
/// </summary>
/// <returns>A message</returns>
public static string GetMessage()
{
return "This string came from the test library!";
}
public static void SayHi()
{
Console.WriteLine("Hello there!");
}
}
}

View file

@ -0,0 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
</Project>

View file

@ -0,0 +1,24 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using TestLibrary;
using Xunit;
namespace TestNamespace
{
public class VSTestXunitTests
{
[Fact]
public void VSTestXunitPassTest()
{
Assert.Equal("This string came from the test library!", Helper.GetMessage());
}
[Fact]
public void VSTestXunitFailTest()
{
Assert.Equal(2, 2);
}
}
}

View file

@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), testAsset.props))\testAsset.props" />
<PropertyGroup>
<TargetFrameworks>net461;netcoreapp2.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="../TestLibrary/TestLibrary.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(CLI_TestPlatform_Version)" />
<PackageReference Include="xunit" Version="2.2.0-beta4-build3444" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0-beta4-build1194" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\TestLibrary\TestLibrary.csproj" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,15 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
namespace TestApp
{
class Program
{
public static void Main(string[] args)
{
Console.WriteLine(TestLibrary.Helper.GetMessage());
}
}
}

View file

@ -6,7 +6,7 @@
<AssemblyName>ProjectA</AssemblyName>
<OutputType>Exe</OutputType>
<PackageId>ProjectA</PackageId>
<PackageTargetFallback>$(PackageTargetFallback);dnxcore50</PackageTargetFallback>
<AssetTargetFallback>$(AssetTargetFallback);dnxcore50</AssetTargetFallback>
<RuntimeFrameworkVersion>1.0.3</RuntimeFrameworkVersion>
</PropertyGroup>

View file

@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<OutputType>Exe</OutputType>
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">$(PackageTargetFallback);dnxcore50</PackageTargetFallback>
<AssetTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">$(AssetTargetFallback);dnxcore50</AssetTargetFallback>
</PropertyGroup>
<ItemGroup>

View file

@ -7,7 +7,7 @@
<AssemblyName>DependencyContextFromTool</AssemblyName>
<OutputType>Exe</OutputType>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<PackageTargetFallback>$(PackageTargetFallback);dnxcore50;portable-net45+win8</PackageTargetFallback>
<AssetTargetFallback>$(AssetTargetFallback);dnxcore50;portable-net45+win8</AssetTargetFallback>
</PropertyGroup>
<ItemGroup>

View file

@ -5,7 +5,7 @@
<TargetFramework>netcoreapp2.0</TargetFramework>
<OutputType>Exe</OutputType>
<!-- Issue: https://github.com/dotnet/sdk/issues/1150 -->
<DisableImplicitPackageTargetFallback>true</DisableImplicitPackageTargetFallback>
<DisableImplicitAssetTargetFallback>true</DisableImplicitAssetTargetFallback>
</PropertyGroup>
<ItemGroup>

View file

@ -5,6 +5,6 @@
<TargetFramework>netcoreapp2.0</TargetFramework>
<OutputType>Exe</OutputType>
<!-- Issue: https://github.com/dotnet/sdk/issues/1150 -->
<DisableImplicitPackageTargetFallback>true</DisableImplicitPackageTargetFallback>
<DisableImplicitAssetTargetFallback>true</DisableImplicitAssetTargetFallback>
</PropertyGroup>
</Project>

View file

@ -32,7 +32,9 @@
<PropertyGroup>
<AspNetCoreRuntimeInstallerBlobRootUrl>$(CoreSetupBlobRootUrl)aspnetcore/store/$(AspNetCoreRuntimeVersion)</AspNetCoreRuntimeInstallerBlobRootUrl>
<AspNetCoreSharedRuntimeVersionFileName>runtime.version</AspNetCoreSharedRuntimeVersionFileName>
<AspNetCoreSharedRuntimeVersionFile Condition=" '$(AspNetCoreSharedRuntimeVersionFileName)' != '' ">$(PackagesDirectory)/$(AspNetCoreSharedRuntimeVersionFileName)</AspNetCoreSharedRuntimeVersionFile>
<!-- Examples: Build.RS.linux.zip Build.RS.winx86.zip AspNetCorePackageStoreLibx64.wixlib -->
<AspNetCoreRuntimeInstallerArchiveFileNameOSToken Condition=" '$(HostOSName)' == 'win' ">$(HostOSName)$(Architecture)</AspNetCoreRuntimeInstallerArchiveFileNameOSToken>
<AspNetCoreRuntimeInstallerArchiveFileNameOSToken Condition=" '$(HostOSName)' == 'osx' ">$(HostOSName)</AspNetCoreRuntimeInstallerArchiveFileNameOSToken>
@ -90,5 +92,12 @@
<ExtractDestination>$(AspNetRuntimePackageStorePublishDirectory)</ExtractDestination>
</_DownloadAndExtractItem>
<_DownloadAndExtractItem Include="AspNetCoreSharedRuntimeVersionFile"
Condition="!Exists('$(AspNetCoreSharedRuntimeVersionFile)')">
<Url>$(AspNetCoreRuntimeInstallerBlobRootUrl)/$(AspNetCoreSharedRuntimeVersionFileName)</Url>
<DownloadFileName>$(AspNetCoreSharedRuntimeVersionFile)</DownloadFileName>
<ExtractDestination></ExtractDestination>
</_DownloadAndExtractItem>
</ItemGroup>
</Project>

View file

@ -1,19 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<CLI_SharedFrameworkVersion>2.0.0-preview2-25407-01</CLI_SharedFrameworkVersion>
<CLI_MSBuild_Version>15.3.0-preview-000385-01</CLI_MSBuild_Version>
<CLI_Roslyn_Version>2.3.0-beta2-61716-09</CLI_Roslyn_Version>
<CLI_SharedFrameworkVersion>2.0.0-preview3-25415-01</CLI_SharedFrameworkVersion>
<CLI_MSBuild_Version>15.3.0-preview-000388-01</CLI_MSBuild_Version>
<CLI_Roslyn_Version>2.3.0-beta3-61814-09</CLI_Roslyn_Version>
<CLI_DiaSymNative_Version>1.6.0-beta2-25304</CLI_DiaSymNative_Version>
<CLI_FSharp_Version>4.2.0-rc-170602-0</CLI_FSharp_Version>
<!-- We'll usually want to keep these versions in sync, but we may want to diverge in some
cases, so use separate properties but derive one from the other unless we want to
explicitly use different versions. -->
<CLI_NETSDK_Version>2.0.0-preview2-20170610-3</CLI_NETSDK_Version>
<CLI_NETSDK_Version>2.0.0-preview2-20170615-7</CLI_NETSDK_Version>
<CLI_MSBuildExtensions_Version>$(CLI_NETSDK_Version)</CLI_MSBuildExtensions_Version>
<CLI_NuGet_Version>4.3.0-preview3-4154</CLI_NuGet_Version>
<CLI_NuGet_Version>4.3.0-preview3-4168</CLI_NuGet_Version>
<CLI_NETStandardLibraryNETFrameworkVersion>2.0.0-preview2-25331-02</CLI_NETStandardLibraryNETFrameworkVersion>
<CLI_WEBSDK_Version>2.0.0-rel-20170518-512</CLI_WEBSDK_Version>
<CLI_TestPlatform_Version>15.3.0-preview-20170609-02</CLI_TestPlatform_Version>
@ -21,21 +21,21 @@
<SharedHostVersion>$(CLI_SharedFrameworkVersion)</SharedHostVersion>
<HostFxrVersion>$(CLI_SharedFrameworkVersion)</HostFxrVersion>
<TemplateEngineVersion>1.0.0-beta2-20170608-254</TemplateEngineVersion>
<TemplateEngineTemplateVersion>1.0.0-beta2-20170610-257</TemplateEngineTemplateVersion>
<TemplateEngineTemplate2_0Version>1.0.0-beta2-20170610-257</TemplateEngineTemplate2_0Version>
<PlatformAbstractionsVersion>2.0.0-preview2-25407-01</PlatformAbstractionsVersion>
<DependencyModelVersion>2.0.0-preview2-25407-01</DependencyModelVersion>
<TemplateEngineTemplateVersion>1.0.0-beta2-20170612-258</TemplateEngineTemplateVersion>
<TemplateEngineTemplate2_0Version>1.0.0-beta2-20170612-258</TemplateEngineTemplate2_0Version>
<PlatformAbstractionsVersion>2.0.0-preview3-25415-01</PlatformAbstractionsVersion>
<DependencyModelVersion>2.0.0-preview3-25415-01</DependencyModelVersion>
<CliCommandLineParserVersion>0.1.0-alpha-142</CliCommandLineParserVersion>
<CliMigrateVersion>1.2.1-alpha-002133</CliMigrateVersion>
<MicroBuildVersion>0.2.0</MicroBuildVersion>
<SpaTemplateVersion>1.0.0-preview-000286</SpaTemplateVersion>
<SpaTemplateVersion>1.0.0-preview-000297</SpaTemplateVersion>
<XliffTasksVersion>0.2.0-beta-000042</XliffTasksVersion>
<!-- This should either be timestamped or notimestamp as appropriate -->
<AspNetCoreRuntimePackageFlavor>timestamped</AspNetCoreRuntimePackageFlavor>
<AspNetCoreRuntimeVersion>2.0.0-preview2-183</AspNetCoreRuntimeVersion>
<AspNetCoreRuntimeVersion>2.0.0-preview2-186</AspNetCoreRuntimeVersion>
<AspNetCoherenceLabel>preview2</AspNetCoherenceLabel>
<AspNetCoreCoherenceTimestamp>25615</AspNetCoreCoherenceTimestamp>
<AspNetCoreCoherenceTimestamp>25661</AspNetCoreCoherenceTimestamp>
</PropertyGroup>

View file

@ -0,0 +1,7 @@
<Project>
<PropertyGroup>
<IsDebianBaseDistro Condition=" '$(HostOSName)' == 'ubuntu' OR '$(HostOSName)' == 'debian' ">true</IsDebianBaseDistro>
<IsRPMBasedDistro Condition=" $(HostRid.StartsWith('rhel')) ">true</IsRPMBasedDistro>
<IsLinuxDistroSpecific Condition=" ('$(IsDebianBaseDistro)' == 'true' OR '$(IsRPMBasedDistro)' == 'true') AND '$(IslinuxPortable)' != 'true' ">true</IsLinuxDistroSpecific>
</PropertyGroup>
</Project>

View file

@ -1,16 +1,17 @@
<Project>
<PropertyGroup>
<ArchiveExtension Condition=" '$(HostOSName)' == 'win' ">.zip</ArchiveExtension>
<ArchiveExtension Condition=" '$(HostOSName)' != 'win' ">.tar.gz</ArchiveExtension>
<InstallerExtension Condition=" '$(HostOSName)' == 'win' ">.msi</InstallerExtension>
<InstallerExtension Condition=" '$(HostOSName)' == 'osx' ">.pkg</InstallerExtension>
<InstallerExtension Condition=" '$(HostOSName)' == 'ubuntu' OR '$(OSName)' == 'debian' ">.deb</InstallerExtension>
<InstallerExtension Condition=" '$(IsDebianBaseDistro)' == 'true' ">.deb</InstallerExtension>
<InstallerExtension Condition=" '$(IsRPMBasedDistro)' == true ">.rpm</InstallerExtension>
<BundleExtension Condition=" '$(HostOSName)' == 'win' ">.exe</BundleExtension>
<BundleExtension Condition=" '$(HostOSName)' == 'osx' ">$(InstallerExtension)</BundleExtension>
<BundleExtension Condition=" '$(HostOSName)' == 'ubuntu' OR '$(OSName)' == 'debian' ">$(InstallerExtension)</BundleExtension>
<BundleExtension Condition=" '$(IsDebianBaseDistro)' == 'true' ">$(InstallerExtension)</BundleExtension>
<BundleExtension Condition=" '$(IsRPMBasedDistro)' == true ">$(InstallerExtension)</BundleExtension>
<DynamicLibPrefix>lib</DynamicLibPrefix>
<DynamicLibPrefix Condition=" '$(HostOSName)' == 'win' "></DynamicLibPrefix>

View file

@ -6,10 +6,11 @@
<Import Project="$(MSBuildThisFileDirectory)/package/Installer.DEB.proj" />
<Import Project="$(MSBuildThisFileDirectory)/package/Installer.MSI.targets" />
<Import Project="$(MSBuildThisFileDirectory)/package/Installer.PKG.targets" />
<Import Project="$(MSBuildThisFileDirectory)/package/Installer.RPM.targets" />
<Target Name="GenerateInstallers"
Condition=" '$(SkipBuildingInstallers)' != 'true' "
DependsOnTargets="Init;Layout;GeneratePkgs;GenerateDebs;GenerateMsis" />
DependsOnTargets="Init;Layout;GeneratePkgs;GenerateDebs;GenerateMsis;GenerateRpms" />
<Target Name="Package"
DependsOnTargets="BuildDotnetCliBuildFramework;

View file

@ -26,9 +26,12 @@
<Target Name="GatherItemsForPattern">
<ItemGroup>
<ForPublishing Include="@(GeneratedInstallers)" />
<ForPublishing Include="%(GenerateArchivesInputsOutputs.Outputs)" />
<ForPublishing Include="$(PackagesDirectory)/Microsoft*.nupkg" Condition=" '$(PUBLISH_NUPKG_TO_AZURE_BLOB)' != '' " />
<ForPublishing Include="@(GeneratedInstallers)"
Condition=" '$(IslinuxPortable)' != 'true' "/>
<ForPublishing Include="%(GenerateArchivesInputsOutputs.Outputs)"
Condition=" '$(IsLinuxDistroSpecific)' != 'true' "/>
<ForPublishing Include="$(PackagesDirectory)/Microsoft*.nupkg"
Condition=" '$(PUBLISH_NUPKG_TO_AZURE_BLOB)' != '' AND '$(IsLinuxDistroSpecific)' != 'true'"/>
</ItemGroup>
<ItemGroup>

View file

@ -3,7 +3,7 @@
<VersionMajor>2</VersionMajor>
<VersionMinor>0</VersionMinor>
<VersionPatch>0</VersionPatch>
<ReleaseSuffix>preview2</ReleaseSuffix>
<ReleaseSuffix>preview3</ReleaseSuffix>
<CliVersionPrefix>$(VersionMajor).$(VersionMinor).$(VersionPatch)-$(ReleaseSuffix)</CliVersionPrefix>
<SimpleVersion Condition=" '$(DropSuffix)' == '' ">$(VersionMajor).$(VersionMinor).$(VersionPatch).$(CommitCount)</SimpleVersion>

View file

@ -10,11 +10,11 @@
TestDebuild;
BuildSdkDeb;
TestSdkDeb;"
Condition=" '$(HostOSName)' == 'ubuntu' OR '$(HostOSName)' == 'debian' "
Condition=" '$(IsDebianBaseDistro)' == 'True' "
Outputs="@(GeneratedInstallers)"/>
<Target Name="BuildSdkDeb"
Condition=" ('$(HostOSName)' == 'ubuntu' OR '$(HostOSName)' == 'debian') AND '$(DebuildPresent)' == 'true' "
Condition=" '$(IsDebianBaseDistro)' == 'True' AND '$(DebuildPresent)' == 'true' "
DependsOnTargets="PrepareDotnetDebDirectories;
PrepareDotnetDebTool;"
Inputs="@(CLISdkFiles)"
@ -98,7 +98,8 @@
</Target>
<Target Name="TestSdkDeb"
Condition=" ('$(HostOSName)' == 'ubuntu' OR '$(HostOSName)' == 'debian') and '$(DebuildPresent)' == 'true' "
Condition=" '$(IsDebianBaseDistro)' == 'True' and '$(DebuildPresent)' == 'true' "
DependsOnTargets="RestoreTests"
Inputs="$(DownloadedSharedHostInstallerFile);
$(DownloadedHostFxrInstallerFile);
$(DownloadedSharedFrameworkInstallerFile);

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<RpmConfigJsonName>rpm_config.json</RpmConfigJsonName>
<TemplatesDir>$(RepoRoot)/packaging/rpm/templates</TemplatesDir>
<ScriptsDir>$(RepoRoot)/packaging/rpm/scripts</ScriptsDir>
</PropertyGroup>
</Project>

View file

@ -0,0 +1,214 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project='Installer.RPM.props'/>
<UsingTask TaskName="ReplaceFileContents" AssemblyFile="$(CLIBuildDll)"/>
<UsingTask TaskName="BuildFPMToolPreReqs" AssemblyFile="$(CLIBuildDll)"/>
<PropertyGroup>
<BuildRpmPackage Condition=" '$(IsRPMBasedDistro)' == 'True' ">True</BuildRpmPackage>
</PropertyGroup>
<Target Name="GenerateRpms"
DependsOnTargets="TestFPMTool;BuildRpms;TestSdkRpm"
Condition=" '$(BuildRpmPackage)' == 'True' "
Outputs="@(GeneratedInstallers)"/>
<Target Name="BuildRpms"
DependsOnTargets="GenerateSdkRpm"
Condition=" '$(BuildRpmPackage)' == 'True' and '$(FPMPresent)' == 'True' "/>
<Target Name="GenerateSdkRpm">
<PropertyGroup>
<RpmPackageVersion>$(SdkVersion)</RpmPackageVersion>
<InputRoot>$(OutputDirectory)/sdk</InputRoot>
<SdkInstallerFile>$(InstallerOutputDirectory)/$(DistroSpecificArtifactNameWithVersionCombinedHostHostFxrFrameworkSdk)$(InstallerExtension)</SdkInstallerFile>
<RpmFile>$(SdkInstallerFile)</RpmFile>
<ManPagesDir>$(RepoRoot)/Documentation/manpages</ManPagesDir>
<ConfigJsonFile>$(RepoRoot)/packaging/rpm/dotnet-config.json</ConfigJsonFile>
<RpmIntermediatesDir>$(IntermediateDirectory)/$(RpmPackageName)/$(RpmPackageVersion)</RpmIntermediatesDir>
<RpmTestResultsXmlFile>$(RpmIntermediatesDir)/debian-testResults.xml</RpmTestResultsXmlFile>
<RpmInstalledDirectory>/usr/share/dotnet</RpmInstalledDirectory>
</PropertyGroup>
<PropertyGroup>
<RpmLayoutDirectory>$(RpmIntermediatesDir)/RpmLayoutDirectory/</RpmLayoutDirectory>
<RpmLayoutPackageRoot>$(RpmLayoutDirectory)package_root</RpmLayoutPackageRoot>
<RpmLayoutSDK>$(RpmLayoutPackageRoot)/sdk</RpmLayoutSDK>
<RpmLayoutDocs>$(RpmLayoutDirectory)docs</RpmLayoutDocs> <!-- Man Pages -->
<RpmLayoutTemplates>$(RpmLayoutDirectory)templates</RpmLayoutTemplates> <!-- Copyright, Changelog -->
<RpmLayoutScripts>$(RpmLayoutDirectory)scripts</RpmLayoutScripts>
</PropertyGroup>
<PropertyGroup>
<SdkRpmPackageVersion>$(SdkVersion)</SdkRpmPackageVersion>
<SdkRpmPackageName>$(ArtifactNameCombinedHostHostFxrFrameworkSdk)-$(SdkRpmPackageVersion)</SdkRpmPackageName>
<SharedFxRpmPackageVersion>$(SharedFrameworkVersion)</SharedFxRpmPackageVersion>
<SharedFxRpmPackageName>dotnet-runtime-$(SharedFxRpmPackageVersion)</SharedFxRpmPackageName>
<SharedFxRpmPackageName>$(SharedFxRpmPackageName.ToLower())</SharedFxRpmPackageName>
<HostFxrRpmPackageVersion>$(HostFxrVersion)</HostFxrRpmPackageVersion>
<HostFxrRpmPackageName>dotnet-hostfxr-$(HostFxrRpmPackageVersion)</HostFxrRpmPackageName>
<HostFxrRpmPackageName>$(HostFxrRpmPackageName.ToLower())</HostFxrRpmPackageName>
<HostRpmPackageName>dotnet-host</HostRpmPackageName>
</PropertyGroup>
<PropertyGroup>
<EndToEndTestProject>$(RepoRoot)/test/EndToEnd/EndToEnd.csproj</EndToEndTestProject>
</PropertyGroup>
<RemoveDir Condition="Exists('$(RpmIntermediatesDir)')" Directories="$(RpmIntermediatesDir)"/>
<MakeDir Directories="$(RpmIntermediatesDir)"/>
<!-- Create empty rpm layout -->
<RemoveDir Condition="Exists('$(RpmLayoutDirectory)')" Directories="$(RpmLayoutDirectory)"/>
<MakeDir Directories="$(RpmLayoutDirectory)"/>
<MakeDir Directories="$(RpmLayoutPackageRoot)"/>
<MakeDir Directories="$(RpmLayoutSDK)"/>
<MakeDir Directories="$(RpmLayoutDocs)"/>
<MakeDir Directories="$(RpmLayoutTemplates)"/>
<MakeDir Directories="$(RpmLayoutScripts)"/>
<!-- Copy files to rpm layout -->
<ItemGroup>
<SDKFiles Include="$(InputRoot)/**/*"/>
<SDKManpages Include="$(ManPagesDir)/**/*"/>
<SDKTemplatesFiles Include="$(TemplatesDir)/**/*"/>
<SDKScriptsFiles Include="$(ScriptsDir)/**/*"/>
<AspNetRuntimeFilesInput Include="$(AspNetRuntimePackageStorePublishDirectory)/**/*" />
</ItemGroup>
<Copy SourceFiles="@(SDKFiles)"
DestinationFiles="@(SDKFiles->'$(RpmLayoutSDK)/%(RecursiveDir)%(Filename)%(Extension)')"
OverwriteReadOnlyFiles="True"
SkipUnchangedFiles="False"
UseHardlinksIfPossible="False"/>
<Copy SourceFiles="@(SDKManpages)"
DestinationFiles="@(SDKManpages->'$(RpmLayoutDocs)/%(RecursiveDir)%(Filename)%(Extension)')"
OverwriteReadOnlyFiles="True"
SkipUnchangedFiles="False"
UseHardlinksIfPossible="False"/>
<Copy SourceFiles="@(SDKTemplatesFiles)"
DestinationFiles="@(SDKTemplatesFiles->'$(RpmLayoutTemplates)/%(RecursiveDir)%(Filename)%(Extension)')"
OverwriteReadOnlyFiles="True"
SkipUnchangedFiles="False"
UseHardlinksIfPossible="False"/>
<Copy SourceFiles="@(SDKScriptsFiles)"
DestinationFiles="@(SDKScriptsFiles->'$(RpmLayoutScripts)/%(RecursiveDir)%(Filename)%(Extension)')"
OverwriteReadOnlyFiles="True"
SkipUnchangedFiles="False"
UseHardlinksIfPossible="False"/>
<Copy SourceFiles="@(AspNetRuntimeFilesInput)"
DestinationFiles="@(AspNetRuntimeFilesInput ->'$(RpmLayoutPackageRoot)/%(RecursiveDir)%(Filename)%(Extension)')"
OverwriteReadOnlyFiles="True"
SkipUnchangedFiles="False"
UseHardlinksIfPossible="False"/>
<!-- Replace config json variables -->
<ItemGroup>
<SDKTokenValue Include="%SHARED_HOST_RPM_VERSION%">
<ReplacementString>$(SharedFrameworkVersion)</ReplacementString>
</SDKTokenValue>
<SDKTokenValue Include="%SHARED_HOST_RPM_NAME%">
<ReplacementString>$(SharedFxRpmPackageName)</ReplacementString>
</SDKTokenValue>
<SDKTokenValue Include="%SDK_NUGET_VERSION%">
<ReplacementString>$(SdkVersion)</ReplacementString>
</SDKTokenValue>
<SDKTokenValue Include="%CLI_SDK_BRAND_NAME%">
<ReplacementString>$(SdkBrandName)</ReplacementString>
</SDKTokenValue>
<SDKTokenValue Include="%SDK_RPM_PACKAGE_NAME%">
<ReplacementString>$(SdkRpmPackageName)</ReplacementString>
</SDKTokenValue>
</ItemGroup>
<ItemGroup>
<TestSdkRpmTaskEnvironmentVariables Include="PATH=$(RpmInstalledDirectory)$(PathListSeparator)$(PATH)" />
<GeneratedInstallers Include="$(SdkInstallerFile)" />
</ItemGroup>
<ReplaceFileContents InputFile="$(ConfigJsonFile)"
DestinationFile="$(RpmLayoutDirectory)$(RpmConfigJsonName)"
ReplacementItems="@(SDKTokenValue)"/>
<!-- Call the task to build the pre-reqs (parameters, copyright, changelog) for calling the FPM tool -->
<BuildFPMToolPreReqs InputDir="$(RpmLayoutDirectory)"
OutputDir="$(RpmIntermediatesDir)"
PackageVersion="$(RpmPackageVersion)"
ConfigJsonFile="$(RpmLayoutDirectory)$(RpmConfigJsonName)">
<Output TaskParameter="FPMParameters" PropertyName="FPMCmdParameters"/>
</BuildFPMToolPreReqs>
<!-- Build the RPM package by calling the FPM tool and passing the parameter list -->
<Exec Command="fpm $(FPMCmdParameters)" WorkingDirectory="$(RpmIntermediatesDir)"/>
<!-- Copy package to output -->
<ItemGroup>
<GeneratedRpmFiles Remove="@(GeneratedRpmFiles)"/>
<GeneratedRpmFiles Include="$(RpmIntermediatesDir)/*.rpm"/>
</ItemGroup>
<Error Text="@(GeneratedRpmFiles->Count()) .rpm files generated." Condition="'@(GeneratedRpmFiles->Count())' != 1"/>
<Copy SourceFiles="@(GeneratedRpmFiles)"
DestinationFiles="$(RpmFile)"
OverwriteReadOnlyFiles="True"
SkipUnchangedFiles="False"
UseHardlinksIfPossible="False"/>
</Target>
<Target Name="TestFPMTool">
<!-- run FPM -->
<Exec Command="fpm --help > /dev/null" ContinueOnError="True">
<Output TaskParameter="ExitCode" PropertyName="FPMExitCode"/>
</Exec>
<!-- Check if it returned 0 -->
<PropertyGroup>
<FPMPresent>false</FPMPresent>
<FPMPresent Condition=" '$(FPMExitCode)' == '0' ">True</FPMPresent>
</PropertyGroup>
<!-- Workaround for Jenkins machines that don't have the necessary packages https://github.com/dotnet/core-setup/issues/2260 -->
<Message Condition=" '$(FPMPresent)' != 'True' "
Text="FPM tool Not found, RPM packages will not be built."
Importance="High"/>
</Target>
<Target Name="TestSdkRpm"
DependsOnTargets="RestoreTests"
Condition=" '$(IsRPMBasedDistro)' == 'True' and '$(FPMPresent)' == 'True' "
Inputs="$(DownloadedSharedHostInstallerFile);
$(DownloadedHostFxrInstallerFile);
$(DownloadedSharedFrameworkInstallerFile);
$(RpmTestResultsXmlFile);"
Outputs="$(RpmTestResultsXmlFile)" >
<!-- Install Dependencies and SDK Packages -->
<Exec Command="sudo yum -y install $(DownloadedSharedHostInstallerFile)" />
<Exec Command="sudo yum -y install $(DownloadedHostFxrInstallerFile)" />
<Exec Command="sudo yum -y install $(DownloadedSharedFrameworkInstallerFile)" />
<Exec Command="sudo yum -y install $(SdkInstallerFile)" />
<!-- Run Tests -->
<DotNetRestore ProjectPath="$(EndToEndTestProject)"
ToolPath="$(RpmInstalledDirectory)" />
<DotNetTest ProjectPath="$(EndToEndTestProject)"
EnvironmentVariables="@(TestSdkDebTaskEnvironmentVariables)"
ToolPath="$(RpmInstalledDirectory)" />
<!-- Clean up Packages -->
<Exec Command="sudo yum remove -y $(SdkRpmPackageName)" />
<Exec Command="sudo yum remove -y $(SharedFxRpmPackageName)" />
<Exec Command="sudo yum remove -y $(HostFxrRpmPackageName)" />
<Exec Command="sudo yum remove -y $(HostRpmPackageName)" />
</Target>
</Project>

View file

@ -2,6 +2,7 @@
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="FinishBuild"
DependsOnTargets="CheckIfAllBuildsHavePublished;
EvaluateRuntimeCoherence;
FinalizeBuild" />
<Target Name="CheckIfAllBuildsHavePublished">
@ -14,6 +15,27 @@
</CheckIfAllBuildsHavePublished>
</Target>
<Target Name="EvaluateRuntimeCoherence"
DependsOnTargets="ReadAspNetCoreSharedRuntimeVersionFile"
BeforeTargets="FinalizeBuild">
<PropertyGroup>
<Coherent>false</Coherent>
<Coherent Condition=" '$(CLI_SharedFrameworkVersion)' == '@(AspNetCoreSharedRuntimeVersion)' ">true</Coherent>
</PropertyGroup>
</Target>
<Target Name="ReadAspNetCoreSharedRuntimeVersionFile"
DependsOnTargets="DownloadHostAndSharedFxArtifacts">
<ItemGroup>
<File Include="$(AspNetCoreSharedRuntimeVersionFile)" />
</ItemGroup>
<ReadLinesFromFile File="@(File)">
<Output
TaskParameter="Lines"
ItemName="AspNetCoreSharedRuntimeVersion"/>
</ReadLinesFromFile>
</Target>
<Target Name="FinalizeBuild"
Condition=" '$(HaveAllBuildsPublished)' == 'True' ">
<CopyBlobsToLatest AccountName="$(ArtifactCloudDropAccountName)"
@ -21,17 +43,20 @@
ContainerName="$(ArtifactContainerName)"
NugetVersion="$(FullNugetVersion)"
Channel="$(Channel)"
CommitHash="$(CommitHash)" />
CommitHash="$(CommitHash)"
Coherent="$(Coherent)" />
<CopyBlobsToLatest AccountName="$(ChecksumCloudDropAccountName)"
AccountKey="$(ChecksumCloudDropAccessToken)"
ContainerName="$(ChecksumContainerName)"
NugetVersion="$(FullNugetVersion)"
Channel="$(Channel)"
CommitHash="$(CommitHash)" />
CommitHash="$(CommitHash)"
Coherent="$(Coherent)" />
<UpdateVersionsRepo BranchName="$(BranchName)"
<!-- Uncomment the line below when https://github.com/dotnet/buildtools/issues/1547 gets fixed. -->
<!-- <UpdateVersionsRepo BranchName="$(BranchName)"
PackagesDirectory="$(PackagesDirectory)"
GitHubPassword="$(GITHUB_PASSWORD)" />
GitHubPassword="$(GITHUB_PASSWORD)" /> -->
</Target>
</Project>

View file

@ -19,7 +19,7 @@
</DebianUploadJsonContent>
</PropertyGroup>
<Target Name="PublishDebFilesToDebianRepo" Condition=" ('$(HostOSName)' == 'ubuntu' OR '$(HostOSName)' == 'debian') AND '$(SkipPublishToDebianRepo)' != 'true' ">
<Target Name="PublishDebFilesToDebianRepo" Condition=" '$(IsDebianBaseDistro)' == 'True' AND '$(SkipPublishToDebianRepo)' != 'true' ">
<Error Condition="'$(REPO_ID)' == ''" Text="REPO_ID must be set as an environment variable for debian publishing." />
<Error Condition="'$(REPO_USER)' == ''" Text="REPO_USER must be set as an environment variable for debian publishing." />
<Error Condition="'$(REPO_PASS)' == ''" Text="REPO_PASS must be set as an environment variable for debian publishing." />

View file

@ -6,7 +6,7 @@
<WarningsAsErrors>true</WarningsAsErrors>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AssemblyName>Microsoft.DotNet.Cli.Build.Framework</AssemblyName>
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netstandard1.5' ">$(PackageTargetFallback);dnxcore50</PackageTargetFallback>
<AssetTargetFallback>$(AssetTargetFallback);dnxcore50</AssetTargetFallback>
</PropertyGroup>
<ItemGroup>

View file

@ -0,0 +1,309 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Collections.Generic;
using Microsoft.Build.Utilities;
using Microsoft.Build.Framework;
using System.IO;
using System.Linq;
using System.Text;
using Newtonsoft.Json;
namespace Microsoft.DotNet.Build.Tasks
{
/// <summary>
/// This task prepares the command line parameters for running a RPM build using FPM tool and also updates the copyright and changelog file tokens.
/// If parses various values from the config json by first reading it into a model and then builds the required string for parameters and passes it back.
///
/// </summary>
public class BuildFPMToolPreReqs : Task
{
[Required]
public string InputDir { get; set; }
[Required]
public string OutputDir { get; set; }
[Required]
public string PackageVersion { get; set; }
[Required]
public string ConfigJsonFile { get; set; }
[Output]
public string FPMParameters { get; set; }
public override bool Execute()
{
if (!File.Exists(ConfigJsonFile))
{
throw new FileNotFoundException($"Expected file {ConfigJsonFile} was not found.");
}
// Open the Config Json and read the values into the model
TextReader projectFileReader = File.OpenText(ConfigJsonFile);
string jsonFileText = projectFileReader.ReadToEnd();
ConfigJson configJson = JsonConvert.DeserializeObject<ConfigJson>(jsonFileText);
// Update the Changelog and Copyright files by replacing tokens with values from config json
UpdateChangelog(configJson, PackageVersion);
UpdateCopyright(configJson);
// Build the full list of parameters
FPMParameters = BuildCmdParameters(configJson, PackageVersion);
Log.LogMessage(MessageImportance.Normal, "Generated RPM paramters: " + FPMParameters);
return !Log.HasLoggedErrors;
}
// Update the tokens in the changelog file from the config Json
private void UpdateChangelog(ConfigJson configJson, string package_version)
{
string changelogFile = Path.Combine(InputDir, "templates", "changelog");
if (!File.Exists(changelogFile))
{
throw new FileNotFoundException($"Expected file {changelogFile} was not found.");
}
string str = File.ReadAllText(changelogFile);
str = str.Replace("{PACKAGE_NAME}", configJson.Package_Name);
str = str.Replace("{PACKAGE_VERSION}", package_version);
str = str.Replace("{PACKAGE_REVISION}", configJson.Release.Package_Revision);
str = str.Replace("{CHANGELOG_MESSAGE}", configJson.Release.Changelog_Message);
str = str.Replace("{MAINTAINER_NAME}", configJson.Maintainer_Name);
str = str.Replace("{MAINTAINER_EMAIL}", configJson.Maintainer_Email);
// The date format needs to be like Wed May 17 2017
str = str.Replace("{DATE}", DateTime.UtcNow.ToString("ddd MMM dd yyyy"));
File.WriteAllText(changelogFile, str);
}
public void UpdateCopyright(ConfigJson configJson)
{
string copyrightFile = Path.Combine(InputDir, "templates", "copyright");
if (!File.Exists(copyrightFile))
{
throw new FileNotFoundException($"Expected file {copyrightFile} was not found.");
}
string str = File.ReadAllText(copyrightFile);
str = str.Replace("{COPYRIGHT_TEXT}", configJson.CopyRight);
str = str.Replace("{LICENSE_NAME}", configJson.License.Type);
str = str.Replace("{LICENSE_TEXT}", configJson.License.Full_Text);
File.WriteAllText(copyrightFile, str);
}
private string BuildCmdParameters(ConfigJson configJson, string package_version)
{
// Parameter list that needs to be passed to FPM tool:
// -s : is the input source type(dir) --Static
// -t : is the type of package(rpm) --Static
// -n : is for the name of the package --JSON
// -v : is the version to give to the package --ARG
// -a : architecture --JSON
// -d : is for all dependent packages. This can be used multiple times to specify the dependencies of the package. --JSON
// --rpm-os : the operating system to target this rpm --Static
// --rpm-changelog : the changelog from FILEPATH contents --ARG
// --rpm-summary : it is the RPM summary that shows in the Title --JSON
// --description : it is the description for the package --JSON
// -p : The actual package name (with path) for your package. --ARG+JSON
// --conflicts : Other packages/versions this package conflicts with provided as CSV --JSON
// --directories : Recursively add directories as being owned by the package. --JSON
// --after-install : FILEPATH to the script to be run after install of the package --JSON
// --after-remove : FILEPATH to the script to be run after package removal --JSON
// --license : the licensing name for the package. This will include the license type in the meta-data for the package, but will not include the associated license file within the package itself. --JSON
// --iteration : the iteration to give to the package. This comes from the package_revision --JSON
// --url : url for this package. --JSON
// --verbose : Set verbose output for FPM tool --Static
// <All folder mappings> : Add all the folder mappings for packge_root, docs, man pages --Static
var parameters = new List<string>();
parameters.Add("-s dir");
parameters.Add("-t rpm");
parameters.Add(string.Concat("-n ", configJson.Package_Name));
parameters.Add(string.Concat("-v ", package_version));
parameters.Add(string.Concat("-a ", configJson.Control.Architecture));
// Build the list of dependencies as -d <dep1> -d <dep2>
if (configJson.Rpm_Dependencies != null)
{
foreach (RpmDependency rpmdep in configJson.Rpm_Dependencies)
{
string dependency = "";
if (rpmdep.Package_Name != "")
{
// If no version is specified then the dependency is just the package without >= check
if (rpmdep.Package_Version == "")
{
dependency = rpmdep.Package_Name;
}
else
{
dependency = string.Concat(rpmdep.Package_Name, " >= ", rpmdep.Package_Version);
}
}
if (dependency != "") parameters.Add(string.Concat("-d ", EscapeArg(dependency)));
}
}
// Build the list of owned directories
if (configJson.Directories != null)
{
foreach (string dir in configJson.Directories)
{
if (dir != "")
{
parameters.Add(string.Concat("--directories ", EscapeArg(dir)));
}
}
}
parameters.Add("--rpm-os linux");
parameters.Add(string.Concat("--rpm-changelog ",
EscapeArg(Path.Combine(InputDir, "templates", "changelog")))); // Changelog File
parameters.Add(string.Concat("--rpm-summary ", EscapeArg(configJson.Short_Description)));
parameters.Add(string.Concat("--description ", EscapeArg(configJson.Long_Description)));
parameters.Add(string.Concat("--maintainer ",
EscapeArg(configJson.Maintainer_Name + " <" + configJson.Maintainer_Email + ">")));
parameters.Add(string.Concat("--vendor ", EscapeArg(configJson.Vendor)));
parameters.Add(string.Concat("-p ", Path.Combine(OutputDir, configJson.Package_Name + ".rpm")));
if (configJson.Package_Conflicts != null)
parameters.Add(string.Concat("--conflicts ",
EscapeArg(string.Join(",", configJson.Package_Conflicts))));
if (configJson.After_Install_Source != null)
parameters.Add(string.Concat("--after-install ",
Path.Combine(InputDir, EscapeArg(configJson.After_Install_Source))));
if (configJson.After_Remove_Source != null)
parameters.Add(string.Concat("--after-remove ",
Path.Combine(InputDir, EscapeArg(configJson.After_Remove_Source))));
parameters.Add(string.Concat("--license ", EscapeArg(configJson.License.Type)));
parameters.Add(string.Concat("--iteration ", configJson.Release.Package_Revision));
parameters.Add(string.Concat("--url ", "\"", EscapeArg(configJson.Homepage), "\""));
parameters.Add("--verbose");
// Map all the payload directories as they need to install on the system
if (configJson.Install_Root != null)
parameters.Add(string.Concat(Path.Combine(InputDir, "package_root/="),
configJson.Install_Root)); // Package Files
if (configJson.Install_Man != null)
parameters.Add(string.Concat(Path.Combine(InputDir, "docs", "host/="),
configJson.Install_Man)); // Man Pages
if (configJson.Install_Doc != null)
parameters.Add(string.Concat(Path.Combine(InputDir, "templates", "copyright="),
configJson.Install_Doc)); // CopyRight File
return string.Join(" ", parameters);
}
private string EscapeArg(string arg)
{
var sb = new StringBuilder();
bool quoted = ShouldSurroundWithQuotes(arg);
if (quoted) sb.Append("\"");
for (int i = 0; i < arg.Length; ++i)
{
var backslashCount = 0;
// Consume All Backslashes
while (i < arg.Length && arg[i] == '\\')
{
backslashCount++;
i++;
}
// Escape any backslashes at the end of the arg
// This ensures the outside quote is interpreted as
// an argument delimiter
if (i == arg.Length)
{
sb.Append('\\', 2 * backslashCount);
}
// Escape any preceding backslashes and the quote
else if (arg[i] == '"')
{
sb.Append('\\', (2 * backslashCount) + 1);
sb.Append('"');
}
// Output any consumed backslashes and the character
else
{
sb.Append('\\', backslashCount);
sb.Append(arg[i]);
}
}
if (quoted) sb.Append("\"");
return sb.ToString();
}
private bool ShouldSurroundWithQuotes(string argument)
{
// Don't quote already quoted strings
if (argument.StartsWith("\"", StringComparison.Ordinal) &&
argument.EndsWith("\"", StringComparison.Ordinal))
{
return false;
}
// Only quote if whitespace exists in the string
if (argument.Contains(" ") || argument.Contains("\t") || argument.Contains("\n"))
{
return true;
}
return false;
}
}
/// <summary>
/// Model classes for reading and storing the JSON.
/// </summary>
public class ConfigJson
{
public string Maintainer_Name { get; set; }
public string Maintainer_Email { get; set; }
public string Vendor { get; set; }
public string Package_Name { get; set; }
public string Install_Root { get; set; }
public string Install_Doc { get; set; }
public string Install_Man { get; set; }
public string Short_Description { get; set; }
public string Long_Description { get; set; }
public string Homepage { get; set; }
public string CopyRight { get; set; }
public Release Release { get; set; }
public Control Control { get; set; }
public License License { get; set; }
public List<RpmDependency> Rpm_Dependencies { get; set; }
public List<string> Package_Conflicts { get; set; }
public List<string> Directories { get; set; }
public string After_Install_Source { get; set; }
public string After_Remove_Source { get; set; }
}
public class Release
{
public string Package_Version { get; set; }
public string Package_Revision { get; set; }
public string Changelog_Message { get; set; }
}
public class Control
{
public string Architecture { get; set; }
}
public class License
{
public string Type { get; set; }
public string Full_Text { get; set; }
}
public class RpmDependency
{
public string Package_Name { get; set; }
public string Package_Version { get; set; }
}
}

View file

@ -51,16 +51,8 @@ namespace Microsoft.DotNet.Cli.Build
{
{ "win_x86", false },
{ "win_x64", false },
{ "ubuntu_x64", false },
{ "ubuntu_16_04_x64", false },
{ "ubuntu_16_10_x64", false },
{ "rhel_x64", false },
{ "osx_x64", false },
{ "debian_x64", false },
{ "centos_x64", false },
{ "linux_x64", false },
{ "fedora_24_x64", false },
{ "opensuse_42_1_x64", false }
};
if (!badges.ContainsKey(VersionBadgeMoniker))

View file

@ -31,6 +31,8 @@ namespace Microsoft.DotNet.Cli.Build
[Required]
public string NugetVersion { get; set; }
public bool Coherent { get; set; }
private AzurePublisher AzurePublisherTool
{
get
@ -81,6 +83,10 @@ namespace Microsoft.DotNet.Cli.Build
string cliVersion = Utils.GetVersionFileContent(CommitHash, NugetVersion);
AzurePublisherTool.PublishStringToBlob($"{targetFolder}/latest.version", cliVersion);
if (Coherent == true)
{
AzurePublisherTool.PublishStringToBlob($"{targetFolder}/latest.coherent.version", cliVersion);
}
}
finally
{

View file

@ -6,7 +6,7 @@
<TargetFramework>$(CliTargetFramework)</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<OutputPath>bin\$(Configuration)</OutputPath>
<PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81</PackageTargetFallback>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81</AssetTargetFallback>
</PropertyGroup>
<ItemGroup>

View file

@ -5,7 +5,7 @@
<Description>Build scripts for dotnet-cli</Description>
<TargetFramework>netstandard1.6</TargetFramework>
<AssemblyName>shared-build-targets-utils</AssemblyName>
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netstandard1.6' ">$(PackageTargetFallback);dnxcore50;portable-net45+win8</PackageTargetFallback>
<AssetTargetFallback>$(AssetTargetFallback);dnxcore50;portable-net45+win8</AssetTargetFallback>
</PropertyGroup>
<ItemGroup>

View file

@ -28,6 +28,7 @@
<Import Project="build/Version.props" />
<Import Project="build/Branding.props" />
<Import Project="build/DerivedHostMachineInfo.props" />
<Import Project="build/FileExtensions.props" />
<Import Project="build/InputDirectories.props" />
<Import Project="build/MSBuildExtensions.props" />

View file

@ -0,0 +1,38 @@
{
"maintainer_name": "Microsoft",
"maintainer_email": "dotnetcore@microsoft.com",
"vendor": ".NET Foundation",
"package_name": "%SDK_RPM_PACKAGE_NAME%",
"install_root": "/usr/share/dotnet",
"install_doc": "/usr/share/doc/%SDK_RPM_PACKAGE_NAME%/",
"short_description": "%CLI_SDK_BRAND_NAME% %SDK_NUGET_VERSION%",
"long_description": ".NET Core is a development platform that you can use to build command-line applications, microservices and modern websites. It is open source, cross-platform and is supported by Microsoft. We hope you enjoy using it! If you do, please consider joining the active community of developers that are contributing to the project on GitHub (https://github.com/dotnet/core). We happily accept issues and PRs.",
"homepage": "https://github.com/dotnet/core",
"release": {
"package_version": "1.0.0.0",
"package_revision": "1",
"changelog_message": "Bootstrap loop package"
},
"control": {
"architecture": "amd64"
},
"copyright": "2015 Microsoft",
"license": {
"type": "MIT",
"full_text": "Copyright (c) 2015 Microsoft\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE."
},
"rpm_dependencies": [
{
"package_name": "%SHARED_HOST_RPM_NAME%",
"package_version": "%SHARED_HOST_RPM_VERSION%"
}
],
"directories": [
"/usr/share/dotnet/sdk",
"/usr/share/dotnet/store",
"/usr/share/dotnet/additionalDeps",
"/usr/share/doc/%SDK_RPM_PACKAGE_NAME%"
],
"after_install_source": "scripts/after_install_host.sh",
"after_remove_source": "scripts/after_remove_host.sh"
}

View file

@ -0,0 +1,22 @@
#!/bin/sh
#
# Copyright (c) .NET Foundation and contributors. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
#
echo "This software may collect information about you and your use of the software, and send that to Microsoft."
echo "Please visit http://aka.ms/dotnet-cli-eula for more information."
# Run 'dotnet new' as the user to trigger the first time experience to initialize the cache
echo "Welcome to .NET Core!
---------------------
Learn more about .NET Core @ https://aka.ms/dotnet-docs. Use dotnet --help to see available commands or go to https://aka.ms/dotnet-cli-docs.
.NET Core Tools Telemetry
--------------
The .NET Core Tools include a telemetry feature that collects usage information. It is important that the .NET Team understands how the tools are being used so that we can improve them.
The data collected is anonymous and will be published in an aggregated form for use by both Microsoft and community engineers under the Creative Commons Attribution License.
The .NET Core Tools telemetry feature is enabled by default. You can opt-out of the telemetry feature by setting an environment variable DOTNET_CLI_TELEMETRY_OPTOUT (for example, 'export' on macOS/Linux, 'set' on Windows) to true (for example, 'true', 1). You can read more about .NET Core tools telemetry at https://aka.ms/dotnet-cli-telemetry."
su - $SUDO_USER -c "dotnet new > /dev/null 2>&1 || true"

View file

@ -0,0 +1,5 @@
#!/bin/sh
#
# Copyright (c) .NET Foundation and contributors. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
#

View file

@ -0,0 +1,2 @@
* {DATE} {MAINTAINER_NAME} <{MAINTAINER_EMAIL}> - {PACKAGE_VERSION}-{PACKAGE_REVISION}
- {CHANGELOG_MESSAGE}

View file

@ -0,0 +1,8 @@
Comment: Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.
Files: *
Copyright: {COPYRIGHT_TEXT}
License: {LICENSE_NAME}
License: {LICENSE_NAME}
{LICENSE_TEXT}

View file

@ -104,7 +104,7 @@ while [[ $# > 0 ]]; do
;;
--linux-portable)
LINUX_PORTABLE_INSTALL_ARGS="--runtime-id linux-x64"
CUSTOM_BUILD_ARGS="/p:Rid=\"linux-x64\" /p:OSName=\"linux\""
CUSTOM_BUILD_ARGS="/p:Rid=\"linux-x64\" /p:OSName=\"linux\" /p:IslinuxPortable=\"true\""
args=( "${args[@]/$1}" )
;;
--help)

View file

@ -0,0 +1,27 @@
#
# Copyright (c) .NET Foundation and contributors. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
#
# Dockerfile that creates a container suitable to build dotnet-cli
FROM microsoft/dotnet-buildtools-prereqs:rhel-7-rpmpkg-c982313-20174116044113
# Install from sudo main package TODO This package needs to be mirrored
RUN yum install -y https://www.sudo.ws/sudo/dist/packages/RHEL/7/sudo-1.8.20-3.el7.x86_64.rpm \
&& yum clean all
# Setup User to match Host User, and give superuser permissions
ARG USER_ID=0
RUN useradd -m code_executor -u ${USER_ID} -g root
RUN echo 'code_executor ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
# With the User Change, we need to change permssions on these directories
RUN chmod -R a+rwx /usr/local
RUN chmod -R a+rwx /home
RUN chown root:root /usr/bin/sudo && chmod 4755 /usr/bin/sudo
# Set user to the one we just created
USER ${USER_ID}
# Set working directory
WORKDIR /opt/code

View file

@ -67,6 +67,9 @@ if [ -z "$DOCKERFILE" ]; then
elif [ "$(cat /etc/*-release | grep -cim1 centos)" -eq 1 ]; then
echo "Detected current OS as CentOS, using 'centos' image"
export DOCKERFILE=scripts/docker/centos
elif [ "$(cat /etc/*-release | grep -cim1 rhel)" -eq 1 ]; then
echo "Detected current OS as rhel, using 'rhel' image"
export DOCKERFILE=scripts/docker/rhel
elif [ "$(cat /etc/*-release | grep -cim1 debian)" -eq 1 ]; then
echo "Detected current OS as Debian, using 'debian' image"
export DOCKERFILE=scripts/docker/debian

View file

@ -10,14 +10,22 @@
Installs dotnet cli. If dotnet installation already exists in the given directory
it will update it only if the requested version differs from the one already installed.
.PARAMETER Channel
Default: release/1.0.0
Download from the Channel specified
Default: LTS
Download from the Channel specified. Possible values:
- Current - most current release
- LTS - most current supported release
- 2-part version in a format A.B - represents a specific release
examples: 2.0; 1.0
- Branch name
examples: release/2.0.0; Master
.PARAMETER Version
Default: latest
Represents a build version on specific channel. Possible values:
- latest - most latest build on specific channel
- coherent - most latest coherent build on specific channel
coherent applies only to SDK downloads
- 3-part version in a format A.B.C - represents specific version of build
examples: 2.0.0-preview2-006120; 1.1.0
examples: 2.0.0-preview2-006120; 1.1.0
.PARAMETER InstallDir
Default: %LocalAppData%\Microsoft\dotnet
Path to where to install dotnet. Note that binaries will be placed directly in a given directory.
@ -28,8 +36,6 @@
.PARAMETER SharedRuntime
Default: false
Installs just the shared runtime bits, not the entire SDK
.PARAMETER DebugSymbols
If set the installer will include symbols in the installation.
.PARAMETER DryRun
If set it will not perform installation but instead display what command line to use to consistently install
currently requested version of dotnet cli. In example if you specify version 'latest' it will display a link
@ -55,12 +61,11 @@
#>
[cmdletbinding()]
param(
[string]$Channel="release/1.0.0",
[string]$Channel="LTS",
[string]$Version="Latest",
[string]$InstallDir="<auto>",
[string]$Architecture="<auto>",
[switch]$SharedRuntime,
[switch]$DebugSymbols, # TODO: Switch does not work yet. Symbols zip is not being uploaded yet.
[switch]$DryRun,
[switch]$NoPath,
[string]$AzureFeed="https://dotnetcli.azureedge.net/dotnet",
@ -207,7 +212,7 @@ function GetHTTPResponse([Uri] $Uri)
}
function Get-Latest-Version-Info([string]$AzureFeed, [string]$Channel) {
function Get-Latest-Version-Info([string]$AzureFeed, [string]$Channel, [bool]$Coherent) {
Say-Invocation $MyInvocation
$VersionFileUrl = $null
@ -215,7 +220,12 @@ function Get-Latest-Version-Info([string]$AzureFeed, [string]$Channel) {
$VersionFileUrl = "$UncachedFeed/Runtime/$Channel/latest.version"
}
else {
$VersionFileUrl = "$UncachedFeed/Sdk/$Channel/latest.version"
if ($Coherent) {
$VersionFileUrl = "$UncachedFeed/Sdk/$Channel/latest.coherent.version"
}
else {
$VersionFileUrl = "$UncachedFeed/Sdk/$Channel/latest.version"
}
}
$Response = GetHTTPResponse -Uri $VersionFileUrl
@ -239,7 +249,11 @@ function Get-Specific-Version-From-Version([string]$AzureFeed, [string]$Channel,
switch ($Version.ToLower()) {
{ $_ -eq "latest" } {
$LatestVersionInfo = Get-Latest-Version-Info -AzureFeed $AzureFeed -Channel $Channel
$LatestVersionInfo = Get-Latest-Version-Info -AzureFeed $AzureFeed -Channel $Channel -Coherent $False
return $LatestVersionInfo.Version
}
{ $_ -eq "coherent" } {
$LatestVersionInfo = Get-Latest-Version-Info -AzureFeed $AzureFeed -Channel $Channel -Coherent $True
return $LatestVersionInfo.Version
}
default { return $Version }
@ -261,7 +275,7 @@ function Get-Download-Link([string]$AzureFeed, [string]$Channel, [string]$Specif
return $PayloadURL
}
function Get-AltDownload-Link([string]$AzureFeed, [string]$Channel, [string]$SpecificVersion, [string]$CLIArchitecture) {
function Get-LegacyDownload-Link([string]$AzureFeed, [string]$Channel, [string]$SpecificVersion, [string]$CLIArchitecture) {
Say-Invocation $MyInvocation
if ($SharedRuntime) {
@ -271,7 +285,7 @@ function Get-AltDownload-Link([string]$AzureFeed, [string]$Channel, [string]$Spe
$PayloadURL = "$AzureFeed/Sdk/$SpecificVersion/dotnet-dev-win-$CLIArchitecture.$SpecificVersion.zip"
}
Say-Verbose "Constructed alternate payload URL: $PayloadURL"
Say-Verbose "Constructed legacy payload URL: $PayloadURL"
return $PayloadURL
}
@ -432,12 +446,12 @@ function Prepend-Sdk-InstallRoot-To-Path([string]$InstallRoot, [string]$BinFolde
$CLIArchitecture = Get-CLIArchitecture-From-Architecture $Architecture
$SpecificVersion = Get-Specific-Version-From-Version -AzureFeed $AzureFeed -Channel $Channel -Version $Version
$DownloadLink = Get-Download-Link -AzureFeed $AzureFeed -Channel $Channel -SpecificVersion $SpecificVersion -CLIArchitecture $CLIArchitecture
$AltDownloadLink = Get-AltDownload-Link -AzureFeed $AzureFeed -Channel $Channel -SpecificVersion $SpecificVersion -CLIArchitecture $CLIArchitecture
$LegacyDownloadLink = Get-LegacyDownload-Link -AzureFeed $AzureFeed -Channel $Channel -SpecificVersion $SpecificVersion -CLIArchitecture $CLIArchitecture
if ($DryRun) {
Say "Payload URLs:"
Say "Primary - $DownloadLink"
Say "Alternate - $AltDownloadLink"
Say "Legacy - $LegacyDownloadLink"
Say "Repeatable invocation: .\$($MyInvocation.MyCommand) -Version $SpecificVersion -Channel $Channel -Architecture $CLIArchitecture -InstallDir $InstallDir"
exit 0
}
@ -464,14 +478,17 @@ if ($free.Freespace / 1MB -le 100 ) {
}
$ZipPath = [System.IO.Path]::GetTempFileName()
Say "Downloading $DownloadLink"
Say-Verbose "Zip path: $ZipPath"
Say "Downloading link: $DownloadLink"
try {
DownloadFile -Uri $DownloadLink -OutPath $ZipPath
}
catch {
$DownloadLink = $AltDownloadLink
Say "Cannot download: $DownloadLink"
$DownloadLink = $LegacyDownloadLink
$ZipPath = [System.IO.Path]::GetTempFileName()
Say "Downloading $DownloadLink"
Say-Verbose "Legacy zip path: $ZipPath"
Say "Downloading legacy link: $DownloadLink"
DownloadFile -Uri $DownloadLink -OutPath $ZipPath
}

View file

@ -147,7 +147,7 @@ get_distro_specific_os_name() {
fi
fi
say_err "OS name could not be detected: $ID.$VERSION_ID"
say_verbose "Distribution specific OS name and version could not be detected: $ID.$VERSION_ID"
return 1
}
@ -339,12 +339,17 @@ get_latest_version_info() {
local azure_feed=$1
local channel=$2
local normalized_architecture=$3
local coherent=$4
local version_file_url=null
if [ "$shared_runtime" = true ]; then
version_file_url="$uncached_feed/Runtime/$channel/latest.version"
else
version_file_url="$uncached_feed/Sdk/$channel/latest.version"
if [ "$coherent" = true ]; then
version_file_url="$uncached_feed/Runtime/$channel/latest.coherent.version"
else
version_file_url="$uncached_feed/Sdk/$channel/latest.version"
fi
fi
say_verbose "get_latest_version_info: latest url: $version_file_url"
@ -368,7 +373,14 @@ get_specific_version_from_version() {
case $version in
latest)
local version_info
version_info="$(get_latest_version_info $azure_feed $channel $normalized_architecture)" || return 1
version_info="$(get_latest_version_info $azure_feed $channel $normalized_architecture false)" || return 1
say_verbose "get_specific_version_from_version: version_info=$version_info"
echo "$version_info" | get_version_from_version_info
return 0
;;
coherent)
local version_info
version_info="$(get_latest_version_info $azure_feed $channel $normalized_architecture true)" || return 1
say_verbose "get_specific_version_from_version: version_info=$version_info"
echo "$version_info" | get_version_from_version_info
return 0
@ -412,7 +424,7 @@ construct_download_link() {
# channel - $2
# normalized_architecture - $3
# specific_version - $4
construct_alt_download_link() {
construct_legacy_download_link() {
eval $invocation
local azure_feed=$1
@ -423,14 +435,14 @@ construct_alt_download_link() {
local distro_specific_osname
distro_specific_osname=$(get_distro_specific_os_name) || return 1
local alt_download_link=null
local legacy_download_link=null
if [ "$shared_runtime" = true ]; then
alt_download_link="$azure_feed/Runtime/$specific_version/dotnet-$distro_specific_osname-$normalized_architecture.$specific_version.tar.gz"
legacy_download_link="$azure_feed/Runtime/$specific_version/dotnet-$distro_specific_osname-$normalized_architecture.$specific_version.tar.gz"
else
alt_download_link="$azure_feed/Sdk/$specific_version/dotnet-dev-$distro_specific_osname-$normalized_architecture.$specific_version.tar.gz"
legacy_download_link="$azure_feed/Sdk/$specific_version/dotnet-dev-$distro_specific_osname-$normalized_architecture.$specific_version.tar.gz"
fi
echo "$alt_download_link"
echo "$legacy_download_link"
return 0
}
@ -601,7 +613,8 @@ downloadwget() {
calculate_vars() {
eval $invocation
valid_legacy_download_link=true
normalized_architecture=$(get_normalized_architecture_from_architecture "$architecture")
say_verbose "normalized_architecture=$normalized_architecture"
@ -615,8 +628,13 @@ calculate_vars() {
download_link=$(construct_download_link $azure_feed $channel $normalized_architecture $specific_version)
say_verbose "download_link=$download_link"
alt_download_link=$(construct_alt_download_link $azure_feed $channel $normalized_architecture $specific_version)
say_verbose "alt_download_link=$alt_download_link"
legacy_download_link=$(construct_legacy_download_link $azure_feed $channel $normalized_architecture $specific_version) || valid_legacy_download_link=false
if [ "$valid_legacy_download_link" = true ]; then
say_verbose "legacy_download_link=$legacy_download_link"
else
say_verbose "Cound not construct a legacy_download_link; omitting..."
fi
install_root=$(resolve_installation_path $install_dir)
say_verbose "install_root=$install_root"
@ -638,16 +656,17 @@ install_dotnet() {
say "Downloading link: $download_link"
download "$download_link" $zip_path || download_failed=true
# if the download fails, download the alt_download_link
if [ "$download_failed" = true ]; then
# if the download fails, download the legacy_download_link
if [ "$download_failed" = true ] && [ "$valid_legacy_download_link" = true ]; then
say "Cannot download: $download_link"
download_link=$legacy_download_link
zip_path=$(mktemp $temporary_file_template)
say_verbose "Alternate zip path: $zip_path"
say "Downloading alternate link: $alt_download_link"
download "$alt_download_link" $zip_path
say_verbose "Legacy zip path: $zip_path"
say "Downloading legacy link: $download_link"
download "$download_link" $zip_path
fi
say "Extracting zip"
say "Extracting zip from $download_link"
extract_dotnet_package $zip_path $install_root
return 0
@ -657,11 +676,10 @@ local_version_file_relative_path="/.version"
bin_folder_relative_path=""
temporary_file_template="${TMPDIR:-/tmp}/dotnet.XXXXXXXXX"
channel="release/1.0.0"
channel="LTS"
version="Latest"
install_dir="<auto>"
architecture="<auto>"
debug_symbols=false
dry_run=false
no_path=false
azure_feed="https://dotnetcli.azureedge.net/dotnet"
@ -693,9 +711,6 @@ do
--shared-runtime|-[Ss]hared[Rr]untime)
shared_runtime=true
;;
--debug-symbols|-[Dd]ebug[Ss]ymbols)
debug_symbols=true
;;
--dry-run|-[Dd]ry[Rr]un)
dry_run=true
;;
@ -726,17 +741,29 @@ do
echo "$script_name is a simple command line interface for obtaining dotnet cli."
echo ""
echo "Options:"
echo " -c,--channel <CHANNEL> Download from the CHANNEL specified (default: $channel)."
echo " -c,--channel <CHANNEL> Download from the CHANNEL specified, Defaults to \`$channel\`."
echo " -Channel"
echo " -v,--version <VERSION> Use specific version, or \`latest\`. Defaults to \`latest\`."
echo " Possible values:"
echo " - Current - most current release"
echo " - LTS - most current supported release"
echo " - 2-part version in a format A.B - represents a specific release"
echo " examples: 2.0; 1.0"
echo " - Branch name"
echo " examples: release/2.0.0; Master"
echo " -v,--version <VERSION> Use specific VERSION, Defaults to \`$version\`."
echo " -Version"
echo " Possible values:"
echo " - latest - most latest build on specific channel"
echo " - coherent - most latest coherent build on specific channel"
echo " coherent applies only to SDK downloads"
echo " - 3-part version in a format A.B.C - represents specific version of build"
echo " examples: 2.0.0-preview2-006120; 1.1.0"
echo " -i,--install-dir <DIR> Install under specified location (see Install Location below)"
echo " -InstallDir"
echo " --architecture <ARCHITECTURE> Architecture of .NET Tools. Currently only x64 is supported."
echo " --arch,-Architecture,-Arch"
echo " --shared-runtime Installs just the shared runtime bits, not the entire SDK."
echo " -SharedRuntime"
echo " --debug-symbols,-DebugSymbols Specifies if symbols should be included in the installation."
echo " --dry-run,-DryRun Do not perform installation. Display download link."
echo " --no-path, -NoPath Do not set PATH for the current process."
echo " --verbose,-Verbose Display diagnostics information."
@ -764,9 +791,12 @@ done
check_min_reqs
calculate_vars
if [ "$dry_run" = true ]; then
say "Payload URL: $download_link"
say "Alternate payload URL: $alt_download_link"
if [ "$valid_legacy_download_link" = true ]; then
say "Legacy payload URL: $legacy_download_link"
fi
say "Repeatable invocation: ./$(basename $0) --version $specific_version --channel $channel --install-dir $install_dir"
exit 0
fi

View file

@ -0,0 +1,39 @@
#!/usr/bin/env bash
#
# Copyright (c) .NET Foundation and contributors. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
#
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
current_userid=$(id -u)
if [ $current_userid -ne 0 ]; then
echo "$(basename "$0") uninstallation script requires superuser privileges to run"
exit 1
fi
host_package_name="dotnet-host"
remove_all(){
yum remove -y $host_package_name
}
is_dotnet_host_installed(){
local out="$(yum list installed | grep $host_package_name)"
[ -z "$out" ]
}
is_dotnet_host_installed
[ "$?" -eq 0 ] && echo "Unable to find dotnet installation to remove." >&2 \
&& exit 0
remove_all
[ "$?" -ne 0 ] && echo "Failed to remove dotnet packages." >&2 && exit 1
is_dotnet_host_installed
[ "$?" -ne 0 ] && \
echo "dotnet package removal succeeded but appear to still be installed. Please file an issue at https://github.com/dotnet/cli" >&2 && \
exit 1
echo "dotnet package removal succeeded." >&2
exit 0

View file

@ -8,11 +8,14 @@ namespace Microsoft.DotNet.Cli.Utils
{
public class AnsiConsole
{
private const int Light = 0x08;
private AnsiConsole(TextWriter writer)
{
Writer = writer;
OriginalForegroundColor = Console.ForegroundColor;
_boldRecursion = ((int)OriginalForegroundColor & Light) != 0 ? 1 : 0;
}
private int _boldRecursion;
@ -33,7 +36,6 @@ namespace Microsoft.DotNet.Cli.Utils
private void SetColor(ConsoleColor color)
{
const int Light = 0x08;
int c = (int)color;
Console.ForegroundColor =

View file

@ -12,31 +12,36 @@ namespace Microsoft.DotNet.Tools
{
private bool NoRestore { get; }
private IEnumerable<string> ArgsToForward { get; }
private IEnumerable<string> ParsedArguments { get; }
private IEnumerable<string> TrailingArguments { get; }
private IEnumerable<string> ArgsToForwardToRestore()
{
var restoreArguments = ArgsToForward.Where(a =>
!a.StartsWith("/t:") &&
!a.StartsWith("/target:") &&
!a.StartsWith("/ConsoleLoggerParameters:") &&
!a.StartsWith("/clp:"));
var restoreArguments = ParsedArguments.Where(a =>
!a.StartsWith("/p:TargetFramework"));
if (!restoreArguments.Any(a => a.StartsWith("/v:") || a.StartsWith("/verbosity:")))
if (!restoreArguments.Any(a => a.StartsWith("/verbosity:")))
{
restoreArguments = restoreArguments.Concat(new string[] { "/v:q" });
restoreArguments = restoreArguments.Concat(new string[] { "/verbosity:q" });
}
return restoreArguments;
return restoreArguments.Concat(TrailingArguments);
}
private bool ShouldRunImplicitRestore => !NoRestore;
public RestoringCommand(IEnumerable<string> msbuildArgs, bool noRestore, string msbuildPath = null)
public RestoringCommand(
IEnumerable<string> msbuildArgs,
IEnumerable<string> parsedArguments,
IEnumerable<string> trailingArguments,
bool noRestore,
string msbuildPath = null)
: base(msbuildArgs, msbuildPath)
{
NoRestore = noRestore;
ArgsToForward = msbuildArgs;
ParsedArguments = parsedArguments;
TrailingArguments = trailingArguments;
}
public override int Execute()

View file

@ -15,8 +15,13 @@ namespace Microsoft.DotNet.Tools.Build
{
public class BuildCommand : RestoringCommand
{
public BuildCommand(IEnumerable<string> msbuildArgs, bool noRestore, string msbuildPath = null)
: base(msbuildArgs, noRestore, msbuildPath)
public BuildCommand(
IEnumerable<string> msbuildArgs,
IEnumerable<string> userDefinedArguments,
IEnumerable<string> trailingArguments,
bool noRestore,
string msbuildPath = null)
: base(msbuildArgs, userDefinedArguments, trailingArguments, noRestore, msbuildPath)
{
}
@ -49,7 +54,12 @@ namespace Microsoft.DotNet.Tools.Build
bool noRestore = appliedBuildOptions.HasOption("--no-restore");
return new BuildCommand(msbuildArgs, noRestore, msbuildPath);
return new BuildCommand(
msbuildArgs,
appliedBuildOptions.OptionValuesToBeForwarded(),
appliedBuildOptions.Arguments,
noRestore,
msbuildPath);
}
public static int Run(string[] args)

View file

@ -14,8 +14,13 @@ namespace Microsoft.DotNet.Tools.Pack
{
public class PackCommand : RestoringCommand
{
public PackCommand(IEnumerable<string> msbuildArgs, bool noRestore, string msbuildPath = null)
: base(msbuildArgs, noRestore, msbuildPath)
public PackCommand(
IEnumerable<string> msbuildArgs,
IEnumerable<string> userDefinedArguments,
IEnumerable<string> trailingArguments,
bool noRestore,
string msbuildPath = null)
: base(msbuildArgs, userDefinedArguments, trailingArguments, noRestore, msbuildPath)
{
}
@ -40,7 +45,12 @@ namespace Microsoft.DotNet.Tools.Pack
bool noRestore = parsedPack.HasOption("--no-restore");
return new PackCommand(msbuildArgs, noRestore, msbuildPath);
return new PackCommand(
msbuildArgs,
parsedPack.OptionValuesToBeForwarded(),
parsedPack.Arguments,
noRestore,
msbuildPath);
}
public static int Run(string[] args)

View file

@ -13,8 +13,13 @@ namespace Microsoft.DotNet.Tools.Publish
{
public class PublishCommand : RestoringCommand
{
private PublishCommand(IEnumerable<string> msbuildArgs, bool noRestore, string msbuildPath = null)
: base(msbuildArgs, noRestore, msbuildPath)
private PublishCommand(
IEnumerable<string> msbuildArgs,
IEnumerable<string> userDefinedArguments,
IEnumerable<string> trailingArguments,
bool noRestore,
string msbuildPath = null)
: base(msbuildArgs, userDefinedArguments, trailingArguments, noRestore, msbuildPath)
{
}
@ -40,7 +45,12 @@ namespace Microsoft.DotNet.Tools.Publish
bool noRestore = appliedPublishOption.HasOption("--no-restore");
return new PublishCommand(msbuildArgs, noRestore, msbuildPath);
return new PublishCommand(
msbuildArgs,
appliedPublishOption.OptionValuesToBeForwarded(),
appliedPublishOption.Arguments,
noRestore,
msbuildPath);
}
public static int Run(string[] args)

View file

@ -145,7 +145,8 @@ namespace Microsoft.DotNet.Tools.Run
buildArgs.AddRange(RestoreArgs);
var buildResult = new RestoringCommand(buildArgs, NoRestore).Execute();
var buildResult =
new RestoringCommand(buildArgs, RestoreArgs, new [] { Project }, NoRestore).Execute();
if (buildResult != 0)
{
Reporter.Error.WriteLine();

View file

@ -16,8 +16,13 @@ namespace Microsoft.DotNet.Tools.Test
{
public class TestCommand : RestoringCommand
{
public TestCommand(IEnumerable<string> msbuildArgs, bool noRestore, string msbuildPath = null)
: base(msbuildArgs, noRestore, msbuildPath)
public TestCommand(
IEnumerable<string> msbuildArgs,
IEnumerable<string> userDefinedArguments,
IEnumerable<string> trailingArguments,
bool noRestore,
string msbuildPath = null)
: base(msbuildArgs, userDefinedArguments, trailingArguments, noRestore, msbuildPath)
{
}
@ -67,7 +72,12 @@ namespace Microsoft.DotNet.Tools.Test
bool noRestore = parsedTest.HasOption("--no-restore");
return new TestCommand(msbuildArgs, noRestore, msbuildPath);
return new TestCommand(
msbuildArgs,
parsedTest.OptionValuesToBeForwarded(),
parsedTest.Arguments,
noRestore,
msbuildPath);
}
public static int Run(string[] args)

View file

@ -8,7 +8,7 @@
<AssemblyOriginatorKeyFile>../../tools/Key.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
<PackageTargetFallback>$(PackageTargetFallback);dotnet5.4</PackageTargetFallback>
<AssetTargetFallback>$(AssetTargetFallback);dotnet5.4</AssetTargetFallback>
<RootNamespace>Microsoft.DotNet.Cli</RootNamespace>
</PropertyGroup>
<ItemGroup>

View file

@ -10,7 +10,7 @@
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<CopyBuildOutputToPublishDirectory>false</CopyBuildOutputToPublishDirectory>
<PackageTargetFallback>$(PackageTargetFallback);dotnet5.4</PackageTargetFallback>
<AssetTargetFallback>$(AssetTargetFallback);dotnet5.4</AssetTargetFallback>
<PublishDir>$(SdkOutputDirectory)</PublishDir>
<VersionSuffix>$(CommitCount)</VersionSuffix>
</PropertyGroup>

View file

@ -6,7 +6,7 @@
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
<AssemblyName>ArgumentForwardingTests</AssemblyName>
<OutputType>Exe</OutputType>
<PackageTargetFallback>$(PackageTargetFallback);dotnet5.4;portable-net451+win8</PackageTargetFallback>
<AssetTargetFallback>$(AssetTargetFallback);dotnet5.4;portable-net451+win8</AssetTargetFallback>
</PropertyGroup>
<ItemGroup>

View file

@ -6,7 +6,7 @@
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
<AssemblyName>EndToEnd</AssemblyName>
<OutputType>Exe</OutputType>
<PackageTargetFallback>$(PackageTargetFallback);dotnet5.4;portable-net451+win8</PackageTargetFallback>
<AssetTargetFallback>$(AssetTargetFallback);dotnet5.4;portable-net451+win8</AssetTargetFallback>
</PropertyGroup>
<ItemGroup>

View file

@ -9,7 +9,7 @@
<AssemblyOriginatorKeyFile>../../tools/test_key.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
<PackageTargetFallback>$(PackageTargetFallback);netstandardapp1.5;dotnet5.4;portable-net451+win8</PackageTargetFallback>
<AssetTargetFallback>$(AssetTargetFallback);netstandardapp1.5;dotnet5.4;portable-net451+win8</AssetTargetFallback>
</PropertyGroup>
<ItemGroup>

View file

@ -9,7 +9,7 @@
<AssemblyOriginatorKeyFile>../../tools/Key.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
<PackageTargetFallback>$(PackageTargetFallback);netstandardapp1.5;dotnet5.4;portable-net451+win8</PackageTargetFallback>
<AssetTargetFallback>$(AssetTargetFallback);netstandardapp1.5;dotnet5.4;portable-net451+win8</AssetTargetFallback>
</PropertyGroup>
<ItemGroup>
@ -36,7 +36,7 @@
<PackageReference Include="NuGet.Packaging" Version="$(CLI_NuGet_Version)" />
<PackageReference Include="NuGet.Frameworks" Version="$(CLI_NuGet_Version)" />
<PackageReference Include="NuGet.ProjectModel" Version="$(CLI_NuGet_Version)" />
<PackageReference Include="moq.netcore" Version="4.4.0-beta8" />
<PackageReference Include="Moq" Version="4.7.25" />
<PackageReference Include="xunit" Version="2.2.0-beta4-build3444" />
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="$(PlatformAbstractionsVersion)" />
<PackageReference Include="Microsoft.Build.Runtime" Version="$(CLI_MSBuild_Version)" />

View file

@ -9,7 +9,7 @@
<AssemblyOriginatorKeyFile>../../tools/Key.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
<PackageTargetFallback>$(PackageTargetFallback);dotnet5.4;portable-net451+win8</PackageTargetFallback>
<AssetTargetFallback>$(AssetTargetFallback);dotnet5.4;portable-net451+win8</AssetTargetFallback>
</PropertyGroup>
<ItemGroup>
@ -22,7 +22,7 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20161024-02" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0-beta4-build1194" />
<PackageReference Include="FluentAssertions" Version="4.18.0" />
<PackageReference Include="moq.netcore" Version="4.4.0-beta8" />
<PackageReference Include="Moq" Version="4.7.25" />
<PackageReference Include="xunit" Version="2.2.0-beta4-build3444" />
</ItemGroup>
</Project>

View file

@ -8,7 +8,7 @@
<AssemblyOriginatorKeyFile>../../tools/Key.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
<PackageTargetFallback>$(PackageTargetFallback);dotnet5.4;portable-net451+win8</PackageTargetFallback>
<AssetTargetFallback>$(AssetTargetFallback);dotnet5.4;portable-net451+win8</AssetTargetFallback>
<NetStandardImplicitPackageVersion>1.6.0</NetStandardImplicitPackageVersion>
</PropertyGroup>

View file

@ -5,7 +5,7 @@
<TargetFramework>$(CliTargetFramework)</TargetFramework>
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
<AssemblyName>Msbuild.Tests.Utilities</AssemblyName>
<PackageTargetFallback>$(PackageTargetFallback);dotnet5.4;portable-net451+win8</PackageTargetFallback>
<AssetTargetFallback>$(AssetTargetFallback);dotnet5.4;portable-net451+win8</AssetTargetFallback>
</PropertyGroup>
<ItemGroup>

View file

@ -6,7 +6,7 @@
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<AssemblyName>binding-redirects.Tests</AssemblyName>
<PackageTargetFallback>$(PackageTargetFallback);dotnet5.4;portable-net451+win8</PackageTargetFallback>
<AssetTargetFallback>$(AssetTargetFallback);dotnet5.4;portable-net451+win8</AssetTargetFallback>
</PropertyGroup>
<ItemGroup>

View file

@ -6,7 +6,7 @@
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<AssemblyName>crossgen.Tests</AssemblyName>
<PackageTargetFallback>$(PackageTargetFallback);dotnet5.4;portable-net451+win8</PackageTargetFallback>
<AssetTargetFallback>$(AssetTargetFallback);dotnet5.4;portable-net451+win8</AssetTargetFallback>
</PropertyGroup>
<ItemGroup>

View file

@ -9,7 +9,7 @@
<AssemblyOriginatorKeyFile>../../tools/Key.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
<PackageTargetFallback>$(PackageTargetFallback);dotnet5.4;portable-net451+win8</PackageTargetFallback>
<AssetTargetFallback>$(AssetTargetFallback);dotnet5.4;portable-net451+win8</AssetTargetFallback>
</PropertyGroup>
<ItemGroup>

View file

@ -6,7 +6,7 @@
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<AssemblyName>dotnet-add-reference.Tests</AssemblyName>
<PackageTargetFallback>$(PackageTargetFallback);dotnet5.4;portable-net451+win8</PackageTargetFallback>
<AssetTargetFallback>$(AssetTargetFallback);dotnet5.4;portable-net451+win8</AssetTargetFallback>
</PropertyGroup>
<ItemGroup>

View file

@ -4,6 +4,7 @@
using System;
using System.IO;
using FluentAssertions;
using Microsoft.DotNet.TestFramework;
using Microsoft.DotNet.Tools.Test.Utilities;
using Xunit;
using System.Linq;
@ -52,6 +53,23 @@ namespace Microsoft.DotNet.Cli.Build.Tests
.Should().Pass();
}
[Fact]
public void ItCanBuildAMultiTFMProjectWithImplicitRestore()
{
var testInstance = TestAssets.Get(
TestAssetKinds.DesktopTestProjects,
"NETFrameworkReferenceNETStandard20")
.CreateInstance()
.WithSourceFiles();
string projectDirectory = Path.Combine(testInstance.Root.FullName, "MultiTFMTestApp");
new BuildCommand()
.WithWorkingDirectory(projectDirectory)
.Execute("--framework netcoreapp2.0")
.Should().Pass();
}
[Fact]
public void ItDoesNotImplicitlyRestoreAProjectWhenBuildingWithTheNoRestoreOption()
{

View file

@ -6,7 +6,7 @@
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<AssemblyName>dotnet-build.Tests</AssemblyName>
<PackageTargetFallback>$(PackageTargetFallback);dotnet5.4;portable-net451+win8</PackageTargetFallback>
<AssetTargetFallback>$(AssetTargetFallback);dotnet5.4;portable-net451+win8</AssetTargetFallback>
</PropertyGroup>
<ItemGroup>

View file

@ -6,7 +6,7 @@
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<AssemblyName>dotnet-clean.Tests</AssemblyName>
<PackageTargetFallback>$(PackageTargetFallback);dotnet5.4;portable-net451+win8</PackageTargetFallback>
<AssetTargetFallback>$(AssetTargetFallback);dotnet5.4;portable-net451+win8</AssetTargetFallback>
</PropertyGroup>
<ItemGroup>

View file

@ -9,7 +9,7 @@
<AssemblyOriginatorKeyFile>../../tools/Key.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
<PackageTargetFallback>$(PackageTargetFallback);dnxcore50;portable-net45+win8</PackageTargetFallback>
<AssetTargetFallback>$(AssetTargetFallback);dnxcore50;portable-net45+win8</AssetTargetFallback>
</PropertyGroup>
<ItemGroup>

View file

@ -6,7 +6,7 @@
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<AssemblyName>dotnet-list-reference.Tests</AssemblyName>
<PackageTargetFallback>$(PackageTargetFallback);dotnet5.4;portable-net451+win8</PackageTargetFallback>
<AssetTargetFallback>$(AssetTargetFallback);dotnet5.4;portable-net451+win8</AssetTargetFallback>
</PropertyGroup>
<ItemGroup>

View file

@ -6,7 +6,7 @@
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<AssemblyName>dotnet-migrate.Tests</AssemblyName>
<PackageTargetFallback>$(PackageTargetFallback);netstandardapp1.5;dotnet5.4;portable-net451+win8</PackageTargetFallback>
<AssetTargetFallback>$(AssetTargetFallback);netstandardapp1.5;dotnet5.4;portable-net451+win8</AssetTargetFallback>
</PropertyGroup>
<ItemGroup>
@ -27,7 +27,7 @@
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0-beta4-build1194" />
<PackageReference Include="xunit" Version="2.2.0-beta4-build3444" />
<PackageReference Include="FluentAssertions" Version="4.18.0" />
<PackageReference Include="moq.netcore" Version="4.4.0-beta8" />
<PackageReference Include="Moq" Version="4.7.25" />
<PackageReference Include="Microsoft.DotNet.ProjectJsonMigration" Version="$(CliMigrateVersion)" />
</ItemGroup>
</Project>

View file

@ -9,7 +9,7 @@
<AssemblyOriginatorKeyFile>../../tools/Key.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
<PackageTargetFallback>$(PackageTargetFallback);dotnet5.4;portable-net451+win8</PackageTargetFallback>
<AssetTargetFallback>$(AssetTargetFallback);dotnet5.4;portable-net451+win8</AssetTargetFallback>
</PropertyGroup>
<ItemGroup>

View file

@ -67,9 +67,10 @@ namespace Microsoft.DotNet.New.Tests
.Execute($"{projectType} --debug:ephemeral-hive --no-restore")
.Should().Pass();
// https://github.com/dotnet/templating/issues/946 - remove DisableImplicitAssetTargetFallback once this is fixed.
new RestoreCommand()
.WithWorkingDirectory(projectFolder)
.Execute($"--configfile {repoRootNuGetConfig} --packages {packagesDirectory}")
.Execute($"--configfile {repoRootNuGetConfig} --packages {packagesDirectory} /p:DisableImplicitAssetTargetFallback=true")
.Should().Pass();
}

View file

@ -56,14 +56,15 @@ namespace Microsoft.DotNet.New.Tests
Directory.CreateDirectory(Path.Combine(rootPath, "wwwroot", "dist"));
}
// https://github.com/dotnet/templating/issues/946 - remove DisableImplicitAssetTargetFallback once this is fixed.
new TestCommand("dotnet")
.WithWorkingDirectory(rootPath)
.Execute($"restore")
.Execute($"restore /p:DisableImplicitAssetTargetFallback=true")
.Should().Pass();
var buildResult = new TestCommand("dotnet")
.WithWorkingDirectory(rootPath)
.ExecuteWithCapturedOutput("build")
.ExecuteWithCapturedOutput("build --no-restore")
.Should().Pass()
.And.NotHaveStdErr();
}

View file

@ -6,7 +6,7 @@
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<AssemblyName>dotnet-new.Tests</AssemblyName>
<PackageTargetFallback>$(PackageTargetFallback);dnxcore50;portable-net45+win8</PackageTargetFallback>
<AssetTargetFallback>$(AssetTargetFallback);dnxcore50;portable-net45+win8</AssetTargetFallback>
</PropertyGroup>
<ItemGroup>

View file

@ -6,7 +6,7 @@
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<AssemblyName>dotnet-nuget.UnitTests</AssemblyName>
<PackageTargetFallback>$(PackageTargetFallback);dotnet5.4;portable-net451+win8</PackageTargetFallback>
<AssetTargetFallback>$(AssetTargetFallback);dotnet5.4;portable-net451+win8</AssetTargetFallback>
</PropertyGroup>
<ItemGroup>
@ -19,6 +19,6 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20161024-02" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0-beta4-build1194" />
<PackageReference Include="xunit" Version="2.2.0-beta4-build3444" />
<PackageReference Include="moq.netcore" Version="4.4.0-beta8" />
<PackageReference Include="Moq" Version="4.7.25" />
</ItemGroup>
</Project>

View file

@ -6,7 +6,7 @@
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<AssemblyName>dotnet-pack.Tests</AssemblyName>
<PackageTargetFallback>$(PackageTargetFallback);dotnet5.4;portable-net451+win8</PackageTargetFallback>
<AssetTargetFallback>$(AssetTargetFallback);dotnet5.4;portable-net451+win8</AssetTargetFallback>
</PropertyGroup>
<ItemGroup>

View file

@ -8,6 +8,7 @@ using System.Runtime.InteropServices;
using FluentAssertions;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.PlatformAbstractions;
using Microsoft.DotNet.TestFramework;
using Microsoft.DotNet.Tools.Test.Utilities;
using Xunit;
@ -60,6 +61,23 @@ namespace Microsoft.DotNet.Cli.Publish.Tests
.Should().Pass();
}
[Fact]
public void ItCanPublishAMultiTFMProjectWithImplicitRestore()
{
var testInstance = TestAssets.Get(
TestAssetKinds.DesktopTestProjects,
"NETFrameworkReferenceNETStandard20")
.CreateInstance()
.WithSourceFiles();
string projectDirectory = Path.Combine(testInstance.Root.FullName, "MultiTFMTestApp");
new PublishCommand()
.WithWorkingDirectory(projectDirectory)
.Execute("--framework netcoreapp2.0")
.Should().Pass();
}
[Fact]
public void ItDoesNotImplicitlyRestoreAProjectWhenPublishingWithTheNoRestoreOption()
{

View file

@ -6,7 +6,7 @@
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<AssemblyName>dotnet-publish.Tests</AssemblyName>
<PackageTargetFallback>$(PackageTargetFallback);dotnet5.4;portable-net451+win8</PackageTargetFallback>
<AssetTargetFallback>$(AssetTargetFallback);dotnet5.4;portable-net451+win8</AssetTargetFallback>
</PropertyGroup>
<ItemGroup>

View file

@ -9,7 +9,7 @@
<AssemblyOriginatorKeyFile>../../tools/Key.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
<PackageTargetFallback>$(PackageTargetFallback);dotnet5.4;portable-net451+win8</PackageTargetFallback>
<AssetTargetFallback>$(AssetTargetFallback);dotnet5.4;portable-net451+win8</AssetTargetFallback>
</PropertyGroup>
<ItemGroup>

View file

@ -6,7 +6,7 @@
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<AssemblyName>dotnet-remove-reference.Tests</AssemblyName>
<PackageTargetFallback>$(PackageTargetFallback);dotnet5.4;portable-net451+win8</PackageTargetFallback>
<AssetTargetFallback>$(AssetTargetFallback);dotnet5.4;portable-net451+win8</AssetTargetFallback>
</PropertyGroup>
<ItemGroup>

View file

@ -6,7 +6,7 @@
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<AssemblyName>dotnet-restore.Tests</AssemblyName>
<PackageTargetFallback>$(PackageTargetFallback);dnxcore50;portable-net45+win8</PackageTargetFallback>
<AssetTargetFallback>$(AssetTargetFallback);dnxcore50;portable-net45+win8</AssetTargetFallback>
</PropertyGroup>
<ItemGroup>

View file

@ -3,6 +3,7 @@
using System.IO;
using FluentAssertions;
using Microsoft.DotNet.TestFramework;
using Microsoft.DotNet.Tools.Test.Utilities;
using Xunit;
@ -54,6 +55,24 @@ namespace Microsoft.DotNet.Cli.Run.Tests
.And.HaveStdOutContaining("Hello World!");
}
[Fact]
public void ItCanRunAMultiTFMProjectWithImplicitRestore()
{
var testInstance = TestAssets.Get(
TestAssetKinds.DesktopTestProjects,
"NETFrameworkReferenceNETStandard20")
.CreateInstance()
.WithSourceFiles();
string projectDirectory = Path.Combine(testInstance.Root.FullName, "MultiTFMTestApp");
new RunCommand()
.WithWorkingDirectory(projectDirectory)
.ExecuteWithCapturedOutput("--framework netcoreapp2.0")
.Should().Pass()
.And.HaveStdOutContaining("This string came from the test library!");
}
[Fact]
public void ItDoesNotImplicitlyRestoreAProjectWhenRunningWithTheNoRestoreOption()
{

View file

@ -6,7 +6,7 @@
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<AssemblyName>dotnet-run.Tests</AssemblyName>
<PackageTargetFallback>$(PackageTargetFallback);dotnet5.4;portable-net451+win8</PackageTargetFallback>
<AssetTargetFallback>$(AssetTargetFallback);dotnet5.4;portable-net451+win8</AssetTargetFallback>
</PropertyGroup>
<ItemGroup>

View file

@ -9,7 +9,7 @@
<AssemblyOriginatorKeyFile>../../tools/Key.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
<PackageTargetFallback>$(PackageTargetFallback);dotnet5.4;portable-net451+win8</PackageTargetFallback>
<AssetTargetFallback>$(AssetTargetFallback);dotnet5.4;portable-net451+win8</AssetTargetFallback>
</PropertyGroup>
<ItemGroup>

View file

@ -9,7 +9,7 @@
<AssemblyOriginatorKeyFile>../../tools/Key.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
<PackageTargetFallback>$(PackageTargetFallback);dotnet5.4;portable-net451+win8</PackageTargetFallback>
<AssetTargetFallback>$(AssetTargetFallback);dotnet5.4;portable-net451+win8</AssetTargetFallback>
</PropertyGroup>
<ItemGroup>

View file

@ -9,7 +9,7 @@
<AssemblyOriginatorKeyFile>../../tools/Key.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
<PackageTargetFallback>$(PackageTargetFallback);dotnet5.4;portable-net451+win8</PackageTargetFallback>
<AssetTargetFallback>$(AssetTargetFallback);dotnet5.4;portable-net451+win8</AssetTargetFallback>
</PropertyGroup>
<ItemGroup>

View file

@ -6,7 +6,7 @@
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<AssemblyName>dotnet-cache.Tests</AssemblyName>
<PackageTargetFallback>$(PackageTargetFallback);dotnet5.4;portable-net451+win8</PackageTargetFallback>
<AssetTargetFallback>$(AssetTargetFallback);dotnet5.4;portable-net451+win8</AssetTargetFallback>
</PropertyGroup>
<ItemGroup>

View file

@ -7,6 +7,7 @@ using Microsoft.DotNet.TestFramework;
using Microsoft.DotNet.Cli.Utils;
using System.IO;
using System;
using Xunit;
namespace Microsoft.DotNet.Cli.Test.Tests
{
@ -83,5 +84,21 @@ namespace Microsoft.DotNet.Cli.Test.Tests
result.ExitCode.Should().Be(1);
}
[Fact]
public void ItCanTestAMultiTFMProjectWithImplicitRestore()
{
var testInstance = TestAssets.Get(
TestAssetKinds.DesktopTestProjects,
"MultiTFMXunitProject")
.CreateInstance()
.WithSourceFiles();
string projectDirectory = Path.Combine(testInstance.Root.FullName, "XUnitProject");
new DotnetTestCommand()
.WithWorkingDirectory(projectDirectory)
.ExecuteWithCapturedOutput($"{TestBase.ConsoleLoggerOutputNormal} --framework netcoreapp2.0")
.Should().Pass();
}
}
}

View file

@ -6,7 +6,7 @@
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<AssemblyName>dotnet-test.Tests</AssemblyName>
<PackageTargetFallback>$(PackageTargetFallback);dotnet5.4;portable-net451+win8</PackageTargetFallback>
<AssetTargetFallback>$(AssetTargetFallback);dotnet5.4;portable-net451+win8</AssetTargetFallback>
</PropertyGroup>
<ItemGroup>

View file

@ -6,7 +6,7 @@
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<AssemblyName>dotnet-vstest.Tests</AssemblyName>
<PackageTargetFallback>$(PackageTargetFallback);dotnet5.4;portable-net451+win8</PackageTargetFallback>
<AssetTargetFallback>$(AssetTargetFallback);dotnet5.4;portable-net451+win8</AssetTargetFallback>
</PropertyGroup>
<ItemGroup>

View file

@ -9,7 +9,7 @@
<AssemblyOriginatorKeyFile>../../tools/Key.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
<PackageTargetFallback>$(PackageTargetFallback);netstandardapp1.5;dotnet5.4;portable-net451+win8</PackageTargetFallback>
<AssetTargetFallback>$(AssetTargetFallback);netstandardapp1.5;dotnet5.4;portable-net451+win8</AssetTargetFallback>
</PropertyGroup>
<ItemGroup>

View file

@ -6,7 +6,7 @@
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<AssemblyName>msbuild.IntegrationTests</AssemblyName>
<PackageTargetFallback>$(PackageTargetFallback);dotnet5.4;portable-net451+win8</PackageTargetFallback>
<AssetTargetFallback>$(AssetTargetFallback);dotnet5.4;portable-net451+win8</AssetTargetFallback>
</PropertyGroup>
<ItemGroup>