Fix tests on netcoreapp1.1 only platforms

This commit is contained in:
Eric Erhardt 2017-02-20 10:01:29 -06:00
parent 996d458e30
commit 8aaffc2238
40 changed files with 203 additions and 151 deletions

View file

@ -1,9 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<TargetFrameworks>netcoreapp1.0;net451</TargetFrameworks>
<TargetFrameworks>netcoreapp1.1;net451</TargetFrameworks>
<OutputType>Exe</OutputType>
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">$(PackageTargetFallback);portable-net45+win8;dnxcore50</PackageTargetFallback>
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.1' ">$(PackageTargetFallback);portable-net45+win8;dnxcore50</PackageTargetFallback>
<RuntimeIdentifiers>win7-x64;win7-x86;osx.10.10-x64;osx.10.11-x64;ubuntu.14.04-x64;ubuntu.16.04-x64;centos.7-x64;rhel.7.2-x64;debian.8-x64;fedora.23-x64;opensuse.13.2-x64</RuntimeIdentifiers>
<DotnetCliToolTargetFramework>netcoreapp1.1</DotnetCliToolTargetFramework>
</PropertyGroup>
<ItemGroup>
@ -11,11 +12,6 @@
<Version>1.0.0-*</Version>
</PackageReference>
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">
<PackageReference Include="Microsoft.NETCore.App">
<Version>1.0.3</Version>
</PackageReference>
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
@ -25,7 +21,4 @@
<Version>1.0.0-*</Version>
</DotNetCliToolReference>
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
</PropertyGroup>
</Project>

View file

@ -4,6 +4,7 @@
<AssemblyName>AppWithRedirectsAndConfig</AssemblyName>
<OutputType>Exe</OutputType>
<RuntimeIdentifiers>win7-x64;win7-x86</RuntimeIdentifiers>
<DotnetCliToolTargetFramework>netcoreapp1.1</DotnetCliToolTargetFramework>
</PropertyGroup>
<ItemGroup>

View file

@ -4,6 +4,7 @@
<AssemblyName>AppWithRedirectsNoConfig</AssemblyName>
<OutputType>Exe</OutputType>
<RuntimeIdentifiers>win7-x64;win7-x86</RuntimeIdentifiers>
<DotnetCliToolTargetFramework>netcoreapp1.1</DotnetCliToolTargetFramework>
</PropertyGroup>
<ItemGroup>

View file

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

View file

@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.0</TargetFramework>
<TargetFramework>netcoreapp1.1</TargetFramework>
<AssemblyName>dotnet-throwingtool</AssemblyName>
<PackageId>$(AssemblyName)</PackageId>
</PropertyGroup>
@ -13,10 +13,4 @@
</BuiltProjectOutputGroupOutput>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.App">
<Version>1.0.3</Version>
</PackageReference>
</ItemGroup>
</Project>

View file

@ -2,15 +2,10 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.0</TargetFramework>
<TargetFramework>netcoreapp1.1</TargetFramework>
<DotnetCliToolTargetFramework>netcoreapp1.1</DotnetCliToolTargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.App">
<Version>1.0.3</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="dotnet-throwingtool">
<Version>1.0.0</Version>

View file

@ -2,12 +2,12 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.0</TargetFramework>
<TargetFramework>netcoreapp1.1</TargetFramework>
<GeneratedPackageId>random-name</GeneratedPackageId>
<DotnetCliToolTargetFramework>netcoreapp1.1</DotnetCliToolTargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.App" Version="1.0.3" />
<DotNetCliToolReference Include="$(GeneratedPackageId)">
<Version>1.0.0</Version>
</DotNetCliToolReference>

View file

@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.0</TargetFramework>
<TargetFramework>netcoreapp1.1</TargetFramework>
<GeneratedPackageId>random-name</GeneratedPackageId>
<PackageId>$(GeneratedPackageId)</PackageId>
<AssemblyName>dotnet-randompackage</AssemblyName>
@ -14,8 +14,4 @@
</BuiltProjectOutputGroupOutput>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.App" Version="1.0.3" />
</ItemGroup>
</Project>

