Merge branch 'release/2.0.0' into loc

This commit is contained in:
Nick Guerrera 2017-06-09 10:30:29 -07:00
commit 31c5294ef5
48 changed files with 693 additions and 166 deletions

View file

@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26419.0
VisualStudioVersion = 15.0.26510.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{ED2FE3E2-F7E7-4389-8231-B65123F2076F}"
EndProject
@ -30,7 +30,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{89905EC4
build\BuildDefaults.props = build\BuildDefaults.props
build\BuildInfo.targets = build\BuildInfo.targets
build\BundledRuntimes.props = build\BundledRuntimes.props
build\BundledSdks.proj = build\BundledSdks.proj
build\BundledSdks.props = build\BundledSdks.props
build\BundledTemplates.proj = build\BundledTemplates.proj
build\BundledTemplates.props = build\BundledTemplates.props
@ -48,10 +47,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{89905EC4
build\InstallerInfo.props = build\InstallerInfo.props
build\Microsoft.DotNet.Cli.tasks = build\Microsoft.DotNet.Cli.tasks
build\MSBuildExtensions.props = build\MSBuildExtensions.props
build\MSBuildExtensions.targets = build\MSBuildExtensions.targets
build\OutputDirectories.props = build\OutputDirectories.props
build\Package.targets = build\Package.targets
build\Prepare.targets = build\Prepare.targets
build\Publish.targets = build\Publish.targets
build\RestoreDependency.proj = build\RestoreDependency.proj
build\sdks\sdks.csproj = build\sdks\sdks.csproj
build\Signing.proj = build\Signing.proj
build\Stage0.props = build\Stage0.props

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

@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net461</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\TestLibrary\TestLibrary.csproj" />
</ItemGroup>
</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;
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

@ -20,7 +20,7 @@
DependsOnTargets="MSBuildWorkaroundTarget;
RestoreDotnetCliBuildFramework">
<Exec Command="$(DotnetStage0) publish -o $(DotnetCliBuildDirectory)/bin --framework netcoreapp2.0 /p:GeneratePropsFile=$(GeneratePropsFile)"
<Exec Command="$(DotnetStage0) publish --no-restore -o $(DotnetCliBuildDirectory)/bin --framework netcoreapp2.0 /p:GeneratePropsFile=$(GeneratePropsFile)"
WorkingDirectory="$(DotnetCliBuildDirectory)"/>
</Target>

View file

@ -5,16 +5,16 @@
<BackwardsCompatibility110SharedHostVersion>1.1.0</BackwardsCompatibility110SharedHostVersion>
<BackwardsCompatibility110HostFxrVersion>1.1.0</BackwardsCompatibility110HostFxrVersion>
<BackwardsCompatibility110DownloadedSharedHostInstallerFileName Condition=" '$(InstallerExtension)' != '' ">dotnet-host-$(ProductMonikerRid).$(BackwardsCompatibility110SharedHostVersion)$(InstallerExtension)</BackwardsCompatibility110DownloadedSharedHostInstallerFileName>
<BackwardsCompatibility110DownloadedSharedHostInstallerFile Condition=" '$(InstallerExtension)' != '' ">$(PackagesDirectory)/$(BackwardsCompatibility110DownloadedSharedHostInstallerFileName)</BackwardsCompatibility110DownloadedSharedHostInstallerFile>
<BackwardsCompatibility110DownloadedSharedHostInstallerFileName Condition=" '$(OSName)' != 'linux' ">dotnet-host-$(HostMonikerRid).$(BackwardsCompatibility110SharedHostVersion)$(InstallerExtension)</BackwardsCompatibility110DownloadedSharedHostInstallerFileName>
<BackwardsCompatibility110DownloadedSharedHostInstallerFile Condition=" '$(OSName)' != 'linux' ">$(PackagesDirectory)/$(BackwardsCompatibility110DownloadedSharedHostInstallerFileName)</BackwardsCompatibility110DownloadedSharedHostInstallerFile>
<BackwardsCompatibility110DownloadedHostFxrInstallerFileName Condition=" '$(InstallerExtension)' != '' ">dotnet-hostfxr-$(ProductMonikerRid).$(BackwardsCompatibility110HostFxrVersion)$(InstallerExtension)</BackwardsCompatibility110DownloadedHostFxrInstallerFileName>
<BackwardsCompatibility110DownloadedHostFxrInstallerFile Condition=" '$(InstallerExtension)' != '' ">$(PackagesDirectory)/$(BackwardsCompatibility110DownloadedHostFxrInstallerFileName)</BackwardsCompatibility110DownloadedHostFxrInstallerFile>
<BackwardsCompatibility110DownloadedHostFxrInstallerFileName Condition=" '$(OSName)' != 'linux' ">dotnet-hostfxr-$(HostMonikerRid).$(BackwardsCompatibility110HostFxrVersion)$(InstallerExtension)</BackwardsCompatibility110DownloadedHostFxrInstallerFileName>
<BackwardsCompatibility110DownloadedHostFxrInstallerFile Condition=" '$(OSName)' != 'linux' ">$(PackagesDirectory)/$(BackwardsCompatibility110DownloadedHostFxrInstallerFileName)</BackwardsCompatibility110DownloadedHostFxrInstallerFile>
<BackwardsCompatibility110DownloadedSharedFrameworkInstallerFileName Condition=" '$(InstallerExtension)' != '' ">dotnet-sharedframework-$(ProductMonikerRid).$(BackwardsCompatibility110SharedFrameworkVersion)$(InstallerExtension)</BackwardsCompatibility110DownloadedSharedFrameworkInstallerFileName>
<BackwardsCompatibility110DownloadedSharedFrameworkInstallerFile Condition=" '$(InstallerExtension)' != '' ">$(PackagesDirectory)/$(BackwardsCompatibility110DownloadedSharedFrameworkInstallerFileName)</BackwardsCompatibility110DownloadedSharedFrameworkInstallerFile>
<BackwardsCompatibility110DownloadedSharedFrameworkInstallerFileName Condition=" '$(OSName)' != 'linux' ">dotnet-sharedframework-$(HostMonikerRid).$(BackwardsCompatibility110SharedFrameworkVersion)$(InstallerExtension)</BackwardsCompatibility110DownloadedSharedFrameworkInstallerFileName>
<BackwardsCompatibility110DownloadedSharedFrameworkInstallerFile Condition=" '$(OSName)' != 'linux' ">$(PackagesDirectory)/$(BackwardsCompatibility110DownloadedSharedFrameworkInstallerFileName)</BackwardsCompatibility110DownloadedSharedFrameworkInstallerFile>
<BackwardsCompatibility110CombinedFrameworkHostCompressedFileName>dotnet-$(ProductMonikerRid).$(BackwardsCompatibility110SharedFrameworkVersion)$(ArchiveExtension)</BackwardsCompatibility110CombinedFrameworkHostCompressedFileName>
<BackwardsCompatibility110CombinedFrameworkHostCompressedFileName>dotnet-$(HostMonikerRid).$(BackwardsCompatibility110SharedFrameworkVersion)$(ArchiveExtension)</BackwardsCompatibility110CombinedFrameworkHostCompressedFileName>
<BackwardsCompatibility110CoreSetupBlobRootUrlWithChannel>$(CoreSetupBlobRootUrl)$(BackwardsCompatibility110CoreSetupChannel)</BackwardsCompatibility110CoreSetupBlobRootUrlWithChannel>
<BackwardsCompatibility110SharedFrameworkArchiveBlobRootUrl>$(BackwardsCompatibility110CoreSetupBlobRootUrlWithChannel)/Binaries/$(BackwardsCompatibility110SharedFrameworkVersion)</BackwardsCompatibility110SharedFrameworkArchiveBlobRootUrl>
@ -34,24 +34,24 @@
</_DownloadAndExtractItem>
<_DownloadAndExtractItem Include="BackwardsCompatibility110DownloadedSharedFrameworkInstallerFile"
Condition="!Exists('$(BackwardsCompatibility110DownloadedSharedFrameworkInstallerFile)') And '$(InstallerExtension)' != ''">
Condition="!Exists('$(BackwardsCompatibility110DownloadedSharedFrameworkInstallerFile)') And '$(OSName)' != 'linux'">
<Url>$(BackwardsCompatibility110CoreSetupInstallerBlobRootUrl)/$(BackwardsCompatibility110SharedFrameworkVersion)/$(BackwardsCompatibility110DownloadedSharedFrameworkInstallerFileName)</Url>
<DownloadFileName>$(BackwardsCompatibility110DownloadedSharedFrameworkInstallerFile)</DownloadFileName>
<ExtractDestination></ExtractDestination>
</_DownloadAndExtractItem>
<_DownloadAndExtractItem Include="BackwardsCompatibility110DownloadedSharedHostInstallerFile"
Condition="!Exists('$(BackwardsCompatibility110DownloadedSharedHostInstallerFile)') And '$(InstallerExtension)' != ''">
Condition="!Exists('$(BackwardsCompatibility110DownloadedSharedHostInstallerFile)') And '$(OSName)' != 'linux'">
<Url>$(BackwardsCompatibility110CoreSetupInstallerBlobRootUrl)/$(BackwardsCompatibility110SharedHostVersion)/$(BackwardsCompatibility110DownloadedSharedHostInstallerFileName)</Url>
<DownloadFileName>$(BackwardsCompatibility110DownloadedSharedHostInstallerFile)</DownloadFileName>
<ExtractDestintation></ExtractDestintation>
</_DownloadAndExtractItem>
<_DownloadAndExtractItem Include="BackwardsCompatibility110DownloadedHostFxrInstallerFile"
Condition="!Exists('$(BackwardsCompatibility110DownloadedHostFxrInstallerFile)') And '$(InstallerExtension)' != ''">
Condition="!Exists('$(BackwardsCompatibility110DownloadedHostFxrInstallerFile)') And '$(OSName)' != 'linux'">
<Url>$(BackwardsCompatibility110CoreSetupInstallerBlobRootUrl)/$(BackwardsCompatibility110HostFxrVersion)/$(BackwardsCompatibility110DownloadedHostFxrInstallerFileName)</Url>
<DownloadFileName>$(BackwardsCompatibility110DownloadedHostFxrInstallerFile)</DownloadFileName>
<ExtractDestintation></ExtractDestintation>
</_DownloadAndExtractItem>
</ItemGroup>
</Project>
</Project>

View file

@ -13,14 +13,21 @@
'$(Rid)' == 'fedora.24-x64' OR
'$(Rid)' == 'opensuse.42.1-x64' ">$(Rid)</ProductMonikerRid>
<ProductMonikerRid Condition=" '$(ProductMonikerRid)' == '' ">$(OSName)-$(Architecture)</ProductMonikerRid>
<HostMonikerRid Condition=" '$(HostRid)' == 'ubuntu.16.04-x64' OR
'$(HostRid)' == 'ubuntu.16.10-x64' OR
'$(HostRid)' == 'fedora.24-x64' OR
'$(HostRid)' == 'opensuse.42.1-x64' ">$(HostRid)</HostMonikerRid>
<HostMonikerRid Condition=" '$(HostMonikerRid)' == '' ">$(HostOSName)-$(Architecture)</HostMonikerRid>
<ArtifactNameSdk>dotnet-sdk-internal</ArtifactNameSdk>
<ArtifactNameSdkDebug>dotnet-sdk-debug</ArtifactNameSdkDebug>
<ArtifactNameCombinedHostHostFxrFrameworkSdk>dotnet-sdk</ArtifactNameCombinedHostHostFxrFrameworkSdk>
<ArtifactNameWithVersionSdk>$(ArtifactNameSdk)-$(SdkVersion)-$(ProductMonikerRid)</ArtifactNameWithVersionSdk>
<ArtifactNameWithVersionSdkDebug>$(ArtifactNameSdkDebug)-$(SdkVersion)-$(ProductMonikerRid)</ArtifactNameWithVersionSdkDebug>
<ArtifactNameWithVersionCombinedHostHostFxrFrameworkSdk>$(ArtifactNameCombinedHostHostFxrFrameworkSdk)-$(SdkVersion)-$(ProductMonikerRid)</ArtifactNameWithVersionCombinedHostHostFxrFrameworkSdk>
<DistroSpecificArtifactNameWithVersionCombinedHostHostFxrFrameworkSdk>$(ArtifactNameCombinedHostHostFxrFrameworkSdk)-$(SdkVersion)-$(HostMonikerRid)</DistroSpecificArtifactNameWithVersionCombinedHostHostFxrFrameworkSdk>
</PropertyGroup>
</Project>

View file

@ -9,10 +9,16 @@
</GetCurrentRuntimeInformation>
<PropertyGroup>
<Rid Condition=" '$(Rid)' == '' ">$(HostRid)</Rid>
<Architecture Condition=" '$(Architecture)' == '' ">x64</Architecture>
<OSName Condition=" '$(OSName)' == '' ">$(HostOSName)</OSName>
<OSPlatform Condition=" '$(OSPlatform)' == '' ">$(HostOSPlatform)</OSPlatform>
<IsLinux Condition = " '$(HostOSName)' != 'win' AND '$(HostOSName)' != 'osx' ">True</IsLinux>
<Rid Condition=" '$(Rid)' == '' AND '$(IsLinux)' != 'True' ">$(HostRid)</Rid>
<Architecture Condition=" '$(Architecture)' == '' AND '$(IsLinux)' != 'True' ">x64</Architecture>
<OSName Condition=" '$(OSName)' == '' AND '$(IsLinux)' != 'True' ">$(HostOSName)</OSName>
<OSPlatform Condition=" '$(OSPlatform)' == '' AND '$(IsLinux)' != 'True' ">$(HostOSPlatform)</OSPlatform>
<Rid Condition=" '$(Rid)' == '' AND '$(IsLinux)' == 'True' ">linux-x64</Rid>
<Architecture Condition=" '$(Architecture)' == '' AND '$(IsLinux)' == 'True' ">x64</Architecture>
<OSName Condition=" '$(OSName)' == '' AND '$(IsLinux)' == 'True' ">linux</OSName>
<OSPlatform Condition=" '$(OSPlatform)' == '' AND '$(IsLinux)' == 'True' ">linux</OSPlatform>
<BuildInfoPropsContent>
&lt;Project ToolsVersion=&quot;14.0&quot; xmlns=&quot;http://schemas.microsoft.com/developer/msbuild/2003&quot;&gt;

View file

@ -1,10 +1,10 @@
<Project>
<PropertyGroup>
<CoreSetupRid>$(Rid)</CoreSetupRid>
<CoreSetupRid Condition=" '$(OSName)' == 'win' or '$(OSName)' == 'osx' ">$(ProductMonikerRid)</CoreSetupRid>
<CoreSetupRid>$(HostRid)</CoreSetupRid>
<CoreSetupRid Condition=" '$(HostOSName)' == 'win' or '$(HostOSName)' == 'osx' ">$(HostMonikerRid)</CoreSetupRid>
<!-- only the runtime OSX .pkgs have a `-internal` suffix -->
<InstallerStartSuffix Condition="'$(OSName)' == 'osx'">-internal</InstallerStartSuffix>
<InstallerStartSuffix Condition="'$(HostOSName)' == 'osx'">-internal</InstallerStartSuffix>
<!-- Downloaded Installers + Archives -->
<DownloadedSharedHostInstallerFileName Condition=" '$(InstallerExtension)' != '' ">dotnet-host$(InstallerStartSuffix)-$(SharedHostVersion)-$(CoreSetupRid)$(InstallerExtension)</DownloadedSharedHostInstallerFileName>
@ -34,8 +34,8 @@
<AspNetCoreRuntimeInstallerBlobRootUrl>$(CoreSetupBlobRootUrl)aspnetcore/store/$(AspNetCoreRuntimeVersion)</AspNetCoreRuntimeInstallerBlobRootUrl>
<!-- Examples: Build.RS.linux.zip Build.RS.winx86.zip AspNetCorePackageStoreLibx64.wixlib -->
<AspNetCoreRuntimeInstallerArchiveFileNameOSToken Condition=" '$(OSName)' == 'win' ">$(OSName)$(Architecture)</AspNetCoreRuntimeInstallerArchiveFileNameOSToken>
<AspNetCoreRuntimeInstallerArchiveFileNameOSToken Condition=" '$(OSName)' == 'osx' ">$(OSName)</AspNetCoreRuntimeInstallerArchiveFileNameOSToken>
<AspNetCoreRuntimeInstallerArchiveFileNameOSToken Condition=" '$(HostOSName)' == 'win' ">$(HostOSName)$(Architecture)</AspNetCoreRuntimeInstallerArchiveFileNameOSToken>
<AspNetCoreRuntimeInstallerArchiveFileNameOSToken Condition=" '$(HostOSName)' == 'osx' ">$(HostOSName)</AspNetCoreRuntimeInstallerArchiveFileNameOSToken>
<AspNetCoreRuntimeInstallerArchiveFileNameOSToken Condition=" '$(AspNetCoreRuntimeInstallerArchiveFileNameOSToken)' == '' ">linux</AspNetCoreRuntimeInstallerArchiveFileNameOSToken>
<AspNetCoreRuntimeStoreSuffix Condition="'$(AspNetCoreRuntimePackageFlavor)' != 'notimestamp'">-$(AspNetCoreCoherenceTimestamp)</AspNetCoreRuntimeStoreSuffix>
@ -43,7 +43,7 @@
<AspNetCoreRuntimeInstallerArchiveFileName>Build.RS.$(AspNetCoreRuntimeInstallerArchiveFileNameOSToken)$(AspNetCoreRuntimeInstallerArchiveSuffix)$(ArchiveExtension)</AspNetCoreRuntimeInstallerArchiveFileName>
<AspNetCoreRuntimeInstallerArchiveFile>$(PackagesDirectory)/$(AspNetCoreRuntimeInstallerArchiveFileName)</AspNetCoreRuntimeInstallerArchiveFile>
<AspNetCoreRuntimeInstallerWixLibFileName Condition=" '$(OSName)' == 'win' ">AspNetCorePackageStoreLib$(Architecture)$(AspNetCoreRuntimeStoreSuffix).wixlib</AspNetCoreRuntimeInstallerWixLibFileName>
<AspNetCoreRuntimeInstallerWixLibFileName Condition=" '$(HostOSName)' == 'win' ">AspNetCorePackageStoreLib$(Architecture)$(AspNetCoreRuntimeStoreSuffix).wixlib</AspNetCoreRuntimeInstallerWixLibFileName>
<AspNetCoreRuntimeInstallerWixLibFile Condition=" '$(AspNetCoreRuntimeInstallerWixLibFileName)' != '' ">$(PackagesDirectory)/$(AspNetCoreRuntimeInstallerWixLibFileName)</AspNetCoreRuntimeInstallerWixLibFile>
</PropertyGroup>

View file

@ -1,45 +0,0 @@
<Project ToolsVersion="15.0" DefaultTargets="CopySdkToOutput">
<!-- workaround for https://github.com/Microsoft/msbuild/issues/885 -->
<!-- renaming the property because the original property is a global property and therefore
cannot be redefined at runtime. -->
<PropertyGroup>
<CLIBuildDllPath>$([MSBuild]::Unescape($(CLIBuildDll)))</CLIBuildDllPath>
</PropertyGroup>
<UsingTask TaskName="DotNetRestore" AssemblyFile="$(CLIBuildDllPath)" />
<Target Name="CopySdkToOutput"
DependsOnTargets="PrepareBundledSdksProps;
EnsureSdkRestored;
GetSdkItemsToCopy"
Inputs="@(SdkContent)"
Outputs="@(SdkContent->'$(SdkLayoutDirectory)/%(RecursiveDir)%(FileName)%(Extension)')">
<Copy SourceFiles="@(SdkContent)"
DestinationFiles="@(SdkContent->'$(SdkLayoutDirectory)/%(RecursiveDir)%(FileName)%(Extension)')" />
<Message Text="Copied Sdk $(SdkPackageName) from $(SdkNuPkgPath) to $(SdkLayoutDirectory)."
Importance="High" />
</Target>
<Target Name="GetSdkItemsToCopy">
<ItemGroup>
<SdkContent Include="$(SdkNuPkgPath)/**/*"
Exclude="$(SdkNuPkgPath)/$(SdkPackageName).nuspec;
$(SdkNuPkgPath)/$(SdkPackageName).$(SdkPackageVersion).nupkg;
$(SdkNuPkgPath)/$(SdkPackageName).$(SdkPackageVersion).nupkg.sha512" />
</ItemGroup>
</Target>
<Target Name="EnsureSdkRestored"
Condition="!Exists('$(SdkNuPkgPath)/$(SdkPackageName.ToLower()).nuspec')">
<DotNetRestore ToolPath="$(Stage0Directory)"
ProjectPath="$(MSBuildThisFileDirectory)/sdks/sdks.csproj"
AdditionalParameters="/p:SdkPackageName=$(SdkPackageName) /p:SdkPackageVersion=$(SdkPackageVersion)" />
</Target>
<Target Name="PrepareBundledSdksProps">
<PropertyGroup>
<SdkNuPkgPath>$(NuGetPackagesDir)/$(SdkPackageName.ToLower())/$(SdkPackageVersion.ToLower())</SdkNuPkgPath>
</PropertyGroup>
</Target>
</Project>

View file

@ -6,29 +6,31 @@
<CLI_Roslyn_Version>2.3.0-beta2-61716-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>
<CLI_NETSDK_Version>2.0.0-preview2-20170602-1</CLI_NETSDK_Version>
<CLI_NETSDK_Version>2.0.0-preview2-20170608-2</CLI_NETSDK_Version>
<CLI_NuGet_Version>4.3.0-preview3-4146</CLI_NuGet_Version>
<CLI_MSBuildExtensions_Version>2.0.0-preview2-20170608-2</CLI_MSBuildExtensions_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-20170601-03</CLI_TestPlatform_Version>
<CLI_TestPlatform_Version>15.3.0-preview-20170609-02</CLI_TestPlatform_Version>
<SharedFrameworkVersion>$(CLI_SharedFrameworkVersion)</SharedFrameworkVersion>
<SharedHostVersion>$(CLI_SharedFrameworkVersion)</SharedHostVersion>
<HostFxrVersion>$(CLI_SharedFrameworkVersion)</HostFxrVersion>
<TemplateEngineVersion>1.0.0-beta2-20170606-253</TemplateEngineVersion>
<TemplateEngineTemplateVersion>1.0.0-beta2-20170606-253</TemplateEngineTemplateVersion>
<TemplateEngineTemplate2_0Version>1.0.0-beta2-20170606-253</TemplateEngineTemplate2_0Version>
<TemplateEngineVersion>1.0.0-beta2-20170608-254</TemplateEngineVersion>
<TemplateEngineTemplateVersion>1.0.0-beta2-20170608-256</TemplateEngineTemplateVersion>
<TemplateEngineTemplate2_0Version>1.0.0-beta2-20170608-256</TemplateEngineTemplate2_0Version>
<PlatformAbstractionsVersion>2.0.0-preview2-25407-01</PlatformAbstractionsVersion>
<DependencyModelVersion>2.0.0-preview2-25407-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-000249</SpaTemplateVersion>
<SpaTemplateVersion>1.0.0-preview-000286</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-158</AspNetCoreRuntimeVersion>
<AspNetCoreRuntimeVersion>2.0.0-preview2-168</AspNetCoreRuntimeVersion>
<AspNetCoherenceLabel>preview2</AspNetCoherenceLabel>
<AspNetCoreCoherenceTimestamp>25487</AspNetCoreCoherenceTimestamp>
<AspNetCoreCoherenceTimestamp>25571</AspNetCoreCoherenceTimestamp>
</PropertyGroup>

View file

@ -1,23 +1,23 @@
<Project>
<PropertyGroup>
<ArchiveExtension Condition=" '$(OSName)' == 'win' ">.zip</ArchiveExtension>
<ArchiveExtension Condition=" '$(OSName)' != 'win' ">.tar.gz</ArchiveExtension>
<ArchiveExtension Condition=" '$(HostOSName)' == 'win' ">.zip</ArchiveExtension>
<ArchiveExtension Condition=" '$(HostOSName)' != 'win' ">.tar.gz</ArchiveExtension>
<InstallerExtension Condition=" '$(OSName)' == 'win' ">.msi</InstallerExtension>
<InstallerExtension Condition=" '$(OSName)' == 'osx' ">.pkg</InstallerExtension>
<InstallerExtension Condition=" '$(OSName)' == 'ubuntu' OR '$(OSName)' == 'debian' ">.deb</InstallerExtension>
<InstallerExtension Condition=" '$(HostOSName)' == 'win' ">.msi</InstallerExtension>
<InstallerExtension Condition=" '$(HostOSName)' == 'osx' ">.pkg</InstallerExtension>
<InstallerExtension Condition=" '$(HostOSName)' == 'ubuntu' OR '$(OSName)' == 'debian' ">.deb</InstallerExtension>
<BundleExtension Condition=" '$(OSName)' == 'win' ">.exe</BundleExtension>
<BundleExtension Condition=" '$(OSName)' == 'osx' ">$(InstallerExtension)</BundleExtension>
<BundleExtension Condition=" '$(OSName)' == 'ubuntu' OR '$(OSName)' == 'debian' ">$(InstallerExtension)</BundleExtension>
<BundleExtension Condition=" '$(HostOSName)' == 'win' ">.exe</BundleExtension>
<BundleExtension Condition=" '$(HostOSName)' == 'osx' ">$(InstallerExtension)</BundleExtension>
<BundleExtension Condition=" '$(HostOSName)' == 'ubuntu' OR '$(OSName)' == 'debian' ">$(InstallerExtension)</BundleExtension>
<DynamicLibPrefix>lib</DynamicLibPrefix>
<DynamicLibPrefix Condition=" '$(OSName)' == 'win' "></DynamicLibPrefix>
<DynamicLibPrefix Condition=" '$(HostOSName)' == 'win' "></DynamicLibPrefix>
<DynamicLibExtension>.so</DynamicLibExtension>
<DynamicLibExtension Condition=" '$(OSName)' == 'win' ">.dll</DynamicLibExtension>
<DynamicLibExtension Condition=" '$(OSName)' == 'osx' ">.dylib</DynamicLibExtension>
<DynamicLibExtension Condition=" '$(HostOSName)' == 'win' ">.dll</DynamicLibExtension>
<DynamicLibExtension Condition=" '$(HostOSName)' == 'osx' ">.dylib</DynamicLibExtension>
<ExeExtension>.exe</ExeExtension>
<ExeExtension Condition=" '$(OS)' != 'Windows_NT' "></ExeExtension>

View file

@ -1,12 +1,64 @@
<Project>
<Target Name="GenerateMSBuildExtensions"
DependsOnTargets="GenerateBundledVersionsProps">
DependsOnTargets="GenerateBundledVersionsProps;RestoreMSBuildExtensionsPackages">
<ItemGroup>
<MSBuildExtensionsContent Include="$(GeneratedMSBuildExtensionsDirectory)/**/*" />
<!-- We want to include the tasks and targets from the Microsoft.NET.Build.Extensions package, but we don't want to include the DLLs
from that package under the net461, net462, etc folders. That is because they come from the NETStandard.Library.NETFramework
package, and we want to insert them directly into the CLI from CoreFx instead of having to do a two-hop insertion (CoreFX -> SDK -> CLI)
if we need to update them.
https://github.com/dotnet/sdk/issues/1324 has been filed to exclude these from the Microsoft.NET.Build.Extensions package when
we generate it.
-->
<MSBuildExtensionsContent Include="$(MSBuildExtensionsNuPkgPath)\msbuildExtensions\**\*.*"
Exclude="$(MSBuildExtensionsNuPkgPath)\msbuildExtensions\Microsoft.NET.Build.Extensions\net*\**" />
<MSBuildExtensionsContent Include="$(MSBuildExtensionsNuPkgPath)\msbuildExtensions-ver\**\*.*"
DeploymentSubpath="$(MSBuildExtensionsVersionSubfolder)/" />
<MSBuildExtensionsContent Include="$(NETStandardLibraryNETFrameworkNuPkgPath)\build\**\*.*"
Exclude="$(NETStandardLibraryNETFrameworkNuPkgPath)\build\**\*.props;$(NETStandardLibraryNETFrameworkNuPkgPath)\build\**\*.targets"
DeploymentSubpath="Microsoft.NET.Build.Extensions/" />
</ItemGroup>
</Target>
<Target Name="PrepareMSBuildExtensionsProps">
<PropertyGroup>
<MSBuildExtensionsPackageName>Microsoft.NET.Build.Extensions</MSBuildExtensionsPackageName>
<MSBuildExtensionsVersionSubfolder>15.0</MSBuildExtensionsVersionSubfolder>
<MSBuildExtensionsNuPkgPath>$(NuGetPackagesDir)/$(MSBuildExtensionsPackageName.ToLower())/$(CLI_MSBuildExtensions_Version.ToLower())</MSBuildExtensionsNuPkgPath>
<NETStandardLibraryNETFrameworkPackageName>NETStandard.Library.NETFramework</NETStandardLibraryNETFrameworkPackageName>
<NETStandardLibraryNETFrameworkNuPkgPath>$(NuGetPackagesDir)/$(NETStandardLibraryNETFrameworkPackageName.ToLower())/$(CLI_NETStandardLibraryNETFrameworkVersion.ToLower())</NETStandardLibraryNETFrameworkNuPkgPath>
</PropertyGroup>
</Target>
<Target Name="RestoreMSBuildExtensionsPackages"
DependsOnTargets="PrepareMSBuildExtensionsProps">
<ItemGroup>
<ExtensionPackageToRestore Include="$(MSBuildExtensionsPackageName)" Version="$(CLI_MSBuildExtensions_Version)"/>
<ExtensionPackageToRestore Include="$(NETStandardLibraryNETFrameworkPackageName)" Version="$(CLI_NETStandardLibraryNETFrameworkVersion)"/>
<ExtensionRestore Include="$(RepoRoot)/build/RestoreDependency.proj">
<Properties>
CLIBuildDll=$(CLIBuildDll);
NuGetPackagesDir=$(NuGetPackagesDir);
DependencyPackageName=%(ExtensionPackageToRestore.Identity);
DependencyPackageVersion=%(ExtensionPackageToRestore.Version);
Stage0Directory=$(Stage0Directory)
</Properties>
</ExtensionRestore>
</ItemGroup>
<MSBuild
BuildInParallel="False"
Projects="@(ExtensionRestore)">
</MSBuild>
</Target>
<Target Name="GenerateBundledVersionsProps">
<PropertyGroup>
<BundledVersionsPropsFileName>Microsoft.NETCoreSdk.BundledVersions.props</BundledVersionsPropsFileName>

View file

@ -0,0 +1,46 @@
<Project ToolsVersion="15.0" DefaultTargets="EnsureDependencyRestored;CopySdkToOutput">
<!-- workaround for https://github.com/Microsoft/msbuild/issues/885 -->
<!-- renaming the property because the original property is a global property and therefore
cannot be redefined at runtime. -->
<PropertyGroup>
<CLIBuildDllPath>$([MSBuild]::Unescape($(CLIBuildDll)))</CLIBuildDllPath>
</PropertyGroup>
<UsingTask TaskName="DotNetRestore" AssemblyFile="$(CLIBuildDllPath)" />
<Target Name="CopySdkToOutput"
DependsOnTargets="PrepareBundledDependencyProps;
EnsureDependencyRestored;
GetSdkItemsToCopy"
Condition="'$(SdkLayoutDirectory)' != ''"
Inputs="@(SdkContent)"
Outputs="@(SdkContent->'$(SdkLayoutDirectory)/%(RecursiveDir)%(FileName)%(Extension)')">
<Copy SourceFiles="@(SdkContent)"
DestinationFiles="@(SdkContent->'$(SdkLayoutDirectory)/%(RecursiveDir)%(FileName)%(Extension)')" />
<Message Text="Copied Sdk $(DependencyPackageName) from $(DependencyNuPkgPath) to $(SdkLayoutDirectory)."
Importance="High" />
</Target>
<Target Name="GetSdkItemsToCopy">
<ItemGroup>
<SdkContent Include="$(DependencyNuPkgPath)/**/*"
Exclude="$(DependencyNuPkgPath)/$(DependencyPackageName).nuspec;
$(DependencyNuPkgPath)/$(DependencyPackageName).$(DependencyPackageVersion).nupkg;
$(DependencyNuPkgPath)/$(DependencyPackageName).$(DependencyPackageVersion).nupkg.sha512" />
</ItemGroup>
</Target>
<Target Name="EnsureDependencyRestored"
Condition="!Exists('$(DependencyNuPkgPath)/$(DependencyPackageName.ToLower()).nuspec')">
<DotNetRestore ToolPath="$(Stage0Directory)"
ProjectPath="$(MSBuildThisFileDirectory)/sdks/sdks.csproj"
AdditionalParameters="/p:DependencyPackageName=$(DependencyPackageName) /p:DependencyPackageVersion=$(DependencyPackageVersion)" />
</Target>
<Target Name="PrepareBundledDependencyProps">
<PropertyGroup>
<DependencyNuPkgPath>$(NuGetPackagesDir)/$(DependencyPackageName.ToLower())/$(DependencyPackageVersion.ToLower())</DependencyNuPkgPath>
</PropertyGroup>
</Target>
</Project>

View file

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

View file

@ -52,8 +52,7 @@
<!-- Output Directories -->
<PropertyGroup>
<InstallerOutputDirectory>$(PackagesDirectory)</InstallerOutputDirectory>
<SdkInstallerFile>$(InstallerOutputDirectory)/$(ArtifactNameWithVersionCombinedHostHostFxrFrameworkSdk)$(InstallerExtension)</SdkInstallerFile>
<SdkInstallerFile>$(InstallerOutputDirectory)/$(DistroSpecificArtifactNameWithVersionCombinedHostHostFxrFrameworkSdk)$(InstallerExtension)</SdkInstallerFile>
<SdkDebianIntermediateDirectory>$(IntermediateDirectory)/debian/sdk</SdkDebianIntermediateDirectory>
<DotNetDebToolOutputDirectory>$(SdkDebianIntermediateDirectory)/deb-tool-output</DotNetDebToolOutputDirectory>
<DebianTestResultsXmlFile>$(SdkDebianIntermediateDirectory)/debian-testResults.xml</DebianTestResultsXmlFile>

View file

@ -5,7 +5,7 @@
</PropertyGroup>
<PropertyGroup>
<SdkDebianUploadUrl>$(DotnetBlobRootUrl)/$(Product)/$(FullNugetVersion)/$(ArtifactNameWithVersionCombinedHostHostFxrFrameworkSdk)$(InstallerExtension)</SdkDebianUploadUrl>
<SdkDebianUploadUrl>$(DotnetBlobRootUrl)/$(Product)/$(FullNugetVersion)/$(DistroSpecificArtifactNameWithVersionCombinedHostHostFxrFrameworkSdk)$(InstallerExtension)</SdkDebianUploadUrl>
<DebianUploadJsonFile>$(SdkDebianIntermediateDirectory)/package_upload.json</DebianUploadJsonFile>
<DebianRevisionNumber>1</DebianRevisionNumber>
@ -19,7 +19,7 @@
</DebianUploadJsonContent>
</PropertyGroup>
<Target Name="PublishDebFilesToDebianRepo" Condition=" ('$(OSName)' == 'ubuntu' OR '$(OSName)' == 'debian') AND '$(SkipPublishToDebianRepo)' != 'true' ">
<Target Name="PublishDebFilesToDebianRepo" Condition=" ('$(HostOSName)' == 'ubuntu' OR '$(HostOSName)' == 'debian') 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

@ -8,7 +8,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="$(SdkPackageName)" Version="$(SdkPackageVersion)" />
<PackageReference Include="$(DependencyPackageName)" Version="$(DependencyPackageVersion)" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

View file

@ -3,6 +3,7 @@
using System;
using System.IO;
using System.Text.RegularExpressions;
using Microsoft.Build.Utilities;
using Microsoft.Build.Framework;
@ -84,7 +85,8 @@ namespace Microsoft.DotNet.Cli.Build
var replacementPattern = ReplacementPatterns[i].ItemSpec;
var replacementString = ReplacementStrings[i].ItemSpec;
outText = outText.Replace(replacementPattern, replacementString);
var regex = new Regex(replacementPattern);
outText = regex.Replace(outText, replacementString);
}
return outText;

View file

@ -80,8 +80,8 @@ $env:VSTEST_TRACE_BUILD=1
# install a stage0
$dotnetInstallPath = Join-Path $RepoRoot "scripts\obtain\dotnet-install.ps1"
Write-Output "$dotnetInstallPath -Channel ""release/2.0.0"" -InstallDir $env:DOTNET_INSTALL_DIR -Architecture ""$Architecture"" -Version 2.0.0-preview2-006349"
Invoke-Expression "$dotnetInstallPath -Channel ""release/2.0.0"" -InstallDir $env:DOTNET_INSTALL_DIR -Architecture ""$Architecture"" -Version 2.0.0-preview2-006349"
Write-Output "$dotnetInstallPath -Channel ""release/2.0.0"" -InstallDir $env:DOTNET_INSTALL_DIR -Architecture ""$Architecture"""
Invoke-Expression "$dotnetInstallPath -Channel ""release/2.0.0"" -InstallDir $env:DOTNET_INSTALL_DIR -Architecture ""$Architecture"""
if ($LastExitCode -ne 0)
{
Write-Output "The .NET CLI installation failed with exit code $LastExitCode"

View file

@ -155,7 +155,7 @@ export VSTEST_TRACE_BUILD=1
DOTNET_MULTILEVEL_LOOKUP=0
# Install a stage 0
(set -x ; "$REPOROOT/scripts/obtain/dotnet-install.sh" --channel "release/2.0.0" --version "2.0.0-preview2-006349" --install-dir "$DOTNET_INSTALL_DIR" --architecture "$ARCHITECTURE" $LINUX_PORTABLE_INSTALL_ARGS)
(set -x ; "$REPOROOT/scripts/obtain/dotnet-install.sh" --channel "release/2.0.0" --install-dir "$DOTNET_INSTALL_DIR" --architecture "$ARCHITECTURE" $LINUX_PORTABLE_INSTALL_ARGS)
EXIT_CODE=$?
if [ $EXIT_CODE != 0 ]; then

View file

@ -253,7 +253,7 @@ function Get-Download-Link([string]$AzureFeed, [string]$Channel, [string]$Specif
$PayloadURL = "$AzureFeed/Runtime/$SpecificVersion/dotnet-runtime-$SpecificVersion-win-$CLIArchitecture.zip"
}
else {
$PayloadURL = "$AzureFeed/Sdk/$SpecificVersion/dotnet-dev-$SpecificVersion-win-$CLIArchitecture.zip"
$PayloadURL = "$AzureFeed/Sdk/$SpecificVersion/dotnet-sdk-$SpecificVersion-win-$CLIArchitecture.zip"
}
Say-Verbose "Constructed primary payload URL: $PayloadURL"

View file

@ -400,7 +400,7 @@ construct_download_link() {
if [ "$shared_runtime" = true ]; then
download_link="$azure_feed/Runtime/$specific_version/dotnet-runtime-$specific_version-$osname-$normalized_architecture.tar.gz"
else
download_link="$azure_feed/Sdk/$specific_version/dotnet-dev-$specific_version-$osname-$normalized_architecture.tar.gz"
download_link="$azure_feed/Sdk/$specific_version/dotnet-sdk-$specific_version-$osname-$normalized_architecture.tar.gz"
fi
echo "$download_link"

View file

@ -520,4 +520,7 @@
<data name="ShowHelpDescription" xml:space="preserve">
<value>Show help information.</value>
</data>
<data name="NoRestoreDescription" xml:space="preserve">
<value>Does not do an implicit restore when executing the command.</value>
</data>
</root>

View file

@ -65,5 +65,11 @@ namespace Microsoft.DotNet.Cli
public static ArgumentsRule DefaultToCurrentDirectory(this ArgumentsRule rule) =>
rule.With(defaultValue: () => PathUtility.EnsureTrailingSlash(Directory.GetCurrentDirectory()));
public static Option NoRestoreOption() =>
Create.Option(
"--no-restore",
CommonLocalizableStrings.NoRestoreDescription,
Accept.NoArguments());
}
}

View file

@ -0,0 +1,39 @@
// 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.Collections.Generic;
using System.Linq;
using Microsoft.DotNet.Cli;
using Microsoft.DotNet.Cli.CommandLine;
using Microsoft.DotNet.Tools.MSBuild;
using Microsoft.DotNet.Tools.Restore;
namespace Microsoft.DotNet.Tools
{
public static class CreateWithRestoreOptions
{
public static Command Command(
string name,
string help,
ArgumentsRule arguments,
params Option[] options)
{
return Create.Command(name, help, arguments, RestoreCommandParser.AddImplicitRestoreOptions(options));
}
public static Command Command(
string name,
string help,
ArgumentsRule arguments,
bool treatUnmatchedTokensAsErrors,
params Option[] options)
{
return Create.Command(
name,
help,
arguments,
treatUnmatchedTokensAsErrors,
RestoreCommandParser.AddImplicitRestoreOptions(options));
}
}
}

View file

@ -0,0 +1,56 @@
// 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.Collections.Generic;
using System.Linq;
using Microsoft.DotNet.Tools.MSBuild;
using Microsoft.DotNet.Tools.Restore;
namespace Microsoft.DotNet.Tools
{
public class RestoringCommand : MSBuildForwardingApp
{
private bool NoRestore { get; }
private IEnumerable<string> ArgsToForward { get; }
private IEnumerable<string> ArgsToForwardToRestore()
{
var restoreArguments = ArgsToForward.Where(a =>
!a.StartsWith("/t:") &&
!a.StartsWith("/target:") &&
!a.StartsWith("/ConsoleLoggerParameters:") &&
!a.StartsWith("/clp:"));
if (!restoreArguments.Any(a => a.StartsWith("/v:") || a.StartsWith("/verbosity:")))
{
restoreArguments = restoreArguments.Concat(new string[] { "/v:q" });
}
return restoreArguments;
}
private bool ShouldRunImplicitRestore => !NoRestore;
public RestoringCommand(IEnumerable<string> msbuildArgs, bool noRestore, string msbuildPath = null)
: base(msbuildArgs, msbuildPath)
{
NoRestore = noRestore;
ArgsToForward = msbuildArgs;
}
public override int Execute()
{
if (ShouldRunImplicitRestore)
{
int exitCode = RestoreCommand.Run(ArgsToForwardToRestore().ToArray());
if (exitCode != 0)
{
return exitCode;
}
}
return base.Execute();
}
}
}

View file

@ -2,18 +2,21 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Collections.Generic;
using System.Linq;
using Microsoft.DotNet.Cli.CommandLine;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.Tools.MSBuild;
using Microsoft.DotNet.Tools;
using Microsoft.DotNet.Cli;
using Microsoft.DotNet.Tools.Restore;
using Parser = Microsoft.DotNet.Cli.Parser;
namespace Microsoft.DotNet.Tools.Build
{
public class BuildCommand : MSBuildForwardingApp
public class BuildCommand : RestoringCommand
{
public BuildCommand(IEnumerable<string> msbuildArgs, string msbuildPath = null)
: base(msbuildArgs, msbuildPath)
public BuildCommand(IEnumerable<string> msbuildArgs, bool noRestore, string msbuildPath = null)
: base(msbuildArgs, noRestore, msbuildPath)
{
}
@ -44,7 +47,9 @@ namespace Microsoft.DotNet.Tools.Build
msbuildArgs.Add($"/clp:Summary");
return new BuildCommand(msbuildArgs, msbuildPath);
bool noRestore = appliedBuildOptions.HasOption("--no-restore");
return new BuildCommand(msbuildArgs, noRestore, msbuildPath);
}
public static int Run(string[] args)

View file

@ -1,6 +1,7 @@
// 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.Collections.Generic;
using System.Linq;
using Microsoft.DotNet.Cli.CommandLine;
using Microsoft.DotNet.Tools;
@ -11,7 +12,7 @@ namespace Microsoft.DotNet.Cli
internal static class BuildCommandParser
{
public static Command Build() =>
Create.Command(
CreateWithRestoreOptions.Command(
"build",
LocalizableStrings.AppFullName,
Accept.ZeroOrMoreArguments()
@ -37,6 +38,7 @@ namespace Microsoft.DotNet.Cli
LocalizableStrings.NoDependenciesOptionDescription,
Accept.NoArguments()
.ForwardAs("/p:BuildProjectReferences=false")),
CommonOptions.NoRestoreOption(),
CommonOptions.VerbosityOption());
}
}

View file

@ -58,7 +58,7 @@ namespace Microsoft.DotNet.Tools.MSBuild
return ret;
}
public int Execute()
public virtual int Execute()
{
return GetProcessStartInfo().Execute();
}

