diff --git a/TestAssets/DesktopTestProjects/AppWithProjTool2Fx/App.csproj b/TestAssets/DesktopTestProjects/AppWithProjTool2Fx/App.csproj index a5487baba..e8dc22e76 100644 --- a/TestAssets/DesktopTestProjects/AppWithProjTool2Fx/App.csproj +++ b/TestAssets/DesktopTestProjects/AppWithProjTool2Fx/App.csproj @@ -1,9 +1,10 @@  - netcoreapp1.0;net451 + netcoreapp1.1;net451 Exe - $(PackageTargetFallback);portable-net45+win8;dnxcore50 + $(PackageTargetFallback);portable-net45+win8;dnxcore50 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 + netcoreapp1.1 @@ -11,11 +12,6 @@ 1.0.0-* - - - 1.0.3 - - @@ -25,7 +21,4 @@ 1.0.0-* - - $(DefineConstants);RELEASE - \ No newline at end of file diff --git a/TestAssets/DesktopTestProjects/BindingRedirectSample/AppWithRedirectsAndConfig/AppWithRedirectsAndConfig.csproj b/TestAssets/DesktopTestProjects/BindingRedirectSample/AppWithRedirectsAndConfig/AppWithRedirectsAndConfig.csproj index 35f2ba2b2..a4e21096e 100644 --- a/TestAssets/DesktopTestProjects/BindingRedirectSample/AppWithRedirectsAndConfig/AppWithRedirectsAndConfig.csproj +++ b/TestAssets/DesktopTestProjects/BindingRedirectSample/AppWithRedirectsAndConfig/AppWithRedirectsAndConfig.csproj @@ -4,6 +4,7 @@ AppWithRedirectsAndConfig Exe win7-x64;win7-x86 + netcoreapp1.1 diff --git a/TestAssets/DesktopTestProjects/BindingRedirectSample/AppWithRedirectsNoConfig/AppWithRedirectsNoConfig.csproj b/TestAssets/DesktopTestProjects/BindingRedirectSample/AppWithRedirectsNoConfig/AppWithRedirectsNoConfig.csproj index dd8d8b537..deb339723 100644 --- a/TestAssets/DesktopTestProjects/BindingRedirectSample/AppWithRedirectsNoConfig/AppWithRedirectsNoConfig.csproj +++ b/TestAssets/DesktopTestProjects/BindingRedirectSample/AppWithRedirectsNoConfig/AppWithRedirectsNoConfig.csproj @@ -4,6 +4,7 @@ AppWithRedirectsNoConfig Exe win7-x64;win7-x86 + netcoreapp1.1 diff --git a/TestAssets/DesktopTestProjects/LibWithProjTool2Fx/Lib.csproj b/TestAssets/DesktopTestProjects/LibWithProjTool2Fx/Lib.csproj index e621006e9..478e8bcec 100644 --- a/TestAssets/DesktopTestProjects/LibWithProjTool2Fx/Lib.csproj +++ b/TestAssets/DesktopTestProjects/LibWithProjTool2Fx/Lib.csproj @@ -2,7 +2,8 @@ netstandard1.6;net451 Library - $(PackageTargetFallback);portable-net45+win8;dnxcore50;netcoreapp1.0 + $(PackageTargetFallback);portable-net45+win8;dnxcore50;netcoreapp1.1 + netcoreapp1.1 diff --git a/TestAssets/NonRestoredTestProjects/AppThrowingException/App/AppThrowingException.csproj b/TestAssets/NonRestoredTestProjects/AppThrowingException/App/AppThrowingException.csproj index 366798fca..cd5488919 100644 --- a/TestAssets/NonRestoredTestProjects/AppThrowingException/App/AppThrowingException.csproj +++ b/TestAssets/NonRestoredTestProjects/AppThrowingException/App/AppThrowingException.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp1.0 + netcoreapp1.1 dotnet-throwingtool $(AssemblyName) @@ -13,10 +13,4 @@ - - - 1.0.3 - - - diff --git a/TestAssets/NonRestoredTestProjects/AppThrowingException/AppDependingOnOtherAsTool/AppDependingOnOtherAsTool.csproj b/TestAssets/NonRestoredTestProjects/AppThrowingException/AppDependingOnOtherAsTool/AppDependingOnOtherAsTool.csproj index 04b137131..eca57f6ba 100644 --- a/TestAssets/NonRestoredTestProjects/AppThrowingException/AppDependingOnOtherAsTool/AppDependingOnOtherAsTool.csproj +++ b/TestAssets/NonRestoredTestProjects/AppThrowingException/AppDependingOnOtherAsTool/AppDependingOnOtherAsTool.csproj @@ -2,15 +2,10 @@ Exe - netcoreapp1.0 + netcoreapp1.1 + netcoreapp1.1 - - - 1.0.3 - - - 1.0.0 diff --git a/TestAssets/NonRestoredTestProjects/ToolWithRandomPackageName/AppWithDepOnTool/AppWithDepOnTool.csproj b/TestAssets/NonRestoredTestProjects/ToolWithRandomPackageName/AppWithDepOnTool/AppWithDepOnTool.csproj index de60f199d..0858955a9 100644 --- a/TestAssets/NonRestoredTestProjects/ToolWithRandomPackageName/AppWithDepOnTool/AppWithDepOnTool.csproj +++ b/TestAssets/NonRestoredTestProjects/ToolWithRandomPackageName/AppWithDepOnTool/AppWithDepOnTool.csproj @@ -2,12 +2,12 @@ Exe - netcoreapp1.0 + netcoreapp1.1 random-name + netcoreapp1.1 - 1.0.0 diff --git a/TestAssets/NonRestoredTestProjects/ToolWithRandomPackageName/ToolWithRandomPackageName/ToolWithRandomPackageName.csproj b/TestAssets/NonRestoredTestProjects/ToolWithRandomPackageName/ToolWithRandomPackageName/ToolWithRandomPackageName.csproj index 592c7bfcb..e5bc95294 100644 --- a/TestAssets/NonRestoredTestProjects/ToolWithRandomPackageName/ToolWithRandomPackageName/ToolWithRandomPackageName.csproj +++ b/TestAssets/NonRestoredTestProjects/ToolWithRandomPackageName/ToolWithRandomPackageName/ToolWithRandomPackageName.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp1.0 + netcoreapp1.1 random-name $(GeneratedPackageId) dotnet-randompackage @@ -14,8 +14,4 @@ - - - - diff --git a/TestAssets/TestPackages/ToolWithOutputName/ToolWithOutputName.csproj b/TestAssets/TestPackages/ToolWithOutputName/ToolWithOutputName.csproj index 59a2ee3db..6621ee746 100644 --- a/TestAssets/TestPackages/ToolWithOutputName/ToolWithOutputName.csproj +++ b/TestAssets/TestPackages/ToolWithOutputName/ToolWithOutputName.csproj @@ -1,6 +1,6 @@ - + - netcoreapp1.0 + netcoreapp1.1 dotnet-tool-with-output-name ToolWithOutputName Exe @@ -12,13 +12,4 @@ - - - 1.0.4 - - - - - $(DefineConstants);RELEASE - diff --git a/TestAssets/TestPackages/dotnet-dependency-tool-invoker/dotnet-dependency-tool-invoker.csproj b/TestAssets/TestPackages/dotnet-dependency-tool-invoker/dotnet-dependency-tool-invoker.csproj index 627218965..d5c8399c2 100644 --- a/TestAssets/TestPackages/dotnet-dependency-tool-invoker/dotnet-dependency-tool-invoker.csproj +++ b/TestAssets/TestPackages/dotnet-dependency-tool-invoker/dotnet-dependency-tool-invoker.csproj @@ -3,10 +3,11 @@ 1.0.0-rc - netcoreapp1.0 + netcoreapp1.1 dotnet-dependency-tool-invoker Exe - $(PackageTargetFallback);portable-net45+win8;dnxcore50 + $(PackageTargetFallback);portable-net45+win8;dnxcore50 + false @@ -22,9 +23,6 @@ - - 1.0.4 - $(CLI_NuGet_Version) @@ -32,8 +30,4 @@ $(SdkNugetVersion) - - - $(DefineConstants);RELEASE - diff --git a/TestAssets/TestPackages/dotnet-desktop-and-portable/dotnet-desktop-and-portable.csproj b/TestAssets/TestPackages/dotnet-desktop-and-portable/dotnet-desktop-and-portable.csproj index 41da0203f..016898139 100644 --- a/TestAssets/TestPackages/dotnet-desktop-and-portable/dotnet-desktop-and-portable.csproj +++ b/TestAssets/TestPackages/dotnet-desktop-and-portable/dotnet-desktop-and-portable.csproj @@ -1,24 +1,18 @@  1.0.0-rc - netcoreapp1.0;net451 + netcoreapp1.1;net451 dotnet-desktop-and-portable Exe win7-x64;win7-x86 - + $(ProjectRuntimeConfigFilePath) - - - 1.0.4 - - - diff --git a/TestAssets/TestPackages/dotnet-portable/dotnet-portable.csproj b/TestAssets/TestPackages/dotnet-portable/dotnet-portable.csproj index 65e89e284..3a9af687a 100644 --- a/TestAssets/TestPackages/dotnet-portable/dotnet-portable.csproj +++ b/TestAssets/TestPackages/dotnet-portable/dotnet-portable.csproj @@ -2,9 +2,10 @@ - netcoreapp1.0 + netcoreapp1.1 dotnet-portable Exe + false @@ -12,14 +13,4 @@ $(ProjectRuntimeConfigFilePath) - - - - 1.0.4 - - - - - $(DefineConstants);RELEASE - diff --git a/TestAssets/TestProjects/AppWithDepOnToolWithOutputName/AppWithDepOnToolWithOutputName.csproj b/TestAssets/TestProjects/AppWithDepOnToolWithOutputName/AppWithDepOnToolWithOutputName.csproj index 1c2ecdf95..3dd51b956 100755 --- a/TestAssets/TestProjects/AppWithDepOnToolWithOutputName/AppWithDepOnToolWithOutputName.csproj +++ b/TestAssets/TestProjects/AppWithDepOnToolWithOutputName/AppWithDepOnToolWithOutputName.csproj @@ -2,6 +2,7 @@ netcoreapp1.0 Exe + netcoreapp1.1 @@ -14,7 +15,4 @@ 1.0.0 - - $(DefineConstants);RELEASE - - \ No newline at end of file + diff --git a/TestAssets/TestProjects/AppWithDirectAndToolDep/AppWithDirectAndToolDep.csproj b/TestAssets/TestProjects/AppWithDirectAndToolDep/AppWithDirectAndToolDep.csproj index eb4dbed83..20673d265 100755 --- a/TestAssets/TestProjects/AppWithDirectAndToolDep/AppWithDirectAndToolDep.csproj +++ b/TestAssets/TestProjects/AppWithDirectAndToolDep/AppWithDirectAndToolDep.csproj @@ -2,6 +2,7 @@ netcoreapp1.1 Exe + netcoreapp1.1 @@ -17,7 +18,4 @@ 1.0.0 - - $(DefineConstants);RELEASE - - \ No newline at end of file + diff --git a/TestAssets/TestProjects/AppWithDirectDepWithOutputName/AppWithDirectDepWithOutputName.csproj b/TestAssets/TestProjects/AppWithDirectDepWithOutputName/AppWithDirectDepWithOutputName.csproj index 877cce870..d5d712460 100755 --- a/TestAssets/TestProjects/AppWithDirectDepWithOutputName/AppWithDirectDepWithOutputName.csproj +++ b/TestAssets/TestProjects/AppWithDirectDepWithOutputName/AppWithDirectDepWithOutputName.csproj @@ -1,23 +1,18 @@ - + - netcoreapp1.0 + netcoreapp1.1 Exe + netcoreapp1.1 1.0.0 - - 1.0.3 - 1.0.0-* - - $(DefineConstants);RELEASE - - \ No newline at end of file + diff --git a/TestAssets/TestProjects/AppWithMultipleFxAndTools/MSBuildAppWithMultipleFrameworksAndTools.csproj b/TestAssets/TestProjects/AppWithMultipleFxAndTools/MSBuildAppWithMultipleFrameworksAndTools.csproj index 8c58766c2..ce33c13c5 100644 --- a/TestAssets/TestProjects/AppWithMultipleFxAndTools/MSBuildAppWithMultipleFrameworksAndTools.csproj +++ b/TestAssets/TestProjects/AppWithMultipleFxAndTools/MSBuildAppWithMultipleFrameworksAndTools.csproj @@ -2,6 +2,7 @@ Exe net451;netcoreapp1.0 + netcoreapp1.1 diff --git a/TestAssets/TestProjects/AppWithToolDependency/AppWithToolDependency.csproj b/TestAssets/TestProjects/AppWithToolDependency/AppWithToolDependency.csproj index a5eb7a585..2c982a0ac 100755 --- a/TestAssets/TestProjects/AppWithToolDependency/AppWithToolDependency.csproj +++ b/TestAssets/TestProjects/AppWithToolDependency/AppWithToolDependency.csproj @@ -1,14 +1,10 @@  - netcoreapp1.0 + netcoreapp1.1 Exe + netcoreapp1.1 - - - 1.0.3 - - 1.0.0 @@ -17,7 +13,4 @@ 1.0.0 - - $(DefineConstants);RELEASE - - \ No newline at end of file + diff --git a/TestAssets/TestProjects/MSBuildAppWithMultipleFrameworksAndTools/MSBuildAppWithMultipleFrameworksAndTools.csproj b/TestAssets/TestProjects/MSBuildAppWithMultipleFrameworksAndTools/MSBuildAppWithMultipleFrameworksAndTools.csproj index 8c58766c2..ce33c13c5 100644 --- a/TestAssets/TestProjects/MSBuildAppWithMultipleFrameworksAndTools/MSBuildAppWithMultipleFrameworksAndTools.csproj +++ b/TestAssets/TestProjects/MSBuildAppWithMultipleFrameworksAndTools/MSBuildAppWithMultipleFrameworksAndTools.csproj @@ -2,6 +2,7 @@ Exe net451;netcoreapp1.0 + netcoreapp1.1 diff --git a/TestAssets/TestProjects/MSBuildTestApp/MSBuildTestApp.csproj b/TestAssets/TestProjects/MSBuildTestApp/MSBuildTestApp.csproj index f4bc3f4d1..f616e532d 100644 --- a/TestAssets/TestProjects/MSBuildTestApp/MSBuildTestApp.csproj +++ b/TestAssets/TestProjects/MSBuildTestApp/MSBuildTestApp.csproj @@ -1,8 +1,9 @@ Exe - netcoreapp1.0 - 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 + netcoreapp1.1 + 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 + netcoreapp1.1 diff --git a/TestAssets/TestProjects/TestAppWithProjDepTool/TestAppWithProjDepTool.csproj b/TestAssets/TestProjects/TestAppWithProjDepTool/TestAppWithProjDepTool.csproj index f252d7975..7df4efa22 100644 --- a/TestAssets/TestProjects/TestAppWithProjDepTool/TestAppWithProjDepTool.csproj +++ b/TestAssets/TestProjects/TestAppWithProjDepTool/TestAppWithProjDepTool.csproj @@ -1,13 +1,11 @@ - + Exe - netcoreapp1.0 + netcoreapp1.1 + netcoreapp1.1 - - 1.0.3 - 1.0.0 All diff --git a/TestAssets/TestProjects/VSTestDotNetCore/VSTestDotNetCore.csproj b/TestAssets/TestProjects/VSTestDotNetCore/VSTestDotNetCore.csproj index 97230db7a..e8bf2f08b 100644 --- a/TestAssets/TestProjects/VSTestDotNetCore/VSTestDotNetCore.csproj +++ b/TestAssets/TestProjects/VSTestDotNetCore/VSTestDotNetCore.csproj @@ -2,13 +2,11 @@ Exe - netcoreapp1.0 + netcoreapp1.1 + false - - 1.0.3 - 1.0.6-preview diff --git a/TestAssets/TestProjects/VSTestXunitDotNetCore/VSTestXunitDotNetCore.csproj b/TestAssets/TestProjects/VSTestXunitDotNetCore/VSTestXunitDotNetCore.csproj index 491c84b0b..09f5f8a56 100644 --- a/TestAssets/TestProjects/VSTestXunitDotNetCore/VSTestXunitDotNetCore.csproj +++ b/TestAssets/TestProjects/VSTestXunitDotNetCore/VSTestXunitDotNetCore.csproj @@ -2,13 +2,11 @@ Exe - netcoreapp1.0 + netcoreapp1.1 + false - - 1.0.3 - $(CLI_TestPlatform_Version) diff --git a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/IProject.cs b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/IProject.cs index 89d22bbbf..18fddedb1 100644 --- a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/IProject.cs +++ b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/IProject.cs @@ -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 EnvironmentVariables { get; } } } \ No newline at end of file diff --git a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/MSBuildProject.cs b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/MSBuildProject.cs index 4b6cda0e4..3969e9aa8 100644 --- a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/MSBuildProject.cs +++ b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/MSBuildProject.cs @@ -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 EnvironmentVariables { get diff --git a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectToolsCommandResolver.cs b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectToolsCommandResolver.cs index d3dd03ce6..0e7a48beb 100644 --- a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectToolsCommandResolver.cs +++ b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectToolsCommandResolver.cs @@ -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 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)) diff --git a/test/EndToEnd/GivenDotNetUsesMSBuild.cs b/test/EndToEnd/GivenDotNetUsesMSBuild.cs index 2e08f9891..e8eb1056c 100644 --- a/test/EndToEnd/GivenDotNetUsesMSBuild.cs +++ b/test/EndToEnd/GivenDotNetUsesMSBuild.cs @@ -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!");; } diff --git a/test/Microsoft.DotNet.Cli.Utils.Tests/GivenAProjectDependenciesCommandFactory.cs b/test/Microsoft.DotNet.Cli.Utils.Tests/GivenAProjectDependenciesCommandFactory.cs index ba8194a21..acb2c7b33 100644 --- a/test/Microsoft.DotNet.Cli.Utils.Tests/GivenAProjectDependenciesCommandFactory.cs +++ b/test/Microsoft.DotNet.Cli.Utils.Tests/GivenAProjectDependenciesCommandFactory.cs @@ -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")); } } } diff --git a/test/Microsoft.DotNet.Cli.Utils.Tests/GivenAProjectDependencyCommandResolver.cs b/test/Microsoft.DotNet.Cli.Utils.Tests/GivenAProjectDependencyCommandResolver.cs index cd0d47d4a..54bd5b49f 100644 --- a/test/Microsoft.DotNet.Cli.Utils.Tests/GivenAProjectDependencyCommandResolver.cs +++ b/test/Microsoft.DotNet.Cli.Utils.Tests/GivenAProjectDependencyCommandResolver.cs @@ -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 }; diff --git a/test/Microsoft.DotNet.Cli.Utils.Tests/GivenAProjectToolsCommandResolver.cs b/test/Microsoft.DotNet.Cli.Utils.Tests/GivenAProjectToolsCommandResolver.cs index 92b4970c1..44ce24766 100644 --- a/test/Microsoft.DotNet.Cli.Utils.Tests/GivenAProjectToolsCommandResolver.cs +++ b/test/Microsoft.DotNet.Cli.Utils.Tests/GivenAProjectToolsCommandResolver.cs @@ -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())); diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/EnvironmentInfo.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/EnvironmentInfo.cs new file mode 100644 index 000000000..a99c8ef60 --- /dev/null +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/EnvironmentInfo.cs @@ -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; + } + } +} \ No newline at end of file diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/RequiresSpecificFrameworkFactAttribute.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/RequiresSpecificFrameworkFactAttribute.cs new file mode 100644 index 000000000..30712d5bc --- /dev/null +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/RequiresSpecificFrameworkFactAttribute.cs @@ -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}"; + } + } + } +} \ No newline at end of file diff --git a/test/dotnet-build.Tests/GivenDotnetBuildBuildsCsproj.cs b/test/dotnet-build.Tests/GivenDotnetBuildBuildsCsproj.cs index 781f7c985..3ab1a0d36 100644 --- a/test/dotnet-build.Tests/GivenDotnetBuildBuildsCsproj.cs +++ b/test/dotnet-build.Tests/GivenDotnetBuildBuildsCsproj.cs @@ -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"); diff --git a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateDeprecatedProjects.cs b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateDeprecatedProjects.cs index 5c6813bc8..92b05a9f7 100644 --- a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateDeprecatedProjects.cs +++ b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateDeprecatedProjects.cs @@ -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"); diff --git a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateTestApps.cs b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateTestApps.cs index 339019b29..f9d4aba1d 100644 --- a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateTestApps.cs +++ b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateTestApps.cs @@ -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 diff --git a/test/dotnet-new.Tests/GivenThatIWantANewAppWithSpecifiedType.cs b/test/dotnet-new.Tests/GivenThatIWantANewAppWithSpecifiedType.cs index 3588bc3fc..d631abdf0 100644 --- a/test/dotnet-new.Tests/GivenThatIWantANewAppWithSpecifiedType.cs +++ b/test/dotnet-new.Tests/GivenThatIWantANewAppWithSpecifiedType.cs @@ -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 } diff --git a/test/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs b/test/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs index 13d5374d2..620d6973b 100644 --- a/test/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs +++ b/test/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs @@ -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) diff --git a/test/dotnet-run.Tests/GivenDotnetRunRunsCsProj.cs b/test/dotnet-run.Tests/GivenDotnetRunRunsCsProj.cs index 2ef0f627f..0d7f90004 100644 --- a/test/dotnet-run.Tests/GivenDotnetRunRunsCsProj.cs +++ b/test/dotnet-run.Tests/GivenDotnetRunRunsCsProj.cs @@ -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) diff --git a/test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs b/test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs index 402ea295a..9fabcff33 100644 --- a/test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs +++ b/test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs @@ -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 diff --git a/test/dotnet-vstest.Tests/VSTestTests.cs b/test/dotnet-vstest.Tests/VSTestTests.cs index 3c85c2c7b..65aad1f89 100644 --- a/test/dotnet-vstest.Tests/VSTestTests.cs +++ b/test/dotnet-vstest.Tests/VSTestTests.cs @@ -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}"; diff --git a/test/dotnet.Tests/PackagedCommandTests.cs b/test/dotnet.Tests/PackagedCommandTests.cs index 52d58a9e7..f097f6891 100644 --- a/test/dotnet.Tests/PackagedCommandTests.cs +++ b/test/dotnet.Tests/PackagedCommandTests.cs @@ -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();