View file

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp1.0</TargetFramework>
<TargetFramework>netcoreapp1.1</TargetFramework>
<AssemblyName>dotnet-tool-with-output-name</AssemblyName>
<PackageId>ToolWithOutputName</PackageId>
<OutputType>Exe</OutputType>
@ -12,13 +12,4 @@
</BuiltProjectOutputGroupOutput>
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">
<PackageReference Include="Microsoft.NETCore.App">
<Version>1.0.4</Version>
</PackageReference>
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
</PropertyGroup>
</Project>

View file

@ -3,10 +3,11 @@
<PropertyGroup>
<VersionPrefix>1.0.0-rc</VersionPrefix>
<TargetFramework>netcoreapp1.0</TargetFramework>
<TargetFramework>netcoreapp1.1</TargetFramework>
<AssemblyName>dotnet-dependency-tool-invoker</AssemblyName>
<OutputType>Exe</OutputType>
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">$(PackageTargetFallback);portable-net45+win8;dnxcore50</PackageTargetFallback>
<PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8;dnxcore50</PackageTargetFallback>
<DisableImplicitFrameworkReferences>false</DisableImplicitFrameworkReferences>
</PropertyGroup>
<PropertyGroup>
@ -22,9 +23,6 @@
</BuiltProjectOutputGroupOutput>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.App">
<Version>1.0.4</Version>
</PackageReference>
<PackageReference Include="NuGet.Frameworks">
<Version>$(CLI_NuGet_Version)</Version>
</PackageReference>
@ -32,8 +30,4 @@
<Version>$(SdkNugetVersion)</Version>
</PackageReference>
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
</PropertyGroup>
</Project>

View file

@ -1,24 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
<PropertyGroup>
<VersionPrefix>1.0.0-rc</VersionPrefix>
<TargetFrameworks>netcoreapp1.0;net451</TargetFrameworks>
<TargetFrameworks>netcoreapp1.1;net451</TargetFrameworks>
<AssemblyName>dotnet-desktop-and-portable</AssemblyName>
<OutputType>Exe</OutputType>
<RuntimeIdentifiers>win7-x64;win7-x86</RuntimeIdentifiers>
</PropertyGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.1' ">
<BuiltProjectOutputGroupOutput Include="$(ProjectRuntimeConfigFilePath)">
<FinalOutputPath>$(ProjectRuntimeConfigFilePath)</FinalOutputPath>
</BuiltProjectOutputGroupOutput>
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">
<PackageReference Include="Microsoft.NETCore.App">
<Version>1.0.4</Version>
</PackageReference>
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />

View file

@ -2,9 +2,10 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<TargetFramework>netcoreapp1.0</TargetFramework>
<TargetFramework>netcoreapp1.1</TargetFramework>
<AssemblyName>dotnet-portable</AssemblyName>
<OutputType>Exe</OutputType>
<DisableImplicitFrameworkReferences>false</DisableImplicitFrameworkReferences>
</PropertyGroup>
<ItemGroup>
@ -12,14 +13,4 @@
<FinalOutputPath>$(ProjectRuntimeConfigFilePath)</FinalOutputPath>
</BuiltProjectOutputGroupOutput>
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">
<PackageReference Include="Microsoft.NETCore.App">
<Version>1.0.4</Version>
</PackageReference>
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
</PropertyGroup>
</Project>

View file

@ -2,6 +2,7 @@
<PropertyGroup>
<TargetFramework>netcoreapp1.0</TargetFramework>
<OutputType>Exe</OutputType>
<DotnetCliToolTargetFramework>netcoreapp1.1</DotnetCliToolTargetFramework>
</PropertyGroup>
<ItemGroup>
@ -14,7 +15,4 @@
<Version>1.0.0</Version>
</DotNetCliToolReference>
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
</PropertyGroup>
</Project>
</Project>

View file

@ -2,6 +2,7 @@
<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
<OutputType>Exe</OutputType>
<DotnetCliToolTargetFramework>netcoreapp1.1</DotnetCliToolTargetFramework>
</PropertyGroup>
<ItemGroup>
@ -17,7 +18,4 @@
<Version>1.0.0</Version>
</DotNetCliToolReference>
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
</PropertyGroup>
</Project>
</Project>

View file