View file

@ -5,16 +5,17 @@ using System.Collections.Generic;
using Microsoft.DotNet.Cli.CommandLine;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.Tools.MSBuild;
using Microsoft.DotNet.Tools;
using Microsoft.DotNet.Cli;
using System.Diagnostics;
using Parser = Microsoft.DotNet.Cli.Parser;
namespace Microsoft.DotNet.Tools.Pack
{
public class PackCommand : MSBuildForwardingApp
public class PackCommand : RestoringCommand
{
public PackCommand(IEnumerable<string> msbuildArgs, string msbuildPath = null)
: base(msbuildArgs, msbuildPath)
public PackCommand(IEnumerable<string> msbuildArgs, bool noRestore, string msbuildPath = null)
: base(msbuildArgs, noRestore, msbuildPath)
{
}
@ -30,14 +31,16 @@ namespace Microsoft.DotNet.Tools.Pack
var msbuildArgs = new List<string>()
{
"/t:pack"
"/t:pack"
};
msbuildArgs.AddRange(parsedPack.OptionValuesToBeForwarded());
msbuildArgs.AddRange(parsedPack.Arguments);
return new PackCommand(msbuildArgs, msbuildPath);
bool noRestore = parsedPack.HasOption("--no-restore");
return new PackCommand(msbuildArgs, noRestore, msbuildPath);
}
public static int Run(string[] args)

View file

@ -1,8 +1,10 @@
// 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.Collections.Generic;
using System.Linq;
using Microsoft.DotNet.Cli.CommandLine;
using Microsoft.DotNet.Tools;
using LocalizableStrings = Microsoft.DotNet.Tools.Pack.LocalizableStrings;
namespace Microsoft.DotNet.Cli
@ -10,7 +12,7 @@ namespace Microsoft.DotNet.Cli
internal static class PackCommandParser
{
public static Command Pack() =>
Create.Command(
CreateWithRestoreOptions.Command(
"pack",
LocalizableStrings.AppFullName,
Accept.ZeroOrMoreArguments(),
@ -39,6 +41,7 @@ namespace Microsoft.DotNet.Cli
"-s|--serviceable",
LocalizableStrings.CmdServiceableDescription,
Accept.NoArguments().ForwardAs("/p:Serviceable=true")),
CommonOptions.NoRestoreOption(),
CommonOptions.VerbosityOption());
}
}

