Merge pull request #6320 from johnbeisner/CLI-backcompat-tests

Adding a CLI Test: Execute a 1.0 tool in a netcoreapp1.1 project
This commit is contained in:
Livar 2017-04-17 10:05:40 -07:00 committed by GitHub
commit 78868ad33a
8 changed files with 141 additions and 0 deletions

View file

@ -226,6 +226,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "templates", "templates", "{
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dotnet-back-compat.Tests", "test\dotnet-back-compat.Tests\dotnet-back-compat.Tests.csproj", "{A4C198B4-D46E-4CA8-87DF-B2B206DCCAE6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dotnet-outputsframeworkversion-netcoreapp1.0", "TestAssets\TestPackages\dotnet-outputsframeworkversion\dotnet-outputsframeworkversion-netcoreapp1.0\dotnet-outputsframeworkversion-netcoreapp1.0.csproj", "{3F7D56A3-A280-467E-8916-C18659C243BA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -962,6 +964,30 @@ Global
{BBB5A4C8-CD2D-4A6A-9159-0FEAF84B745E}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
{BBB5A4C8-CD2D-4A6A-9159-0FEAF84B745E}.RelWithDebInfo|x86.ActiveCfg = Release|Any CPU
{BBB5A4C8-CD2D-4A6A-9159-0FEAF84B745E}.RelWithDebInfo|x86.Build.0 = Release|Any CPU
{8AA88E83-6A98-4AD6-86EB-2ED4F6EDA17F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8AA88E83-6A98-4AD6-86EB-2ED4F6EDA17F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8AA88E83-6A98-4AD6-86EB-2ED4F6EDA17F}.Debug|x64.ActiveCfg = Debug|Any CPU
{8AA88E83-6A98-4AD6-86EB-2ED4F6EDA17F}.Debug|x64.Build.0 = Debug|Any CPU
{8AA88E83-6A98-4AD6-86EB-2ED4F6EDA17F}.Debug|x86.ActiveCfg = Debug|Any CPU
{8AA88E83-6A98-4AD6-86EB-2ED4F6EDA17F}.Debug|x86.Build.0 = Debug|Any CPU
{8AA88E83-6A98-4AD6-86EB-2ED4F6EDA17F}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU
{8AA88E83-6A98-4AD6-86EB-2ED4F6EDA17F}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU
{8AA88E83-6A98-4AD6-86EB-2ED4F6EDA17F}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU
{8AA88E83-6A98-4AD6-86EB-2ED4F6EDA17F}.MinSizeRel|x64.Build.0 = Debug|Any CPU
{8AA88E83-6A98-4AD6-86EB-2ED4F6EDA17F}.MinSizeRel|x86.ActiveCfg = Debug|Any CPU
{8AA88E83-6A98-4AD6-86EB-2ED4F6EDA17F}.MinSizeRel|x86.Build.0 = Debug|Any CPU
{8AA88E83-6A98-4AD6-86EB-2ED4F6EDA17F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8AA88E83-6A98-4AD6-86EB-2ED4F6EDA17F}.Release|Any CPU.Build.0 = Release|Any CPU
{8AA88E83-6A98-4AD6-86EB-2ED4F6EDA17F}.Release|x64.ActiveCfg = Release|Any CPU
{8AA88E83-6A98-4AD6-86EB-2ED4F6EDA17F}.Release|x64.Build.0 = Release|Any CPU
{8AA88E83-6A98-4AD6-86EB-2ED4F6EDA17F}.Release|x86.ActiveCfg = Release|Any CPU
{8AA88E83-6A98-4AD6-86EB-2ED4F6EDA17F}.Release|x86.Build.0 = Release|Any CPU
{8AA88E83-6A98-4AD6-86EB-2ED4F6EDA17F}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU
{8AA88E83-6A98-4AD6-86EB-2ED4F6EDA17F}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
{8AA88E83-6A98-4AD6-86EB-2ED4F6EDA17F}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
{8AA88E83-6A98-4AD6-86EB-2ED4F6EDA17F}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
{8AA88E83-6A98-4AD6-86EB-2ED4F6EDA17F}.RelWithDebInfo|x86.ActiveCfg = Release|Any CPU
{8AA88E83-6A98-4AD6-86EB-2ED4F6EDA17F}.RelWithDebInfo|x86.Build.0 = Release|Any CPU
{726D2CB9-80E5-4496-9C86-910AC452C45E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{726D2CB9-80E5-4496-9C86-910AC452C45E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{726D2CB9-80E5-4496-9C86-910AC452C45E}.Debug|x64.ActiveCfg = Release|Any CPU
@ -1538,6 +1564,30 @@ Global
{A4C198B4-D46E-4CA8-87DF-B2B206DCCAE6}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
{A4C198B4-D46E-4CA8-87DF-B2B206DCCAE6}.RelWithDebInfo|x86.ActiveCfg = Release|Any CPU
{A4C198B4-D46E-4CA8-87DF-B2B206DCCAE6}.RelWithDebInfo|x86.Build.0 = Release|Any CPU
{3F7D56A3-A280-467E-8916-C18659C243BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3F7D56A3-A280-467E-8916-C18659C243BA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3F7D56A3-A280-467E-8916-C18659C243BA}.Debug|x64.ActiveCfg = Debug|Any CPU
{3F7D56A3-A280-467E-8916-C18659C243BA}.Debug|x64.Build.0 = Debug|Any CPU
{3F7D56A3-A280-467E-8916-C18659C243BA}.Debug|x86.ActiveCfg = Debug|Any CPU
{3F7D56A3-A280-467E-8916-C18659C243BA}.Debug|x86.Build.0 = Debug|Any CPU
{3F7D56A3-A280-467E-8916-C18659C243BA}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU
{3F7D56A3-A280-467E-8916-C18659C243BA}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU
{3F7D56A3-A280-467E-8916-C18659C243BA}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU
{3F7D56A3-A280-467E-8916-C18659C243BA}.MinSizeRel|x64.Build.0 = Debug|Any CPU
{3F7D56A3-A280-467E-8916-C18659C243BA}.MinSizeRel|x86.ActiveCfg = Debug|Any CPU
{3F7D56A3-A280-467E-8916-C18659C243BA}.MinSizeRel|x86.Build.0 = Debug|Any CPU
{3F7D56A3-A280-467E-8916-C18659C243BA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3F7D56A3-A280-467E-8916-C18659C243BA}.Release|Any CPU.Build.0 = Release|Any CPU
{3F7D56A3-A280-467E-8916-C18659C243BA}.Release|x64.ActiveCfg = Release|Any CPU
{3F7D56A3-A280-467E-8916-C18659C243BA}.Release|x64.Build.0 = Release|Any CPU
{3F7D56A3-A280-467E-8916-C18659C243BA}.Release|x86.ActiveCfg = Release|Any CPU
{3F7D56A3-A280-467E-8916-C18659C243BA}.Release|x86.Build.0 = Release|Any CPU
{3F7D56A3-A280-467E-8916-C18659C243BA}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU
{3F7D56A3-A280-467E-8916-C18659C243BA}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
{3F7D56A3-A280-467E-8916-C18659C243BA}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
{3F7D56A3-A280-467E-8916-C18659C243BA}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
{3F7D56A3-A280-467E-8916-C18659C243BA}.RelWithDebInfo|x86.ActiveCfg = Release|Any CPU
{3F7D56A3-A280-467E-8916-C18659C243BA}.RelWithDebInfo|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -1607,5 +1657,6 @@ Global
{3275D006-54C8-4C64-A537-B9941C5D2F0C} = {89905EC4-BC0F-443B-8ADF-691321F10108}
{DE4D1AEB-871B-4E7C-945A-453F9A490C06} = {89905EC4-BC0F-443B-8ADF-691321F10108}
{A4C198B4-D46E-4CA8-87DF-B2B206DCCAE6} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
{3F7D56A3-A280-467E-8916-C18659C243BA} = {1AB5B24B-B317-4142-A5D1-A6E84F15BA34}
EndGlobalSection
EndGlobal

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 ConsoleApplication
{
public class Program
{
public static void Main()
{
Console.WriteLine("netcoreapp1.0");
}
}
}

View file

@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), testAsset.props))\testAsset.props" />
<PropertyGroup>
<TargetFramework>netcoreapp1.0</TargetFramework>
<AssemblyName>dotnet-outputsframeworkversion-netcoreapp1.0</AssemblyName>
<OutputType>Exe</OutputType>
<RuntimeFrameworkVersion>1.1.1</RuntimeFrameworkVersion>
</PropertyGroup>
<ItemGroup>
<BuiltProjectOutputGroupOutput Include="$(ProjectRuntimeConfigFilePath)">
<FinalOutputPath>$(ProjectRuntimeConfigFilePath)</FinalOutputPath>
</BuiltProjectOutputGroupOutput>
</ItemGroup>
</Project>

View file

@ -0,0 +1,12 @@
<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>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<DotNetCliToolReference Include="dotnet-outputsframeworkversion-netcoreapp1.0" Version="1.0.0" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="test-packages" value="../../../artifacts/testpackages" />
</packageSources>
</configuration>

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 ConsoleApplication
{
public class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}

View file

@ -118,6 +118,15 @@
<VersionSuffix></VersionSuffix>
<Clean>True</Clean>
</BaseTestPackageProject>
<BaseTestPackageProject Include="TestAssets/TestPackages/dotnet-outputsframeworkversion/dotnet-outputsframeworkversion-netcoreapp1.0">
<Name>dotnet-outputsframeworkversion-netcoreapp1.0</Name>
<ProjectName>dotnet-outputsframeworkversion-netcoreapp1.0.csproj</ProjectName>
<IsTool>True</IsTool>
<IsApplicable>True</IsApplicable>
<VersionPrefix>1.0.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
<Clean>True</Clean>
</BaseTestPackageProject>
<BaseTestPackageProject Include="TestAssets/TestPackages/dotnet-portable">
<Name>dotnet-portable</Name>
<ProjectName>dotnet-portable.csproj</ProjectName>

View file

@ -78,6 +78,24 @@ namespace Microsoft.DotNet.Cli.Build.Tests
.Should().Pass();
}
[RequiresSpecificFrameworkFact("netcoreapp1.0")] // https://github.com/dotnet/cli/issues/6087
public void ItRunsABackwardsVersionedTool()
{
var testInstance = TestAssets.Get("11TestAppWith10CLIToolReferences")
.CreateInstance()
.WithSourceFiles()
.WithRestoreFiles();
var testProjectDirectory = testInstance.Root;
new DotnetCommand(DotnetUnderTest.WithBackwardsCompatibleRuntimes)
.WithWorkingDirectory(testInstance.Root)
.ExecuteWithCapturedOutput("outputsframeworkversion-netcoreapp1.0")
.Should()
.Pass()
.And
.HaveStdOutContaining("netcoreapp1.0");
}
void ChangeProjectTargetFramework(FileInfo projectFile, string target)
{