@ -1,23 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp1.0</TargetFramework>
<TargetFramework>netcoreapp1.1</TargetFramework>
<OutputType>Exe</OutputType>
<DotnetCliToolTargetFramework>netcoreapp1.1</DotnetCliToolTargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ToolWithOutputName">
<Version>1.0.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.NETCore.App">
<Version>1.0.3</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="dotnet-dependency-tool-invoker">
<Version>1.0.0-*</Version>
</DotNetCliToolReference>
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
</PropertyGroup>
</Project>
</Project>

View file

@ -2,6 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net451;netcoreapp1.0</TargetFrameworks>
<DotnetCliToolTargetFramework>netcoreapp1.1</DotnetCliToolTargetFramework>
</PropertyGroup>
<ItemGroup>

View file

@ -1,14 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<TargetFramework>netcoreapp1.0</TargetFramework>
<TargetFramework>netcoreapp1.1</TargetFramework>
<OutputType>Exe</OutputType>
<DotnetCliToolTargetFramework>netcoreapp1.1</DotnetCliToolTargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.App">
<Version>1.0.3</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="dotnet-portable">
<Version>1.0.0</Version>
@ -17,7 +13,4 @@
<Version>1.0.0</Version>
</DotNetCliToolReference>
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
</PropertyGroup>
</Project>
</Project>

View file

@ -2,6 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net451;netcoreapp1.0</TargetFrameworks>
<DotnetCliToolTargetFramework>netcoreapp1.1</DotnetCliToolTargetFramework>
</PropertyGroup>
<ItemGroup>

View file

@ -1,8 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.0</TargetFramework>
<RuntimeIdentifiers>win7-x64;win7-x86;osx.10.10-x64;osx.10.11-x64;ubuntu.14.04-x64;ubuntu.16.04-x64;centos.7-x64;rhel.7.2-x64;debian.8-x64;fedora.23-x64;opensuse.13.2-x64</RuntimeIdentifiers>
<TargetFramework>netcoreapp1.1</TargetFramework>
<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.23-x64;fedora.24-x64;opensuse.13.2-x64;opensuse.42.1-x64</RuntimeIdentifiers>
<DotnetCliToolTargetFramework>netcoreapp1.1</DotnetCliToolTargetFramework>
</PropertyGroup>
<ItemGroup>

View file

@ -1,13 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.0</TargetFramework>
<TargetFramework>netcoreapp1.1</TargetFramework>
<DotnetCliToolTargetFramework>netcoreapp1.1</DotnetCliToolTargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.App">
<Version>1.0.3</Version>
</PackageReference>
<PackageReference Include="dotnet-portable">
<Version>1.0.0</Version>
<PrivateAssets>All</PrivateAssets>

View file

@ -2,13 +2,11 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.0</TargetFramework>
<TargetFramework>netcoreapp1.1</TargetFramework>
<DisableImplicitFrameworkReferences>false</DisableImplicitFrameworkReferences>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.App">
<Version>1.0.3</Version>
</PackageReference>
<PackageReference Include="MSTest.TestFramework">
<Version>1.0.6-preview</Version>
</PackageReference>

View file

@ -2,13 +2,11 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.0</TargetFramework>
<TargetFramework>netcoreapp1.1</TargetFramework>
<DisableImplicitFrameworkReferences>false</DisableImplicitFrameworkReferences>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.App">
<Version>1.0.3</Version>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk">
<Version>$(CLI_TestPlatform_Version)</Version>
</PackageReference>

View file

@ -2,6 +2,7 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Collections.Generic;
using NuGet.Frameworks;
using NuGet.ProjectModel;
namespace Microsoft.DotNet.Cli.Utils
@ -22,6 +23,8 @@ namespace Microsoft.DotNet.Cli.Utils
string FullOutputPath { get; }
NuGetFramework DotnetCliToolTargetFramework { get; }
Dictionary<string, string> EnvironmentVariables { get; }
}
}

View file