View file

@ -5,15 +5,16 @@ using System.Collections.Generic;
using Microsoft.DotNet.Cli;
using Microsoft.DotNet.Cli.CommandLine;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.Tools;
using Microsoft.DotNet.Tools.MSBuild;
using Parser = Microsoft.DotNet.Cli.Parser;
namespace Microsoft.DotNet.Tools.Publish
{
public class PublishCommand : MSBuildForwardingApp
public class PublishCommand : RestoringCommand
{
private PublishCommand(IEnumerable<string> msbuildArgs, string msbuildPath = null)
: base(msbuildArgs, msbuildPath)
private PublishCommand(IEnumerable<string> msbuildArgs, bool noRestore, string msbuildPath = null)
: base(msbuildArgs, noRestore, msbuildPath)
{
}
@ -37,7 +38,9 @@ namespace Microsoft.DotNet.Tools.Publish
msbuildArgs.AddRange(appliedPublishOption.Arguments);
return new PublishCommand(msbuildArgs, msbuildPath);
bool noRestore = appliedPublishOption.HasOption("--no-restore");
return new PublishCommand(msbuildArgs, noRestore, msbuildPath);
}
public static int Run(string[] args)

View file

@ -1,8 +1,10 @@
// 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.Collections.Generic;
using System.Linq;
using Microsoft.DotNet.Cli.CommandLine;
using Microsoft.DotNet.Tools;
using LocalizableStrings = Microsoft.DotNet.Tools.Publish.LocalizableStrings;
namespace Microsoft.DotNet.Cli
@ -10,7 +12,7 @@ namespace Microsoft.DotNet.Cli
internal static class PublishCommandParser
{
public static Command Publish() =>
Create.Command(
CreateWithRestoreOptions.Command(
"publish",
LocalizableStrings.AppDescription,
Accept.ZeroOrMoreArguments(),
@ -41,6 +43,7 @@ namespace Microsoft.DotNet.Cli
string value = o.Arguments.Any() ? o.Arguments.Single() : "true";
return $"/p:SelfContained={value}";
})),
CommonOptions.NoRestoreOption(),
CommonOptions.VerbosityOption());
}
}

