Merge pull request #4369 from eerhardt/SingleTFM

Move all CLI libraries to be single-TFM targeting netstandard1.3 where possible.
This commit is contained in:
Eric Erhardt 2016-10-11 20:59:48 -05:00 committed by GitHub
commit ea092717ac
40 changed files with 139 additions and 220 deletions

View file

@ -15,7 +15,7 @@
"dotnet-desktop-binding-redirects": "1.0.0-*"
},
"frameworks": {
"net451": {}
"net46": {}
},
"tools": {
"dotnet-dependency-tool-invoker": {

View file

@ -15,7 +15,7 @@
"dotnet-desktop-binding-redirects": "1.0.0-*"
},
"frameworks": {
"net451": {}
"net46": {}
},
"tools": {
"dotnet-dependency-tool-invoker": {

View file

@ -1,21 +0,0 @@
using System;
using Microsoft.DotNet.Cli.Utils;
using System.IO;
namespace DesktopAppWhichCallsDotnet
{
public class Program
{
public static int Main(string[] args)
{
var projectPath = args[0];
return Command.CreateDotNet("build", new string[] {})
.WorkingDirectory(Path.GetDirectoryName(projectPath))
.ForwardStdErr()
.ForwardStdOut()
.Execute()
.ExitCode;
}
}
}

View file

@ -1,14 +0,0 @@
{
"version": "1.0.0-*",
"dependencies": {
"Microsoft.DotNet.Cli.Utils": {
"target": "project"
}
},
"buildOptions": {
"emitEntryPoint": true
},
"frameworks": {
"net451": {}
}
}

View file

@ -8,14 +8,14 @@ namespace FakeTests
{
public class GivenThatIWantSomeFakeTests
{
#if NET451
#if NET46
[Fact]
public void NET451_succeeds()
public void NET46_succeeds()
{
Assert.True(true);
}
[Fact(Skip="Skipped for NET451")]
[Fact(Skip="Skipped for NET46")]
public void SkippedTest()
{
@ -45,8 +45,8 @@ namespace FakeTests
{
var shouldFail = string.IsNullOrEmpty(Environment.GetEnvironmentVariable("DOTNET_TEST_SHOULD_FAIL"));
#if NET451
Assert.True(shouldFail, "Failing in NET451");
#if NET46
Assert.True(shouldFail, "Failing in NET46");
#else
Assert.True(shouldFail, "Failing in NETCOREAPP1.0");
#endif

View file

@ -20,7 +20,11 @@
"System.Runtime.Serialization.Primitives": "4.1.1"
}
},
"net451": {}
"net46": {
"dependencies": {
"System.IO.FileSystem": "4.0.1"
}
}
},
"testRunner": "xunit"
}

View file

@ -175,7 +175,7 @@
<Message Text="%(NoAutoBuildDesktopTestAssetProjects.FullPath)" />
<DotNetBuild Configuration="$(Configuration)"
Framework="net451"
Framework="net46"
ProjectPath="%(BuildableDesktopTestAssetProjects.FullPath)"
ToolPath="$(DotnetUnderTest)"
WorkingDirectory="%(BuildableDesktopTestAssetProjects.RelativeDir)" />

View file

@ -159,7 +159,7 @@
<VersionPrefix>1.0.0-preview3-</VersionPrefix>
<VersionSuffix>$(TestPackageBuildVersionSuffix)</VersionSuffix>
<Clean>False</Clean>
<Frameworks>net451;netstandard1.6</Frameworks>
<Frameworks>netstandard1.3</Frameworks>
</BaseTestPackageProject>
<BaseTestPackageProject Include="src/Microsoft.DotNet.ProjectModel">
<Name>Microsoft.DotNet.ProjectModel</Name>
@ -168,7 +168,7 @@
<VersionPrefix>1.0.0-rc4-</VersionPrefix>
<VersionSuffix>$(TestPackageBuildVersionSuffix)</VersionSuffix>
<Clean>False</Clean>
<Frameworks>net451;netstandard1.6</Frameworks>
<Frameworks>netstandard1.3</Frameworks>
</BaseTestPackageProject>
<BaseTestPackageProject Include="src/Microsoft.DotNet.ProjectModel.Loader">
<Name>Microsoft.DotNet.ProjectModel.Loader</Name>
@ -186,7 +186,7 @@
<VersionPrefix>1.0.0-preview3-</VersionPrefix>
<VersionSuffix>$(TestPackageBuildVersionSuffix)</VersionSuffix>
<Clean>False</Clean>
<Frameworks>netstandard1.6</Frameworks>
<Frameworks>netstandard1.3</Frameworks>
</BaseTestPackageProject>
<BaseTestPackageProject Include="src/Microsoft.DotNet.InternalAbstractions">
<Name>Microsoft.DotNet.InternalAbstractions</Name>
@ -195,7 +195,7 @@
<VersionPrefix>1.0.1-beta-</VersionPrefix>
<VersionSuffix>$(TestPackageBuildVersionSuffix)</VersionSuffix>
<Clean>False</Clean>
<Frameworks>net451;netstandard1.3</Frameworks>
<Frameworks>netstandard1.3</Frameworks>
</BaseTestPackageProject>
<BaseTestPackageProject Include="src/Microsoft.Extensions.Testing.Abstractions">
<Name>Microsoft.Extensions.Testing.Abstractions</Name>
@ -204,7 +204,7 @@
<VersionPrefix>1.0.0-preview3-</VersionPrefix>
<VersionSuffix>$(TestPackageBuildVersionSuffix)</VersionSuffix>
<Clean>False</Clean>
<Frameworks>net451;netstandard1.6</Frameworks>
<Frameworks>netstandard1.3</Frameworks>
</BaseTestPackageProject>
<BaseTestPackageProject Include="src/Microsoft.DotNet.Compiler.Common">
<Name>Microsoft.DotNet.Compiler.Common</Name>
@ -213,7 +213,7 @@
<VersionPrefix>1.0.0-preview3-</VersionPrefix>
<VersionSuffix>$(TestPackageBuildVersionSuffix)</VersionSuffix>
<Clean>False</Clean>
<Frameworks>netstandard1.6</Frameworks>
<Frameworks>netstandard1.3</Frameworks>
</BaseTestPackageProject>
<BaseTestPackageProject Include="src/Microsoft.DotNet.Files">
<Name>Microsoft.DotNet.Files</Name>
@ -222,7 +222,7 @@
<VersionPrefix>1.0.0-preview3-</VersionPrefix>
<VersionSuffix>$(TestPackageBuildVersionSuffix)</VersionSuffix>
<Clean>False</Clean>
<Frameworks>netstandard1.6</Frameworks>
<Frameworks>netstandard1.3</Frameworks>
</BaseTestPackageProject>
<TestPackageProjectFrameworksExcludes Condition=" '$(IsDesktopAvailable)' != 'True' " Include="net45" />

View file

@ -83,7 +83,7 @@
</TestProjects>
<TestProjects Condition=" '%(RelativeDir)' == 'test\binding-redirects.Tests\' ">
<Framework>net451</Framework>
<Framework>net46</Framework>
</TestProjects>
<TestProjects Condition=" '%(RelativeDir)' == 'test\Installer\Microsoft.DotNet.Cli.Msi.Tests\' ">
<Framework>net46</Framework>

View file

@ -80,7 +80,7 @@ namespace Microsoft.DotNet.Cli.Utils
var projectContext = ProjectContext.Create(
projectRootPath,
framework,
DotnetRuntimeIdentifiers.InferCurrentRuntimeIdentifiers());
RuntimeEnvironmentRidExtensions.GetAllCandidateRuntimeIdentifiers());
if (projectContext.RuntimeIdentifier == null)
{

View file

@ -142,8 +142,7 @@ namespace Microsoft.DotNet.Cli.Utils
return ProjectContext.Create(
projectRootPath,
framework,
DotnetRuntimeIdentifiers.InferCurrentRuntimeIdentifiers());
RuntimeEnvironmentRidExtensions.GetAllCandidateRuntimeIdentifiers());
}
private IEnumerable<string> GetAllowedCommandExtensionsFromEnvironment(IEnvironmentProvider environment)

View file

@ -8,7 +8,7 @@ namespace Microsoft.DotNet.Cli.Utils
{
internal static class DotnetRuntimeIdentifiers
{
public static IEnumerable<string> InferCurrentRuntimeIdentifiers()
public static IEnumerable<string> InferCurrentRuntimeIdentifiers(DotnetVersionFile versionFile)
{
IEnumerable<string> fallbackIdentifiers = null;
@ -22,7 +22,7 @@ namespace Microsoft.DotNet.Cli.Utils
FrameworkDependencyFile fxDepsFile = new FrameworkDependencyFile();
if (!fxDepsFile.SupportsCurrentRuntime())
{
string buildRid = DotnetFiles.VersionFileObject.BuildRid;
string buildRid = versionFile.BuildRid;
if (!string.IsNullOrEmpty(buildRid))
{
fallbackIdentifiers = new string[] { buildRid };

View file

@ -15,14 +15,7 @@
"NuGet.ProjectModel": "3.6.0-rc-1954"
},
"frameworks": {
"net451": {
"frameworkAssemblies": {
"System.Runtime": {
"type": "build"
}
}
},
"netstandard1.6": {
"netstandard1.3": {
"imports": [
"portable-net45+wp80+win8+wpa81+dnxcore50"
],

View file

@ -17,26 +17,7 @@
"NuGet.ProjectModel": "3.6.0-rc-1954"
},
"frameworks": {
"net451": {
"frameworkAssemblies": {
"System.Runtime": {
"type": "build"
},
"System.Collections": {
"type": "build"
},
"System.IO": {
"type": "build"
},
"System.Threading.Tasks": {
"type": "build"
},
"System.Text.Encoding": {
"type": "build"
}
}
},
"netstandard1.6": {
"netstandard1.3": {
"imports": [
"portable-net45+wp80+win8+wpa81+dnxcore50"
]

View file

@ -1,7 +1,8 @@
// 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.Cli.Utils;
using System;
using System.IO;
using Microsoft.DotNet.Archive;
using Microsoft.Extensions.EnvironmentAbstractions;
@ -11,8 +12,9 @@ namespace Microsoft.DotNet.Configurer
{
private ITemporaryDirectory _temporaryDirectory;
public string NuGetPackagesArchive => DotnetFiles.NuGetPackagesArchive;
public string NuGetPackagesArchive =>
Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "nuGetPackagesArchive.lzma"));
public NuGetPackagesArchiver() : this(FileSystemWrapper.Default.Directory)
{
}

View file

@ -14,20 +14,7 @@
"System.Linq.Expressions": "4.1.0"
},
"frameworks": {
"net451": {
"frameworkAssemblies": {
"System.Runtime": {
"type": "build"
},
"System.Collections": {
"type": "build"
},
"System.IO": {
"type": "build"
}
}
},
"netstandard1.6": {
"netstandard1.3": {
"imports": [
"portable-net45+wp80+win8+wpa81+dnxcore50"
]

View file

@ -7,7 +7,6 @@
"allowUnsafe": true
},
"frameworks": {
"net451": {},
"netstandard1.3": {
"dependencies": {
"System.AppContext": "4.1.0",

View file

@ -14,20 +14,7 @@
"Microsoft.DotNet.PlatformAbstractions": "1.0.1-beta-000933"
},
"frameworks": {
"net451": {
"frameworkAssemblies": {
"System.Runtime": {
"type": "build"
},
"System.Collections": {
"type": "build"
},
"System.IO": {
"type": "build"
}
}
},
"netstandard1.6": {
"netstandard1.3": {
"imports": [
"portable-net45+wp80+win8+wpa81+dnxcore50",
"portable-net45+win8"

View file

@ -2,7 +2,10 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#if !NET451
using System.Runtime.Loader;
using System;
using System.IO;
using System.Reflection.Metadata;
using System.Reflection.PortableExecutable;
#endif
using System.Reflection;
using System.Text;
@ -22,10 +25,42 @@ namespace Microsoft.DotNet.ProjectModel.Utilities
#if NET451
return new NuGetVersion(AssemblyName.GetAssemblyName(path).Version);
#else
return new NuGetVersion(AssemblyLoadContext.GetAssemblyName(path).Version);
return new NuGetVersion(GetAssemblyVersionPrivate(path));
#endif
}
#if !NET451
private static Version GetAssemblyVersionPrivate(string assemblyPath)
{
using (var fileStream = new FileStream(assemblyPath, FileMode.Open, FileAccess.Read, FileShare.Delete | FileShare.Read))
{
return GetAssemblyVersionPrivate(fileStream);
}
}
private static Version GetAssemblyVersionPrivate(Stream assemblyStream)
{
Version result = null;
try
{
using (PEReader peReader = new PEReader(assemblyStream, PEStreamOptions.LeaveOpen))
{
if (peReader.HasMetadata)
{
MetadataReader reader = peReader.GetMetadataReader();
result = reader.GetAssemblyDefinition().Version;
}
}
}
catch (BadImageFormatException)
{
// not a PE
}
return result;
}
#endif
public static string RenderVersion(VersionRange range)
{
if (range == null)
@ -50,7 +85,7 @@ namespace Microsoft.DotNet.ProjectModel.Utilities
// Work around nuget bug: https://github.com/NuGet/Home/issues/1598
// sb.AppendFormat("{0}-*", range.MinVersion);
sb.Append($"{range.MinVersion.Version.Major}.{range.MinVersion.Version.Minor}.{range.MinVersion.Version.Build}");
if (string.IsNullOrEmpty(range.MinVersion.Release) ||
if (string.IsNullOrEmpty(range.MinVersion.Release) ||
string.Equals("-", range.MinVersion.Release))
{
sb.Append($"-*");

View file

@ -15,20 +15,7 @@
"System.Reflection.Metadata": "1.4.1-beta-24410-02"
},
"frameworks": {
"net451": {
"frameworkAssemblies": {
"System.Runtime": {
"type": "build"
},
"System.Collections": {
"type": "build"
},
"System.IO": {
"type": "build"
}
}
},
"netstandard1.6": {
"netstandard1.3": {
"imports": [
"portable-net45+wp80+win8+wpa81+dnxcore50",
"dotnet5.4"
@ -36,7 +23,6 @@
"dependencies": {
"Microsoft.CSharp": "4.0.1",
"System.Dynamic.Runtime": "4.0.11",
"System.Runtime.Loader": "4.0.0",
"System.Runtime.Serialization.Primitives": "4.1.1",
"System.Security.Cryptography.Algorithms": "4.2.0",
"System.Threading.Thread": "4.0.0",

View file

@ -10,12 +10,11 @@
}
},
"frameworks": {
"netstandard1.6": {
"netstandard1.3": {
"imports": [
"portable-net45+wp80+win8+wpa81+dnxcore50"
]
},
"net451": {}
}
},
"packOptions": {
"projectUrl": "",

View file

@ -3,9 +3,10 @@
using System;
using System.IO;
using System.Linq;
using Microsoft.DotNet.Cli;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.ProjectModel;
using System.Linq;
using NuGet.Frameworks;
namespace Microsoft.DotNet.Tools.Test
@ -27,7 +28,7 @@ namespace Microsoft.DotNet.Tools.Test
var projectPath = GetProjectPath(dotnetTestParams.ProjectOrAssemblyPath);
var runtimeIdentifiers = !string.IsNullOrEmpty(dotnetTestParams.Runtime)
? new[] {dotnetTestParams.Runtime}
: DotnetRuntimeIdentifiers.InferCurrentRuntimeIdentifiers();
: DotnetRuntimeIdentifiers.InferCurrentRuntimeIdentifiers(DotnetFiles.VersionFileObject);
var exitCode = 0;
// Create a workspace

View file

@ -5,7 +5,8 @@
"compile": {
"include": [
"**/*.cs",
"../dotnet/CommandLine/*.cs"
"../dotnet/CommandLine/*.cs",
"../dotnet/DotnetFiles.cs"
]
}
},

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;
using System.Reflection;
using System.Reflection.Metadata;
using System.Reflection.Metadata.Ecma335;
@ -9,15 +10,11 @@ namespace Microsoft.Extensions.Testing.Abstractions
{
internal static class MetadataExtensions
{
private static PropertyInfo s_methodInfoMethodTokenProperty = typeof(MethodInfo).GetProperty("MethodToken");
internal static int GetMethodToken(this MethodInfo methodInfo)
{
#if NETSTANDARD1_3
var methodToken = methodInfo.GetMetadataToken();
#else
var methodToken = methodInfo.MetadataToken;
#endif
return methodToken;
return (int)s_methodInfoMethodTokenProperty.GetValue(methodInfo);
}
internal static MethodDebugInformationHandle GetMethodDebugInformationHandle(this MethodInfo methodInfo)

View file

@ -16,8 +16,7 @@
"System.Reflection.Metadata": "1.4.1-beta-24426-02"
},
"frameworks": {
"net451": {},
"netstandard1.6": {
"netstandard1.3": {
"imports": [
"portable-net45+wp80+win8+wpa81+dnxcore50",
"portable-net45+win8"

View file

@ -4,11 +4,12 @@
using System;
using System.IO;
using System.Reflection;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.PlatformAbstractions;
namespace Microsoft.DotNet.Cli.Utils
namespace Microsoft.DotNet.Cli
{
public static class DotnetFiles
internal static class DotnetFiles
{
private static string SdkRootFolder => Path.Combine(typeof(DotnetFiles).GetTypeInfo().Assembly.Location, "..");
@ -25,9 +26,6 @@ namespace Microsoft.DotNet.Cli.Utils
get { return s_versionFileObject.Value; }
}
public static string NuGetPackagesArchive =>
Path.GetFullPath(Path.Combine(SdkRootFolder, "nuGetPackagesArchive.lzma"));
/// <summary>
/// Reads the version file and adds runtime specific information
/// </summary>

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 Microsoft.DotNet.Cli;
using Microsoft.DotNet.Cli.CommandLine;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.InternalAbstractions;
@ -131,7 +132,7 @@ namespace Microsoft.DotNet.Tools.Compiler
var rids = new List<string>();
if (string.IsNullOrEmpty(RuntimeValue))
{
return DotnetRuntimeIdentifiers.InferCurrentRuntimeIdentifiers();
return DotnetRuntimeIdentifiers.InferCurrentRuntimeIdentifiers(DotnetFiles.VersionFileObject);
}
else
{

View file

@ -5,8 +5,8 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Microsoft.DotNet.Cli;
using Microsoft.DotNet.Cli.Compiler.Common;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.Tools.Compiler;
namespace Microsoft.DotNet.Tools.Build

View file

@ -5,6 +5,7 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Microsoft.DotNet.Cli;
using Microsoft.DotNet.Cli.Compiler.Common;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.Files;
@ -414,7 +415,7 @@ namespace Microsoft.DotNet.Tools.Publish
contexts.Where(c => Equals(c.TargetFramework, framework));
var rids = string.IsNullOrEmpty(runtime) ?
DotnetRuntimeIdentifiers.InferCurrentRuntimeIdentifiers() :
DotnetRuntimeIdentifiers.InferCurrentRuntimeIdentifiers(DotnetFiles.VersionFileObject) :
new[] { runtime };
return contexts.Select(c => Workspace.GetRuntimeContext(c, rids));

View file

@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using Microsoft.DotNet.Cli;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.InternalAbstractions;
using Microsoft.DotNet.ProjectModel;
@ -83,7 +84,7 @@ namespace Microsoft.DotNet.Tools.Run
.EnsureValid(Project)
.FrameworkOnlyContexts;
var rids = DotnetRuntimeIdentifiers.InferCurrentRuntimeIdentifiers();
var rids = DotnetRuntimeIdentifiers.InferCurrentRuntimeIdentifiers(DotnetFiles.VersionFileObject);
ProjectContext frameworkContext;
if (Framework == null)

View file

@ -1,35 +0,0 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.IO;
using Microsoft.DotNet.Tools.Test.Utilities;
using FluentAssertions;
namespace Microsoft.DotNet.Cli.Utils.Tests
{
public class GivenADesktopAppWhichUsesCommandCreateDotnet : TestBase
{
[WindowsOnlyFact]
public void It_calls_dotnet_build_on_a_project_successfully()
{
var testAssetsManager = GetTestGroupTestAssetsManager("DesktopTestProjects");
var testInstance = testAssetsManager
.CreateTestInstance("DesktopAppWhichCallsDotnet")
.WithLockFiles()
.WithBuildArtifacts();
// project was moved to another location and needs it's relative path to Utils project restored
new RestoreCommand().Execute(testInstance.TestRoot).Should().Pass();
var testProjectAssetManager = GetTestGroupTestAssetsManager("TestProjects");
var testInstanceToBuild = testProjectAssetManager
.CreateTestInstance("TestAppSimple")
.WithLockFiles();
var testProject = Path.Combine(testInstance.TestRoot, "project.json");
var testProjectToBuild = Path.Combine(testInstanceToBuild.TestRoot, "project.json");
new RunCommand(testProject).Execute(testProjectToBuild).Should().Pass();
}
}
}

View file

@ -4,6 +4,7 @@
using System;
using System.IO;
using FluentAssertions;
using Microsoft.DotNet.Cli;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.InternalAbstractions;
using Microsoft.DotNet.ProjectModel;
@ -228,7 +229,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
var projectContext = ProjectContext.Create(
testInstance.Path,
FrameworkConstants.CommonFrameworks.NetCoreApp10,
DotnetRuntimeIdentifiers.InferCurrentRuntimeIdentifiers());
DotnetRuntimeIdentifiers.InferCurrentRuntimeIdentifiers(DotnetFiles.VersionFileObject));
var depsFilePath =
projectContext.GetOutputPaths("Debug", outputPath: outputDir).RuntimeFiles.DepsJson;
@ -268,7 +269,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
var projectContext = ProjectContext.Create(
testInstance.Path,
FrameworkConstants.CommonFrameworks.NetCoreApp10,
DotnetRuntimeIdentifiers.InferCurrentRuntimeIdentifiers());
DotnetRuntimeIdentifiers.InferCurrentRuntimeIdentifiers(DotnetFiles.VersionFileObject));
var depsFilePath =
projectContext.GetOutputPaths("Debug", buildBasePath).RuntimeFiles.DepsJson;

View file

@ -3,6 +3,12 @@
"buildOptions": {
"emitEntryPoint": true,
"keyFile": "../../tools/Key.snk",
"compile": {
"include": [
"**/*.cs",
"../../src/dotnet/DotnetFiles.cs"
]
},
"copyToOutput": {
"include": [
"../../TestAssets/TestProjects/OutputStandardOutputAndError/*",

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 Microsoft.DotNet.Cli;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.InternalAbstractions;
using Microsoft.DotNet.PlatformAbstractions;

View file

@ -2,7 +2,14 @@
"version": "1.0.0-*",
"description": "Microsoft.DotNet.Tools.Tests.Utilities Class Library",
"buildOptions": {
"keyFile": "../../tools/Key.snk"
"keyFile": "../../tools/Key.snk",
"compile": {
"include": [
"**/*.cs",
"../../src/dotnet/DotnetFiles.cs"
]
}
},
"dependencies": {
"FluentAssertions": "4.0.0",
@ -30,7 +37,7 @@
"System.Collections.Immutable": "1.2.0-rc2-24022",
"System.Net.NetworkInformation": "4.1.0-rc2-24022"
},
"net451": {
"net46": {
"frameworkAssemblies": {
"System.Runtime": {
"type": "build"

View file

@ -237,7 +237,7 @@ namespace Microsoft.DotNet.Tests
public void Tool_Command_Runs_Executable_Dependency_For_App_With_Config()
{
var commandResult = new DependencyToolInvokerCommand { WorkingDirectory = _appWithConfigProjectRoot }
.Execute("desktop-binding-redirects", "net451", "");
.Execute("desktop-binding-redirects", "net46", "");
commandResult.Should().Pass();
}
@ -246,7 +246,7 @@ namespace Microsoft.DotNet.Tests
{
var appDirectory = Path.GetDirectoryName(_appWithoutConfigProjectRoot);
var commandResult = new DependencyToolInvokerCommand { WorkingDirectory = _appWithoutConfigProjectRoot }
.Execute("desktop-binding-redirects", "net451", "");
.Execute("desktop-binding-redirects", "net46", "");
commandResult.Should().Pass();
}
}

View file

@ -10,7 +10,7 @@ namespace Microsoft.DotNet.Tests
{
public class TestSetupFixture : TestBase
{
private const string Framework = "net451";
private const string Framework = "net46";
private const string Config = "Debug";
private const string AppWithConfig = "AppWithRedirectsAndConfig";
private const string AppWithoutConfig = "AppWithRedirectsNoConfig";

View file

@ -9,9 +9,12 @@
}
},
"frameworks": {
"net451": {
"net46": {
"frameworkAssemblies": {
"System.Configuration": ""
},
"dependencies": {
"System.Console": "4.0.0"
}
}
},

View file

@ -17,7 +17,7 @@ namespace Microsoft.Dotnet.Tools.Test.Tests
{
private readonly string _projectFilePath;
private readonly string _defaultNetCoreAppOutputPath;
private readonly string _defaultNet451OutputPath;
private readonly string _defaultNet46OutputPath;
public GivenThatWeWantToRunTestsForMultipleTFMsInTheConsole()
{
@ -36,7 +36,7 @@ namespace Microsoft.Dotnet.Tools.Test.Tests
new RestoreCommand() { WorkingDirectory = testInstance.TestRoot }.Execute().Should().Pass();
_defaultNetCoreAppOutputPath = Path.Combine(testInstance.TestRoot, "bin", "Debug", "netcoreapp1.0");
_defaultNet451OutputPath = Path.Combine(testInstance.TestRoot, "bin", "Debug", "net451", RuntimeEnvironmentRidExtensions.GetAllCandidateRuntimeIdentifiers().First());
_defaultNet46OutputPath = Path.Combine(testInstance.TestRoot, "bin", "Debug", "net46", RuntimeEnvironmentRidExtensions.GetAllCandidateRuntimeIdentifiers().First());
}
[WindowsOnlyFact]
@ -46,18 +46,18 @@ namespace Microsoft.Dotnet.Tools.Test.Tests
var result = testCommand
.ExecuteWithCapturedOutput($"{_projectFilePath}");
result.Should().Pass();
result.StdOut.Should().Contain("Skipped for NET451");
result.StdOut.Should().Contain("Skipped for NET46");
result.StdOut.Should().Contain("Skipped for NETCOREAPP1.0");
}
[WindowsOnlyFact]
public void It_builds_and_runs_tests_for_net451()
public void It_builds_and_runs_tests_for_net46()
{
var testCommand = new DotnetTestCommand();
var result = testCommand
.ExecuteWithCapturedOutput($"{_projectFilePath} -f net451");
.ExecuteWithCapturedOutput($"{_projectFilePath} -f net46");
result.Should().Pass();
result.StdOut.Should().Contain($"Skipped for NET451");
result.StdOut.Should().Contain($"Skipped for NET46");
result.StdOut.Should().NotContain($"Skipped for NETCOREAPP1.0");
}
@ -69,7 +69,7 @@ namespace Microsoft.Dotnet.Tools.Test.Tests
.ExecuteWithCapturedOutput($"{_projectFilePath} -f netcoreapp1.0");
result.Should().Pass();
result.StdOut.Should().Contain($"Skipped for NETCOREAPP1.0");
result.StdOut.Should().NotContain($"Skipped for NET451");
result.StdOut.Should().NotContain($"Skipped for NET46");
}
[Fact]
@ -103,15 +103,15 @@ namespace Microsoft.Dotnet.Tools.Test.Tests
}
[WindowsOnlyFact]
public void It_skips_build_when_the_no_build_flag_is_passed_for_net451()
public void It_skips_build_when_the_no_build_flag_is_passed_for_net46()
{
var rid = RuntimeEnvironmentRidExtensions.GetAllCandidateRuntimeIdentifiers().First();
var buildCommand = new BuildCommand(_projectFilePath);
var result = buildCommand.Execute($"-f net451 -r {rid} -o {_defaultNet451OutputPath}");
var result = buildCommand.Execute($"-f net46 -r {rid} -o {_defaultNet46OutputPath}");
result.Should().Pass();
var testCommand = new DotnetTestCommand();
result = testCommand.Execute($"{_projectFilePath} -f net451 -r {rid} -o {_defaultNet451OutputPath} --no-build");
result = testCommand.Execute($"{_projectFilePath} -f net46 -r {rid} -o {_defaultNet46OutputPath} --no-build");
result.Should().Pass();
}
@ -142,7 +142,7 @@ namespace Microsoft.Dotnet.Tools.Test.Tests
.ExecuteWithCapturedOutput($"{_projectFilePath}");
result.Should().Fail();
result.StdOut.Should().Contain("Failing in NET451");
result.StdOut.Should().Contain("Failing in NET46");
result.StdOut.Should().Contain("Failing in NETCOREAPP1.0");
}

View file

@ -18,7 +18,7 @@ namespace Microsoft.Dotnet.Tools.Test.Tests
{
private string _projectFilePath;
private string _netCoreAppOutputPath;
private string _net451OutputPath;
private string _net46OutputPath;
private void Setup([CallerMemberName] string callingMethod = "")
{
@ -44,8 +44,8 @@ namespace Microsoft.Dotnet.Tools.Test.Tests
if (RuntimeEnvironment.OperatingSystemPlatform == Platform.Windows)
{
var rid = RuntimeEnvironmentRidExtensions.GetAllCandidateRuntimeIdentifiers().First();
_net451OutputPath = Path.Combine(testInstance.TestRoot, "bin", "Debug", "net451", rid);
result = buildCommand.Execute($"-f net451 -r {rid} -o {_net451OutputPath}");
_net46OutputPath = Path.Combine(testInstance.TestRoot, "bin", "Debug", "net46", rid);
result = buildCommand.Execute($"-f net46 -r {rid} -o {_net46OutputPath}");
result.Should().Pass();
}
}
@ -70,7 +70,7 @@ namespace Microsoft.Dotnet.Tools.Test.Tests
}
[WindowsOnlyFact(Skip="https://github.com/xunit/xunit/issues/934")]
public void It_discovers_tests_for_the_ProjectWithTestsWithNet451()
public void It_discovers_tests_for_the_ProjectWithTestsWithNet46()
{
Setup();
@ -80,7 +80,7 @@ namespace Microsoft.Dotnet.Tools.Test.Tests
var rid = RuntimeEnvironmentRidExtensions.GetAllCandidateRuntimeIdentifiers().First();
var testCommand = new DotnetTestCommand();
var result = testCommand.Execute($"{_projectFilePath} -f net451 -r {rid} -o {_net451OutputPath} --port {adapter.Port} --no-build");
var result = testCommand.Execute($"{_projectFilePath} -f net46 -r {rid} -o {_net46OutputPath} --port {adapter.Port} --no-build");
result.Should().Pass();
adapter.Messages["TestSession.Connected"].Count.Should().Be(1);
@ -111,7 +111,7 @@ namespace Microsoft.Dotnet.Tools.Test.Tests
}
[WindowsOnlyFact(Skip="https://github.com/xunit/xunit/issues/934")]
public void It_runs_tests_for_net451()
public void It_runs_tests_for_net46()
{
Setup();
@ -121,7 +121,7 @@ namespace Microsoft.Dotnet.Tools.Test.Tests
var testCommand = new DotnetTestCommand();
var rid = RuntimeEnvironmentRidExtensions.GetAllCandidateRuntimeIdentifiers().First();
var result = testCommand.Execute($"{_projectFilePath} -f net451 -r {rid} -o {_net451OutputPath} --port {adapter.Port} --no-build");
var result = testCommand.Execute($"{_projectFilePath} -f net46 -r {rid} -o {_net46OutputPath} --port {adapter.Port} --no-build");
result.Should().Pass();
adapter.Messages["TestSession.Connected"].Count.Should().Be(1);