@ -13,6 +13,8 @@ namespace Microsoft.DotNet.Cli.Utils
{
internal class MSBuildProject : IProject
{
private static readonly NuGetFramework s_toolPackageFramework = FrameworkConstants.CommonFrameworks.NetCoreApp10;
private Project _project;
private string _projectRoot;
@ -60,6 +62,25 @@ namespace Microsoft.DotNet.Cli.Utils
}
}
public NuGetFramework DotnetCliToolTargetFramework
{
get
{
var frameworkString = _project
.AllEvaluatedProperties
.FirstOrDefault(p => p.Name.Equals("DotnetCliToolTargetFramework"))
?.EvaluatedValue;
if (string.IsNullOrEmpty(frameworkString))
{
return s_toolPackageFramework;
}
return NuGetFramework.Parse(frameworkString);
}
}
public Dictionary<string, string> EnvironmentVariables
{
get

View file

@ -18,8 +18,6 @@ namespace Microsoft.DotNet.Cli.Utils
{
private const string ProjectToolsCommandResolverName = "projecttoolscommandresolver";
private static readonly NuGetFramework s_toolPackageFramework = FrameworkConstants.CommonFrameworks.NetCoreApp10;
private static readonly CommandResolutionStrategy s_commandResolutionStrategy =
CommandResolutionStrategy.ProjectToolsPackage;
@ -133,8 +131,14 @@ namespace Microsoft.DotNet.Cli.Utils
ProjectToolsCommandResolverName,
string.Join(Environment.NewLine, possiblePackageRoots.Select((p) => $"- {p}"))));
var toolPackageFramework = project.DotnetCliToolTargetFramework;
string nugetPackagesRoot;
var toolLockFile = GetToolLockFile(toolLibraryRange, possiblePackageRoots, out nugetPackagesRoot);
var toolLockFile = GetToolLockFile(
toolLibraryRange,
toolPackageFramework,
possiblePackageRoots,
out nugetPackagesRoot);
if (toolLockFile == null)
{
@ -147,7 +151,7 @@ namespace Microsoft.DotNet.Cli.Utils
toolLockFile.Path));
var toolLibrary = toolLockFile.Targets
.FirstOrDefault(t => s_toolPackageFramework == t.TargetFramework)
.FirstOrDefault(t => toolPackageFramework == t.TargetFramework)
?.Libraries.FirstOrDefault(
l => StringComparer.OrdinalIgnoreCase.Equals(l.Name, toolLibraryRange.Name));
if (toolLibrary == null)
@ -161,7 +165,11 @@ namespace Microsoft.DotNet.Cli.Utils
var depsFileRoot = Path.GetDirectoryName(toolLockFile.Path);
var depsFilePath = GetToolDepsFilePath(toolLibraryRange, toolLockFile, depsFileRoot);
var depsFilePath = GetToolDepsFilePath(
toolLibraryRange,
toolPackageFramework,
toolLockFile,
depsFileRoot);
var normalizedNugetPackagesRoot = PathUtility.EnsureNoTrailingDirectorySeparator(nugetPackagesRoot);
@ -203,12 +211,13 @@ namespace Microsoft.DotNet.Cli.Utils
private LockFile GetToolLockFile(
SingleProjectInfo toolLibrary,
NuGetFramework framework,
IEnumerable<string> possibleNugetPackagesRoot,
out string nugetPackagesRoot)
{
foreach (var packagesRoot in possibleNugetPackagesRoot)
{
if (TryGetToolLockFile(toolLibrary, packagesRoot, out LockFile lockFile))
if (TryGetToolLockFile(toolLibrary, framework, packagesRoot, out LockFile lockFile))
{
nugetPackagesRoot = packagesRoot;
return lockFile;
@ -221,11 +230,12 @@ namespace Microsoft.DotNet.Cli.Utils
private bool TryGetToolLockFile(
SingleProjectInfo toolLibrary,
NuGetFramework framework,
string nugetPackagesRoot,
out LockFile lockFile)
{
lockFile = null;
var lockFilePath = GetToolLockFilePath(toolLibrary, nugetPackagesRoot);
var lockFilePath = GetToolLockFilePath(toolLibrary, framework, nugetPackagesRoot);
if (!File.Exists(lockFilePath))
{
@ -248,6 +258,7 @@ namespace Microsoft.DotNet.Cli.Utils
private string GetToolLockFilePath(
SingleProjectInfo toolLibrary,
NuGetFramework framework,
string nugetPackagesRoot)
{
var toolPathCalculator = new ToolPathCalculator(nugetPackagesRoot);
@ -255,11 +266,12 @@ namespace Microsoft.DotNet.Cli.Utils
return toolPathCalculator.GetBestLockFilePath(
toolLibrary.Name,
VersionRange.Parse(toolLibrary.Version),
s_toolPackageFramework);
framework);
}
private string GetToolDepsFilePath(
SingleProjectInfo toolLibrary,
NuGetFramework framework,
LockFile toolLockFile,
string depsPathRoot)
{
@ -272,24 +284,26 @@ namespace Microsoft.DotNet.Cli.Utils
ProjectToolsCommandResolverName,
depsJsonPath));
EnsureToolJsonDepsFileExists(toolLockFile, depsJsonPath, toolLibrary);
EnsureToolJsonDepsFileExists(toolLockFile, framework, depsJsonPath, toolLibrary);
return depsJsonPath;
}
private void EnsureToolJsonDepsFileExists(
LockFile toolLockFile,
NuGetFramework framework,
string depsPath,
SingleProjectInfo toolLibrary)
{
if (!File.Exists(depsPath))
{
GenerateDepsJsonFile(toolLockFile, depsPath, toolLibrary);
GenerateDepsJsonFile(toolLockFile, framework, depsPath, toolLibrary);
}
}
internal void GenerateDepsJsonFile(
LockFile toolLockFile,
NuGetFramework framework,
string depsPath,
SingleProjectInfo toolLibrary)
{
@ -298,7 +312,7 @@ namespace Microsoft.DotNet.Cli.Utils
depsPath));
var dependencyContext = new DepsJsonBuilder()
.Build(toolLibrary, null, toolLockFile, s_toolPackageFramework, null);
.Build(toolLibrary, null, toolLockFile, framework, null);
var tempDepsFile = Path.GetTempFileName();
using (var fileStream = File.Open(tempDepsFile, FileMode.Open, FileAccess.Write))

View file

@ -19,7 +19,7 @@ namespace Microsoft.DotNet.Tests.EndToEnd
{
string projectDirectory = directory.Path;
string newArgs = "console --debug:ephemeral-hive";
string newArgs = "console -f netcoreapp1.1 --debug:ephemeral-hive";
new NewCommandShim()
.WithWorkingDirectory(projectDirectory)
.Execute(newArgs)
@ -112,7 +112,7 @@ namespace Microsoft.DotNet.Tests.EndToEnd
new DotnetCommand()
.WithWorkingDirectory(testProjectDirectory)
.ExecuteWithCapturedOutput(
$"-d dependency-tool-invoker -c {configuration} -f netcoreapp1.0 portable")
$"-d dependency-tool-invoker -c {configuration} -f netcoreapp1.1 portable")
.Should().Pass()
.And.HaveStdOutContaining("Hello Portable World!");;
}