View file

@ -37,7 +37,7 @@ namespace Microsoft.DotNet.Tools.Restore
"/t:Restore"
};
if (!parsedRestore.HasOption("verbosity"))
if (!HasVerbosityOption(parsedRestore))
{
msbuildArgs.Add("/ConsoleLoggerParameters:Verbosity=Minimal");
}
@ -45,7 +45,7 @@ namespace Microsoft.DotNet.Tools.Restore
msbuildArgs.AddRange(parsedRestore.OptionValuesToBeForwarded());
msbuildArgs.AddRange(parsedRestore.Arguments);
return new RestoreCommand(msbuildArgs, msbuildPath);
}
@ -65,5 +65,12 @@ namespace Microsoft.DotNet.Tools.Restore
return cmd.Execute();
}
private static bool HasVerbosityOption(AppliedOption parsedRestore)
{
return parsedRestore.HasOption("verbosity") ||
parsedRestore.Arguments.Any(a => a.Contains("/v:")) ||
parsedRestore.Arguments.Any(a => a.Contains("/verbosity:"));
}
}
}

View file

@ -1,6 +1,7 @@
// 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.Collections.Generic;
using System.Linq;
using Microsoft.DotNet.Cli.CommandLine;
using LocalizableStrings = Microsoft.DotNet.Tools.Restore.LocalizableStrings;
@ -14,15 +15,41 @@ namespace Microsoft.DotNet.Cli
"restore",
LocalizableStrings.AppFullName,
Accept.ZeroOrMoreArguments(),
CommonOptions.HelpOption(),
FullRestoreOptions());
private static Option[] FullRestoreOptions()
{
var fullRestoreOptions = AddImplicitRestoreOptions(new Option[] { CommonOptions.HelpOption() }, true, true);
return fullRestoreOptions.Concat(new Option[] { CommonOptions.VerbosityOption() }).ToArray();
}
public static Option[] AddImplicitRestoreOptions(
IEnumerable<Option> commandOptions)
{
return AddImplicitRestoreOptions(commandOptions, false, false).ToArray();
}
private static IEnumerable<Option> AddImplicitRestoreOptions(
IEnumerable<Option> commandOptions,
bool showHelp,
bool useShortOptions)
{
return commandOptions.Concat(ImplicitRestoreOptions(showHelp, useShortOptions)
.Where(o => !commandOptions.Any(c => c.Name == o.Name)));
}
private static Option[] ImplicitRestoreOptions(bool showHelp = false, bool useShortOptions = false)
{
return new Option[] {
Create.Option(
"-s|--source",
LocalizableStrings.CmdSourceOptionDescription,
useShortOptions ? "-s|--source" : "--source",
showHelp ? LocalizableStrings.CmdSourceOptionDescription : string.Empty,
Accept.OneOrMoreArguments()
.With(name: LocalizableStrings.CmdSourceOption)
.ForwardAsSingle(o => $"/p:RestoreSources={string.Join("%3B", o.Arguments)}")),
Create.Option(
"-r|--runtime",
useShortOptions ? "-r|--runtime" : "--runtime" ,
LocalizableStrings.CmdRuntimeOptionDescription,
Accept.OneOrMoreArguments()
.WithSuggestionsFrom(_ => Suggest.RunTimesFromProjectFile())
@ -30,29 +57,29 @@ namespace Microsoft.DotNet.Cli
.ForwardAsSingle(o => $"/p:RuntimeIdentifiers={string.Join("%3B", o.Arguments)}")),
Create.Option(
"--packages",
LocalizableStrings.CmdPackagesOptionDescription,
showHelp ? LocalizableStrings.CmdPackagesOptionDescription : string.Empty,
Accept.ExactlyOneArgument()
.With(name: LocalizableStrings.CmdPackagesOption)
.ForwardAsSingle(o => $"/p:RestorePackagesPath={o.Arguments.Single()}")),
Create.Option(
"--disable-parallel",
LocalizableStrings.CmdDisableParallelOptionDescription,
showHelp ? LocalizableStrings.CmdDisableParallelOptionDescription : string.Empty,
Accept.NoArguments()
.ForwardAs("/p:RestoreDisableParallel=true")),
Create.Option(
"--configfile",
LocalizableStrings.CmdConfigFileOptionDescription,
showHelp ? LocalizableStrings.CmdConfigFileOptionDescription : string.Empty,
Accept.ExactlyOneArgument()
.With(name: LocalizableStrings.CmdConfigFileOption)
.ForwardAsSingle(o => $"/p:RestoreConfigFile={o.Arguments.Single()}")),
Create.Option(
"--no-cache",
LocalizableStrings.CmdNoCacheOptionDescription,
showHelp ? LocalizableStrings.CmdNoCacheOptionDescription : string.Empty,
Accept.NoArguments()
.ForwardAs("/p:RestoreNoCache=true")),
Create.Option(
"--ignore-failed-sources",
LocalizableStrings.CmdIgnoreFailedSourcesOptionDescription,
showHelp ? LocalizableStrings.CmdIgnoreFailedSourcesOptionDescription : string.Empty,
Accept.NoArguments()
.ForwardAs("/p:RestoreIgnoreFailedSources=true")),
Create.Option(
@ -61,10 +88,11 @@ namespace Microsoft.DotNet.Cli
Accept.NoArguments()
.ForwardAs("/p:RestoreRecursive=false")),
Create.Option(
"-f|--force",
useShortOptions ? "-f|--force" : "--force",
LocalizableStrings.CmdForceRestoreOptionDescription,
Accept.NoArguments()
.ForwardAs("/p:RestoreForce=true")),
CommonOptions.VerbosityOption());
.ForwardAs("/p:RestoreForce=true"))
};
}
}
}