View file

@ -201,7 +201,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
.Should().Pass();
var factory = new ProjectDependenciesCommandFactory(
FrameworkConstants.CommonFrameworks.NetCoreApp10,
FrameworkConstants.CommonFrameworks.NetCoreApp11,
configuration,
null,
null,
@ -210,7 +210,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
var command = factory.Create("dotnet-tool-with-output-name", null);
command.CommandArgs.Should().Contain(
Path.Combine("toolwithoutputname", "1.0.0", "lib", "netcoreapp1.0", "dotnet-tool-with-output-name.dll"));
Path.Combine("toolwithoutputname", "1.0.0", "lib", "netcoreapp1.1", "dotnet-tool-with-output-name.dll"));
}
}
}

View file

@ -47,7 +47,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
CommandName = "dotnet-portable",
Configuration = "Debug",
ProjectDirectory = MSBuildTestProjectInstance.Root.FullName,
Framework = FrameworkConstants.CommonFrameworks.NetCoreApp10
Framework = FrameworkConstants.CommonFrameworks.NetCoreApp11
};
var result = projectDependenciesCommandResolver.Resolve(commandResolverArguments);
@ -83,7 +83,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
CommandName = "dotnet-portable",
Configuration = "Debug",
ProjectDirectory = MSBuildTestProjectInstance.Root.FullName,
Framework = FrameworkConstants.CommonFrameworks.NetCoreApp10
Framework = FrameworkConstants.CommonFrameworks.NetCoreApp11
};
var result = projectDependenciesCommandResolver.Resolve(commandResolverArguments);
@ -109,7 +109,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
CommandName = "nonexistent-command",
CommandArguments = null,
ProjectDirectory = MSBuildTestProjectInstance.Root.FullName,
Framework = FrameworkConstants.CommonFrameworks.NetCoreApp10
Framework = FrameworkConstants.CommonFrameworks.NetCoreApp11
};
var result = projectDependenciesCommandResolver.Resolve(commandResolverArguments);
@ -135,7 +135,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
CommandName = "dotnet-portable",
Configuration = "Debug",
ProjectDirectory = testInstance.Root.FullName,
Framework = FrameworkConstants.CommonFrameworks.NetCoreApp10,
Framework = FrameworkConstants.CommonFrameworks.NetCoreApp11,
OutputPath = outputDir.FullName
};