View file

@ -7,6 +7,7 @@ using System.IO;
using System.Linq;
using Microsoft.Build.Evaluation;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.Tools;
using Microsoft.DotNet.Tools.MSBuild;
using Microsoft.DotNet.Tools.Run.LaunchSettings;
@ -19,6 +20,8 @@ namespace Microsoft.DotNet.Tools.Run
public bool NoBuild { get; private set; }
public string Project { get; private set; }
public IReadOnlyCollection<string> Args { get; private set; }
public bool NoRestore { get; private set; }
public IEnumerable<string> RestoreArgs { get; private set; }
private List<string> _args;
private bool ShouldBuild => !NoBuild;
@ -55,6 +58,8 @@ namespace Microsoft.DotNet.Tools.Run
string project,
string launchProfile,
bool noLaunchProfile,
bool noRestore,
IEnumerable<string> restoreArgs,
IReadOnlyCollection<string> args)
{
Configuration = configuration;
@ -64,6 +69,8 @@ namespace Microsoft.DotNet.Tools.Run
LaunchProfile = launchProfile;
NoLaunchProfile = noLaunchProfile;
Args = args;
RestoreArgs = restoreArgs;
NoRestore = noRestore;
}
public RunCommand MakeNewWithReplaced(string configuration = null,
@ -72,6 +79,8 @@ namespace Microsoft.DotNet.Tools.Run
string project = null,
string launchProfile = null,
bool? noLaunchProfile = null,
bool? noRestore = null,
IEnumerable<string> restoreArgs = null,
IReadOnlyCollection<string> args = null)
{
return new RunCommand(
@ -81,6 +90,8 @@ namespace Microsoft.DotNet.Tools.Run
project ?? this.Project,
launchProfile ?? this.LaunchProfile,
noLaunchProfile ?? this.NoLaunchProfile,
noRestore ?? this.NoRestore,
restoreArgs ?? this.RestoreArgs,
args ?? this.Args
);
}
@ -132,18 +143,9 @@ namespace Microsoft.DotNet.Tools.Run
buildArgs.Add("/nologo");
buildArgs.Add("/verbosity:quiet");
if (!string.IsNullOrWhiteSpace(Configuration))
{
buildArgs.Add($"/p:Configuration={Configuration}");
}
if (!string.IsNullOrWhiteSpace(Framework))
{
buildArgs.Add($"/p:TargetFramework={Framework}");
}
var buildResult = new MSBuildForwardingApp(buildArgs).Execute();
buildArgs.AddRange(RestoreArgs);
var buildResult = new RestoringCommand(buildArgs, NoRestore).Execute();
if (buildResult != 0)
{
Reporter.Error.WriteLine();

View file

@ -1,7 +1,10 @@
// 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.Collections.Generic;
using System.Linq;
using Microsoft.DotNet.Cli.CommandLine;
using Microsoft.DotNet.Tools;
using Microsoft.DotNet.Tools.Run;
using LocalizableStrings = Microsoft.DotNet.Tools.Run.LocalizableStrings;
@ -10,7 +13,7 @@ namespace Microsoft.DotNet.Cli
internal static class RunCommandParser
{
public static Command Run() =>
Create.Command(
CreateWithRestoreOptions.Command(
"run",
LocalizableStrings.AppFullName,
treatUnmatchedTokensAsErrors: false,
@ -23,6 +26,8 @@ namespace Microsoft.DotNet.Cli
project: o.SingleArgumentOrDefault("--project"),
launchProfile: o.SingleArgumentOrDefault("--launch-profile"),
noLaunchProfile: o.HasOption("--no-launch-profile"),
noRestore: o.HasOption("--no-restore"),
restoreArgs: o.OptionValuesToBeForwarded(),
args: o.Arguments
)),
options: new[]
@ -45,7 +50,8 @@ namespace Microsoft.DotNet.Cli
Create.Option(
"--no-build",
LocalizableStrings.CommandOptionNoBuildDescription,
Accept.NoArguments())
Accept.NoArguments()),
CommonOptions.NoRestoreOption()
});
}
}

View file

@ -14,10 +14,10 @@ using Parser = Microsoft.DotNet.Cli.Parser;
namespace Microsoft.DotNet.Tools.Test
{
public class TestCommand : MSBuildForwardingApp
public class TestCommand : RestoringCommand
{
public TestCommand(IEnumerable<string> msbuildArgs, string msbuildPath = null)
: base(msbuildArgs, msbuildPath)
public TestCommand(IEnumerable<string> msbuildArgs, bool noRestore, string msbuildPath = null)
: base(msbuildArgs, noRestore, msbuildPath)
{
}
@ -65,7 +65,9 @@ namespace Microsoft.DotNet.Tools.Test
}
}
return new TestCommand(msbuildArgs, msbuildPath);
bool noRestore = parsedTest.HasOption("--no-restore");
return new TestCommand(msbuildArgs, noRestore, msbuildPath);
}
public static int Run(string[] args)

View file

@ -1,6 +1,10 @@
// 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.Collections.Generic;
using System.Linq;
using Microsoft.DotNet.Cli.CommandLine;
using Microsoft.DotNet.Tools;
using LocalizableStrings = Microsoft.DotNet.Tools.Test.LocalizableStrings;
namespace Microsoft.DotNet.Cli
@ -44,10 +48,10 @@ namespace Microsoft.DotNet.Cli
LocalizableStrings.CmdLoggerDescription,
Accept.ExactlyOneArgument()
.With(name: LocalizableStrings.CmdLoggerOption)
.ForwardAsSingle(o =>
.ForwardAsSingle(o =>
{
var loggersString = string.Join(";", GetSemiColonEscapedArgs(o.Arguments));
var loggersString = string.Join(";", GetSemiColonEscapedArgs(o.Arguments));
return $"/p:VSTestLogger={loggersString}";
})),
CommonOptions.ConfigurationOption(),
@ -81,6 +85,7 @@ namespace Microsoft.DotNet.Cli
Accept.OneOrMoreArguments()
.With(name: LocalizableStrings.cmdCollectFriendlyName)
.ForwardAsSingle(o => $"/p:VSTestCollect=\"{string.Join(";", o.Arguments)}\"")),
CommonOptions.NoRestoreOption(),
CommonOptions.VerbosityOption());
private static string GetSemiColonEsacpedstring(string arg)