View file

@ -18,7 +18,7 @@ namespace Microsoft.DotNet.Tests
public class GivenAProjectToolsCommandResolver : TestBase
{
private static readonly NuGetFramework s_toolPackageFramework =
FrameworkConstants.CommonFrameworks.NetCoreApp10;
FrameworkConstants.CommonFrameworks.NetCoreApp11;
private const string TestProjectName = "AppWithToolDependency";
@ -279,6 +279,7 @@ namespace Microsoft.DotNet.Tests
var projectToolsCommandResolver = SetupProjectToolsCommandResolver();
projectToolsCommandResolver.GenerateDepsJsonFile(
lockFile,
s_toolPackageFramework,
depsJsonFile,
new SingleProjectInfo("dotnet-portable", "1.0.0", Enumerable.Empty<ResourceAssemblyInfo>()));

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.
using Microsoft.DotNet.PlatformAbstractions;
namespace Microsoft.DotNet.Tools.Test.Utilities
{
public static class EnvironmentInfo
{
public static bool HasSharedFramework(string framework)
{
if (framework == "netcoreapp1.0")
{
string rid = RuntimeEnvironment.GetRuntimeIdentifier();
switch (rid)
{
case "fedora.24-x64":
case "opensuse.42.1-x64":
case "ubuntu.16.10-x64":
return false;
}
}
return true;
}
}
}

View file

@ -0,0 +1,18 @@
// 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 Xunit;
namespace Microsoft.DotNet.Tools.Test.Utilities
{
public class RequiresSpecificFrameworkFactAttribute : FactAttribute
{
public RequiresSpecificFrameworkFactAttribute(string framework)
{
if (!EnvironmentInfo.HasSharedFramework(framework))
{
this.Skip = $"This test requires a shared framework that isn't present: {framework}";
}
}
}
}

View file

@ -28,7 +28,7 @@ namespace Microsoft.DotNet.Cli.Build.Tests
var configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug";
var outputDll = testInstance.Root.GetDirectory("bin", configuration, "netcoreapp1.0")
var outputDll = testInstance.Root.GetDirectory("bin", configuration, "netcoreapp1.1")
.GetFile($"{testAppName}.dll");
var outputRunCommand = new TestCommand("dotnet");
@ -46,7 +46,7 @@ namespace Microsoft.DotNet.Cli.Build.Tests
string dir = "pkgs";
string args = $"--packages {dir}";
string newArgs = $"console -o \"{rootPath}\" --debug:ephemeral-hive";
string newArgs = $"console -f netcoreapp1.1 -o \"{rootPath}\" --debug:ephemeral-hive";
new NewCommandShim()
.WithWorkingDirectory(rootPath)
.Execute(newArgs)
@ -65,7 +65,12 @@ namespace Microsoft.DotNet.Cli.Build.Tests
.Execute()
.Should().Pass();
var outputDll = Directory.EnumerateFiles(Path.Combine(rootPath, "bin"), "*.dll", SearchOption.AllDirectories).Single();
var configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug";
var outputDll = Directory.EnumerateFiles(
Path.Combine(rootPath, "bin", configuration, "netcoreapp1.1"), "*.dll",
SearchOption.TopDirectoryOnly)
.Single();
var outputRunCommand = new TestCommand("dotnet");

View file

@ -431,6 +431,12 @@ namespace Microsoft.DotNet.Migration.Tests
.Execute("build -c Debug")
.Should().Pass();
if (!EnvironmentInfo.HasSharedFramework("netcoreapp1.0"))
{
// running the app requires netcoreapp1.0
return;
}
var cmd = new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.ExecuteWithCapturedOutput("run -c Debug");
@ -483,6 +489,12 @@ namespace Microsoft.DotNet.Migration.Tests
.Execute("build -c Debug")
.Should().Pass();
if (!EnvironmentInfo.HasSharedFramework("netcoreapp1.0"))
{
// running the app requires netcoreapp1.0
return;
}
var cmd = new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.ExecuteWithCapturedOutput("run -c Debug");
@ -534,6 +546,12 @@ namespace Microsoft.DotNet.Migration.Tests
.Execute("build -c Debug")
.Should().Pass();
if (!EnvironmentInfo.HasSharedFramework("netcoreapp1.0"))
{
// running the app requires netcoreapp1.0
return;
}
var cmd = new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.ExecuteWithCapturedOutput("run -c Debug");

View file

@ -492,7 +492,7 @@ namespace Microsoft.DotNet.Migration.Tests
}
outputsIdentical.Should().BeTrue();
VerifyAllMSBuildOutputsRunnable(projectDirectory);
}
@ -543,7 +543,7 @@ namespace Microsoft.DotNet.Migration.Tests
.And.Contain("Migration failed.");
}
[Fact]
[RequiresSpecificFrameworkFact("netcoreapp1.0")]
public void ItMigratesAndPublishesProjectsWithRuntimes()
{
var projectName = "PJTestAppSimple";
@ -745,6 +745,12 @@ namespace Microsoft.DotNet.Migration.Tests
private void VerifyAllMSBuildOutputsRunnable(DirectoryInfo projectDirectory)
{
if (!EnvironmentInfo.HasSharedFramework("netcoreapp1.0"))
{
// running the apps requires netcoreapp1.0
return;
}
var dllFileName = Path.GetFileName(projectDirectory.FullName) + ".dll";
var runnableDlls = projectDirectory

View file

@ -30,6 +30,13 @@ namespace Microsoft.DotNet.New.Tests
string projectType,
bool useNuGetConfigForAspNet)
{
if (language == "F#" && !EnvironmentInfo.HasSharedFramework("netcoreapp1.0"))
{
// F# requires netcoreapp1.0 to be present in order to build
// https://github.com/dotnet/netcorecli-fsc/issues/76
return;
}
string rootPath = TestAssetsManager.CreateTestDirectory(identifier: $"{language}_{projectType}").Path;
new TestCommand("dotnet") { WorkingDirectory = rootPath }

View file

@ -29,11 +29,11 @@ namespace Microsoft.DotNet.Cli.Publish.Tests
new PublishCommand()
.WithWorkingDirectory(testProjectDirectory)
.Execute("--framework netcoreapp1.0")
.Execute("--framework netcoreapp1.1")
.Should().Pass();
var configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug";
var outputDll = Path.Combine(testProjectDirectory, "bin", configuration, "netcoreapp1.0", "publish", $"{testAppName}.dll");
var outputDll = Path.Combine(testProjectDirectory, "bin", configuration, "netcoreapp1.1", "publish", $"{testAppName}.dll");
new TestCommand("dotnet")
.ExecuteWithCapturedOutput(outputDll)
@ -56,7 +56,7 @@ namespace Microsoft.DotNet.Cli.Publish.Tests
var rid = DotnetLegacyRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier();
new PublishCommand()
.WithFramework("netcoreapp1.0")
.WithFramework("netcoreapp1.1")
.WithRuntime(rid)
.WithWorkingDirectory(testProjectDirectory)
//Workaround for https://github.com/dotnet/cli/issues/4501
@ -67,7 +67,7 @@ namespace Microsoft.DotNet.Cli.Publish.Tests
var configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug";
var outputProgram = testProjectDirectory
.GetDirectory("bin", configuration, "netcoreapp1.0", rid, "publish", $"{testAppName}{Constants.ExeSuffix}")
.GetDirectory("bin", configuration, "netcoreapp1.1", rid, "publish", $"{testAppName}{Constants.ExeSuffix}")
.FullName;
new TestCommand(outputProgram)
@ -85,7 +85,7 @@ namespace Microsoft.DotNet.Cli.Publish.Tests
string dir = "pkgs";
string args = $"--packages {dir}";
string newArgs = $"console -o \"{rootPath}\"";
string newArgs = $"console -f netcoreapp1.1 -o \"{rootPath}\"";
new NewCommandShim()
.WithWorkingDirectory(rootPath)
.Execute(newArgs)
@ -107,7 +107,7 @@ namespace Microsoft.DotNet.Cli.Publish.Tests
var configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug";
var outputProgram = rootDir
.GetDirectory("bin", configuration, "netcoreapp1.0", "publish", $"{rootDir.Name}.dll")
.GetDirectory("bin", configuration, "netcoreapp1.1", "publish", $"{rootDir.Name}.dll")
.FullName;
new TestCommand(outputProgram)

View file

@ -72,7 +72,7 @@ namespace Microsoft.DotNet.Cli.Run.Tests
new RunCommand()
.WithWorkingDirectory(testProjectDirectory)
.ExecuteWithCapturedOutput("--framework netcoreapp1.0")
.ExecuteWithCapturedOutput("--framework netcoreapp1.1")
.Should().Pass()
.And.HaveStdOutContaining("Hello World!");
}
@ -123,7 +123,7 @@ namespace Microsoft.DotNet.Cli.Run.Tests
string dir = "pkgs";
string args = $"--packages {dir}";
string newArgs = $"console -o \"{rootPath}\"";
string newArgs = $"console -f netcoreapp1.1 -o \"{rootPath}\"";
new NewCommandShim()
.WithWorkingDirectory(rootPath)
.Execute(newArgs)

View file

@ -87,7 +87,7 @@ namespace Microsoft.DotNet.Cli.Test.Tests
string configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug";
string expectedError = Path.Combine(testProjectDirectory, "bin",
configuration, "netcoreapp1.0", "VSTestDotNetCore.dll");
configuration, "netcoreapp1.1", "VSTestDotNetCore.dll");
expectedError = "The test source file " + "\"" + expectedError + "\"" + " provided was not found.";
// Call test