View file

@ -112,9 +112,14 @@
DependsOnTargets="GenerateMSBuildExtensions"
AfterTargets="Publish"
BeforeTargets="GenerateCliRuntimeConfigurationFiles">
<ItemGroup>
<MSBuildExtensionsContent Update="@(MSBuildExtensionsContent)">
<DestinationPath Condition="'%(MSBuildExtensionsContent.DestinationPath)' == ''">$(PublishDir)/%(MSBuildExtensionsContent.DeploymentSubpath)%(RecursiveDir)%(Filename)%(Extension)</DestinationPath>
</MSBuildExtensionsContent>
</ItemGroup>
<Copy SourceFiles="@(MSBuildExtensionsContent)"
DestinationFolder="$(PublishDir)/%(RecursiveDir)" />
DestinationFiles="%(MSBuildExtensionsContent.DestinationPath)" />
<PropertyGroup>
<MSBuildTargetsDirectory>$(PublishDir)/runtimes/any/native</MSBuildTargetsDirectory>
@ -140,13 +145,13 @@
<Target Name="PublishSdks"
AfterTargets="Publish">
<ItemGroup>
<SdksToBundle Include="$(RepoRoot)/build/BundledSdks.proj">
<SdksToBundle Include="$(RepoRoot)/build/RestoreDependency.proj">
<Properties>
CLIBuildDll=$(CLIBuildDll);
NuGetPackagesDir=$(NuGetPackagesDir);
SdkLayoutDirectory=$(SdkOutputDirectory)/Sdks/%(BundledSdk.Identity);
SdkPackageName=%(BundledSdk.Identity);
SdkPackageVersion=%(BundledSdk.Version);
DependencyPackageName=%(BundledSdk.Identity);
DependencyPackageVersion=%(BundledSdk.Version);
Stage0Directory=$(Stage0Directory)
</Properties>
</SdksToBundle>
@ -189,6 +194,12 @@
<ItemGroup>
<!-- Removing Full CLR built TestHost assemblies from getting Crossgen as it is throwing error -->
<SdkFiles Include="$(PublishDir)/**/*" Exclude="$(PublishDir)/TestHost*/**/*;$(PublishDir)/Sdks/**/*" />
<!-- Don't try to CrossGen .NET Framework support assemblies for .NET Standard -->
<SdkFiles Remove="$(PublishDir)/Microsoft.NET.Build.Extensions\net*\**\*" />
<!-- Don't try to CrossGen tasks and supporting DLLs compiled for .NET Framework -->
<SdkFiles Remove="$(PublishDir)/Microsoft.NET.Build.Extensions\tools\net*\**\*" />
</ItemGroup>
<AddMetadataIsPE Items="@(SdkFiles)">
@ -264,4 +275,18 @@
<Copy SourceFiles="@(Stage2Cli)"
DestinationFiles="@(Stage2Cli->'$(Stage2WithBackwardsCompatibleRuntimesOutputDirectory)/%(RecursiveDir)%(Filename)%(Extension)')" />
</Target>
<Target Name="RetargetVSTestConsole"
AfterTargets="Publish">
<PropertyGroup>
<VSTestRuntimeConfigPath>$(PublishDir)/vstest.console.runtimeconfig.json</VSTestRuntimeConfigPath>
<ReplacementPattern>"version": ".*"</ReplacementPattern>
<ReplacementString>"version": "$(CLI_SharedFrameworkVersion)"</ReplacementString>
</PropertyGroup>
<ReplaceFileContents
InputFile="$(VSTestRuntimeConfigPath)"
DestinationFile="$(VSTestRuntimeConfigPath)"
ReplacementPatterns="$(ReplacementPattern)"
ReplacementStrings="$(ReplacementString)" />
</Target>
</Project>

View file

@ -0,0 +1,40 @@
using FluentAssertions;
using Microsoft.DotNet.TestFramework;
using Microsoft.DotNet.Tools.Test.Utilities;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace EndToEnd
{
public class GivenNetFrameworkSupportsNetStandard2 : TestBase
{
[WindowsOnlyFact]
public void ANET461ProjectCanReferenceANETStandardProject()
{
var _testInstance = TestAssets.Get(TestAssetKinds.DesktopTestProjects, "NETFrameworkReferenceNETStandard20")
.CreateInstance()
.WithSourceFiles();
string projectDirectory = Path.Combine(_testInstance.Root.FullName, "TestApp");
new RestoreCommand()
.WithWorkingDirectory(projectDirectory)
.Execute()
.Should().Pass();
new BuildCommand()
.WithWorkingDirectory(projectDirectory)
.Execute()
.Should().Pass();
new RunCommand()
.WithWorkingDirectory(projectDirectory)
.ExecuteWithCapturedOutput()
.Should().Pass()
.And.HaveStdOutContaining("This string came from the test library!");
}
}
}

View file

@ -38,6 +38,35 @@ namespace Microsoft.DotNet.Cli.Build.Tests
.And.HaveStdOutContaining("Hello World");
}
[Fact]
public void ItImplicitlyRestoresAProjectWhenBuilding()
{
var testAppName = "MSBuildTestApp";
var testInstance = TestAssets.Get(testAppName)
.CreateInstance(testAppName)
.WithSourceFiles();
new BuildCommand()
.WithWorkingDirectory(testInstance.Root)
.Execute()
.Should().Pass();
}
[Fact]
public void ItDoesNotImplicitlyRestoreAProjectWhenBuildingWithTheNoRestoreOption()
{
var testAppName = "MSBuildTestApp";
var testInstance = TestAssets.Get(testAppName)
.CreateInstance(testAppName)
.WithSourceFiles();
new BuildCommand()
.WithWorkingDirectory(testInstance.Root)
.ExecuteWithCapturedOutput("--no-restore")
.Should().Fail()
.And.HaveStdOutContaining("project.assets.json' not found.");;
}
[Fact]
public void ItRunsWhenRestoringToSpecificPackageDir()
{
@ -62,7 +91,7 @@ namespace Microsoft.DotNet.Cli.Build.Tests
new BuildCommand()
.WithWorkingDirectory(rootPath)
.Execute()
.Execute("--no-restore")
.Should().Pass();
var configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug";

View file

@ -158,7 +158,7 @@ namespace Microsoft.DotNet.Tools.Pack.Tests
}
[Fact]
public void PackWorksWithLocalProjectJson()
public void PackWorksWithLocalProject()
{
var testInstance = TestAssets.Get("TestAppSimple")
.CreateInstance()
@ -171,6 +171,33 @@ namespace Microsoft.DotNet.Tools.Pack.Tests
.Should().Pass();
}
[Fact]
public void ItImplicitlyRestoresAProjectWhenPackaging()
{
var testInstance = TestAssets.Get("TestAppSimple")
.CreateInstance()
.WithSourceFiles();
new PackCommand()
.WithWorkingDirectory(testInstance.Root)
.Execute()
.Should().Pass();
}
[Fact]
public void ItDoesNotImplicitlyRestoreAProjectWhenPackagingWithTheNoRestoreOption()
{
var testInstance = TestAssets.Get("TestAppSimple")
.CreateInstance()
.WithSourceFiles();
new PackCommand()
.WithWorkingDirectory(testInstance.Root)
.ExecuteWithCapturedOutput("--no-restore")
.Should().Fail()
.And.HaveStdOutContaining("project.assets.json' not found.");;
}
[Fact]
public void HasServiceableFlagWhenArgumentPassed()
{
@ -231,7 +258,7 @@ namespace Microsoft.DotNet.Tools.Pack.Tests
new PackCommand()
.WithWorkingDirectory(rootPath)
.ExecuteWithCapturedOutput()
.ExecuteWithCapturedOutput("--no-restore")
.Should()
.Pass();

View file

@ -44,6 +44,39 @@ namespace Microsoft.DotNet.Cli.Publish.Tests
.And.HaveStdOutContaining("Hello World");
}
[Fact]
public void ItImplicitlyRestoresAProjectWhenPublishing()
{
var testAppName = "MSBuildTestApp";
var testInstance = TestAssets.Get(testAppName)
.CreateInstance()
.WithSourceFiles();
var testProjectDirectory = testInstance.Root.FullName;
new PublishCommand()
.WithWorkingDirectory(testProjectDirectory)
.Execute("--framework netcoreapp2.0")
.Should().Pass();
}
[Fact]
public void ItDoesNotImplicitlyRestoreAProjectWhenPublishingWithTheNoRestoreOption()
{
var testAppName = "MSBuildTestApp";
var testInstance = TestAssets.Get(testAppName)
.CreateInstance()
.WithSourceFiles();
var testProjectDirectory = testInstance.Root.FullName;
new PublishCommand()
.WithWorkingDirectory(testProjectDirectory)
.ExecuteWithCapturedOutput("--framework netcoreapp2.0 --no-restore")
.Should().Fail()
.And.HaveStdOutContaining("project.assets.json' not found.");;
}
[Fact]
public void ItPublishesARunnableSelfContainedApp()
{
@ -170,7 +203,7 @@ namespace Microsoft.DotNet.Cli.Publish.Tests
new PublishCommand()
.WithWorkingDirectory(rootPath)
.ExecuteWithCapturedOutput()
.ExecuteWithCapturedOutput("--no-restore")
.Should().Pass();
var configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug";

View file

@ -37,6 +37,40 @@ namespace Microsoft.DotNet.Cli.Run.Tests
.And.HaveStdOutContaining("Hello World!");
}
[Fact]
public void ItImplicitlyRestoresAProjectWhenRunning()
{
var testAppName = "MSBuildTestApp";
var testInstance = TestAssets.Get(testAppName)
.CreateInstance()
.WithSourceFiles();
var testProjectDirectory = testInstance.Root.FullName;
new RunCommand()
.WithWorkingDirectory(testProjectDirectory)
.ExecuteWithCapturedOutput()
.Should().Pass()
.And.HaveStdOutContaining("Hello World!");
}
[Fact]
public void ItDoesNotImplicitlyRestoreAProjectWhenRunningWithTheNoRestoreOption()
{
var testAppName = "MSBuildTestApp";
var testInstance = TestAssets.Get(testAppName)
.CreateInstance()
.WithSourceFiles();
var testProjectDirectory = testInstance.Root.FullName;
new RunCommand()
.WithWorkingDirectory(testProjectDirectory)
.ExecuteWithCapturedOutput("--no-restore")
.Should().Fail()
.And.HaveStdOutContaining("project.assets.json' not found.");;
}
[Fact]
public void ItBuildsTheProjectBeforeRunning()
{
@ -160,7 +194,7 @@ namespace Microsoft.DotNet.Cli.Run.Tests
new RunCommand()
.WithWorkingDirectory(rootPath)
.ExecuteWithCapturedOutput()
.ExecuteWithCapturedOutput("--no-restore")
.Should().Pass()
.And.HaveStdOutContaining("Hello World");
}

View file

@ -31,6 +31,43 @@ namespace Microsoft.DotNet.Cli.Test.Tests
result.ExitCode.Should().Be(1);
}
[Fact]
public void ItImplicitlyRestoresAProjectWhenTesting()
{
string testAppName = "VSTestCore";
var testInstance = TestAssets.Get(testAppName)
.CreateInstance()
.WithSourceFiles();
var testProjectDirectory = testInstance.Root.FullName;
CommandResult result = new DotnetTestCommand()
.WithWorkingDirectory(testProjectDirectory)
.ExecuteWithCapturedOutput(TestBase.ConsoleLoggerOutputNormal);
result.StdOut.Should().Contain("Total tests: 2. Passed: 1. Failed: 1. Skipped: 0.");
result.StdOut.Should().Contain("Passed TestNamespace.VSTestTests.VSTestPassTest");
result.StdOut.Should().Contain("Failed TestNamespace.VSTestTests.VSTestFailTest");
result.ExitCode.Should().Be(1);
}
[Fact]
public void ItDoesNotImplicitlyRestoreAProjectWhenTestingWithTheNoRestoreOption()
{
string testAppName = "VSTestCore";
var testInstance = TestAssets.Get(testAppName)
.CreateInstance()
.WithSourceFiles();
var testProjectDirectory = testInstance.Root.FullName;
new DotnetTestCommand()
.WithWorkingDirectory(testProjectDirectory)
.ExecuteWithCapturedOutput($"{TestBase.ConsoleLoggerOutputNormal} --no-restore")
.Should().Fail()
.And.HaveStdOutContaining("project.assets.json' not found.");;
}
[Fact]
public void XunitSingleTFM()
{
@ -161,14 +198,14 @@ namespace Microsoft.DotNet.Cli.Test.Tests
new BuildCommand()
.WithWorkingDirectory(rootPath)
.ExecuteWithCapturedOutput()
.ExecuteWithCapturedOutput("--no-restore")
.Should()
.Pass()
.And.NotHaveStdErr();
CommandResult result = new DotnetTestCommand()
.WithWorkingDirectory(rootPath)
.ExecuteWithCapturedOutput(TestBase.ConsoleLoggerOutputNormal);
.ExecuteWithCapturedOutput($"{TestBase.ConsoleLoggerOutputNormal} --no-restore");
result.StdOut.Should().Contain("Total tests: 2. Passed: 1. Failed: 1. Skipped: 0.");
result.StdOut.Should().Contain("Passed TestNamespace.VSTestTests.VSTestPassTest");
@ -209,6 +246,7 @@ namespace Microsoft.DotNet.Cli.Test.Tests
.Execute()
.Should()
.Pass();
return testProjectDirectory;
}
}