View file

@ -31,7 +31,7 @@ namespace Microsoft.DotNet.Cli.VSTest.Tests
.Should().Pass();
var outputDll = testRoot
.GetDirectory("bin", configuration, "netcoreapp1.0")
.GetDirectory("bin", configuration, "netcoreapp1.1")
.GetFile($"{testAppName}.dll");
var argsForVstest = $"\"{outputDll.FullName}\" {TestBase.ConsoleLoggerOutputNormal}";

View file

@ -109,7 +109,7 @@ namespace Microsoft.DotNet.Tests
.WithSourceFiles()
.WithRestoreFiles();
const string framework = ".NETCoreApp,Version=v1.0";
const string framework = ".NETCoreApp,Version=v1.1";
new BuildCommand()
.WithProjectDirectory(testInstance.Root)
@ -289,7 +289,7 @@ namespace Microsoft.DotNet.Tests
.WithRestoreFiles();
var assetsFile = new DirectoryInfo(new RepoDirectoriesProvider().NugetPackages)
.GetDirectory(".tools", "dotnet-portable", "1.0.0", "netcoreapp1.0")
.GetDirectory(".tools", "dotnet-portable", "1.0.0", "netcoreapp1.1")
.GetFile("project.assets.json");
var stopWatch = Stopwatch.StartNew();
@ -319,7 +319,7 @@ namespace Microsoft.DotNet.Tests
.WithRestoreFiles();
var assetsFile = new DirectoryInfo(new RepoDirectoriesProvider().NugetPackages)
.GetDirectory(".tools", "dotnet-portable", "1.0.0", "netcoreapp1.0")
.GetDirectory(".tools", "dotnet-portable", "1.0.0", "netcoreapp1.1")
.GetFile("project.assets.json");
var stopWatch = Stopwatch.StartNew();