diff --git a/build/Microsoft.DotNet.Cli.Prepare.targets b/build/Microsoft.DotNet.Cli.Prepare.targets index aa6f9a4c8..3c00134cf 100644 --- a/build/Microsoft.DotNet.Cli.Prepare.targets +++ b/build/Microsoft.DotNet.Cli.Prepare.targets @@ -62,7 +62,8 @@ - + diff --git a/build/compile/Microsoft.DotNet.Cli.LzmaArchive.targets b/build/compile/Microsoft.DotNet.Cli.LzmaArchive.targets index 06cae3ffc..4a9e88ccd 100644 --- a/build/compile/Microsoft.DotNet.Cli.LzmaArchive.targets +++ b/build/compile/Microsoft.DotNet.Cli.LzmaArchive.targets @@ -62,8 +62,7 @@ - - + @@ -72,22 +71,13 @@ + TemplateType="Console" + WorkingDirectory="$(NuGetPackagesArchiveProject)/Console" /> - - - - + WorkingDirectory="$(NuGetPackagesArchiveProject)/Console" /> diff --git a/build_projects/dotnet-cli-build/GenerateNuGetPackagesArchiveVersion.cs b/build_projects/dotnet-cli-build/GenerateNuGetPackagesArchiveVersion.cs index fffa5213e..546aea74d 100644 --- a/build_projects/dotnet-cli-build/GenerateNuGetPackagesArchiveVersion.cs +++ b/build_projects/dotnet-cli-build/GenerateNuGetPackagesArchiveVersion.cs @@ -21,13 +21,15 @@ namespace Microsoft.DotNet.Cli.Build [Required] public string RepoRoot { get; set; } + [Required] + public string SharedFrameworkVersion { get; set; } + [Output] public String Version { get; set; } private static string[] s_TemplatesToArchive = new string[] { - "CSharp_Web", - "CSharp_Web1.1", + "CSharp_Console", }; public override bool Execute() @@ -59,6 +61,8 @@ namespace Microsoft.DotNet.Cli.Build } } } + + dataToHash += SharedFrameworkVersion; } Log.LogMessage($"NuGet Packages Archive Data To Hash: '{dataToHash}'"); diff --git a/src/Microsoft.DotNet.Configurer/NuGetCachePrimer.cs b/src/Microsoft.DotNet.Configurer/NuGetCachePrimer.cs index 212966ada..95238ecc0 100644 --- a/src/Microsoft.DotNet.Configurer/NuGetCachePrimer.cs +++ b/src/Microsoft.DotNet.Configurer/NuGetCachePrimer.cs @@ -12,8 +12,7 @@ namespace Microsoft.DotNet.Configurer { private static string[] s_TemplatesUsedToPrimeCache = new string[] { - "Web", - "Web1.1" + "Console", }; private readonly ICommandFactory _commandFactory; diff --git a/src/dotnet/commands/dotnet-new/CSharp_Console/$projectName$.csproj b/src/dotnet/commands/dotnet-new/CSharp_Console/$projectName$.csproj index 5e1611f89..389da6f90 100755 --- a/src/dotnet/commands/dotnet-new/CSharp_Console/$projectName$.csproj +++ b/src/dotnet/commands/dotnet-new/CSharp_Console/$projectName$.csproj @@ -2,7 +2,8 @@ Exe - netcoreapp1.0 + netcoreapp2.0 + $CurrentSharedFrameworkVersion$ diff --git a/src/dotnet/commands/dotnet-new/CSharp_Console/NuGet.config b/src/dotnet/commands/dotnet-new/CSharp_Console/NuGet.config new file mode 100644 index 000000000..1f19c5d54 --- /dev/null +++ b/src/dotnet/commands/dotnet-new/CSharp_Console/NuGet.config @@ -0,0 +1,5 @@ + + + + + diff --git a/src/dotnet/commands/dotnet-new/CSharp_Console1.1/$projectName$.csproj b/src/dotnet/commands/dotnet-new/CSharp_Console1.1/$projectName$.csproj deleted file mode 100644 index e11296c05..000000000 --- a/src/dotnet/commands/dotnet-new/CSharp_Console1.1/$projectName$.csproj +++ /dev/null @@ -1,8 +0,0 @@ - - - - Exe - netcoreapp1.1 - - - diff --git a/src/dotnet/commands/dotnet-new/CSharp_Console1.1/Program.cs b/src/dotnet/commands/dotnet-new/CSharp_Console1.1/Program.cs deleted file mode 100644 index 4e1dcf8d7..000000000 --- a/src/dotnet/commands/dotnet-new/CSharp_Console1.1/Program.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; - -namespace ConsoleApp -{ - class Program - { - static void Main(string[] args) - { - Console.WriteLine("Hello World!"); - } - } -} diff --git a/src/dotnet/commands/dotnet-new/CSharp_Lib/$projectName$.csproj b/src/dotnet/commands/dotnet-new/CSharp_Lib/$projectName$.csproj index 20861435d..6e488bcfa 100755 --- a/src/dotnet/commands/dotnet-new/CSharp_Lib/$projectName$.csproj +++ b/src/dotnet/commands/dotnet-new/CSharp_Lib/$projectName$.csproj @@ -1,7 +1,8 @@  - netstandard1.4 + netstandard2.0 + $CurrentSharedFrameworkVersion$ diff --git a/src/dotnet/commands/dotnet-new/CSharp_Lib/NuGet.config b/src/dotnet/commands/dotnet-new/CSharp_Lib/NuGet.config new file mode 100644 index 000000000..1f19c5d54 --- /dev/null +++ b/src/dotnet/commands/dotnet-new/CSharp_Lib/NuGet.config @@ -0,0 +1,5 @@ + + + + + diff --git a/src/dotnet/commands/dotnet-new/Program.cs b/src/dotnet/commands/dotnet-new/Program.cs index f221f011d..798ebe421 100644 --- a/src/dotnet/commands/dotnet-new/Program.cs +++ b/src/dotnet/commands/dotnet-new/Program.cs @@ -62,10 +62,19 @@ namespace Microsoft.DotNet.Tools.New if (Path.GetFileNameWithoutExtension(file) == "$projectName$") { string extension = Path.GetExtension(file); + string newFileName = Path.Combine(Path.GetDirectoryName(file), $"{projectName}{extension}"); - File.Move( - file, - Path.Combine(Path.GetDirectoryName(file), $"{projectName}{extension}")); + File.Move(file, newFileName); + + // for perf reasons, only projects can have replacement values in them + string originalProjectText = File.ReadAllText(newFileName); + string replacedProjectText = originalProjectText + .Replace("$CurrentSharedFrameworkVersion$", new Muxer().SharedFxVersion); + + if (replacedProjectText != originalProjectText) + { + File.WriteAllText(newFileName, replacedProjectText); + } } } } @@ -84,7 +93,6 @@ namespace Microsoft.DotNet.Tools.New Templates = new[] { new { Name = "Console" }, - new { Name = "Console1.1" }, new { Name = "Web" }, new { Name = "Web1.1" }, new { Name = "Lib" }, diff --git a/test/Microsoft.DotNet.Configurer.UnitTests/GivenANuGetCachePrimer.cs b/test/Microsoft.DotNet.Configurer.UnitTests/GivenANuGetCachePrimer.cs index a89a6562a..413897165 100644 --- a/test/Microsoft.DotNet.Configurer.UnitTests/GivenANuGetCachePrimer.cs +++ b/test/Microsoft.DotNet.Configurer.UnitTests/GivenANuGetCachePrimer.cs @@ -62,10 +62,7 @@ namespace Microsoft.DotNet.Configurer.UnitTests _dotnetNewCommandMock = new Mock(); SetupCommandMock(_dotnetNewCommandMock); commandFactoryMock - .Setup(c => c.Create("new", new[] { "-t", "Web" }, null, Constants.DefaultConfiguration)) - .Returns(_dotnetNewCommandMock.Object); - commandFactoryMock - .Setup(c => c.Create("new", new[] { "-t", "Web1.1" }, null, Constants.DefaultConfiguration)) + .Setup(c => c.Create("new", new[] { "-t", "Console" }, null, Constants.DefaultConfiguration)) .Returns(_dotnetNewCommandMock.Object); _dotnetRestoreCommandMock = new Mock(); @@ -127,25 +124,25 @@ namespace Microsoft.DotNet.Configurer.UnitTests [Fact] public void It_runs_dotnet_new_using_the_temporary_folder() { - _dotnetNewCommandMock.Verify(c => c.WorkingDirectory(TEMPORARY_FOLDER_PATH), Times.Exactly(2)); + _dotnetNewCommandMock.Verify(c => c.WorkingDirectory(TEMPORARY_FOLDER_PATH), Times.Exactly(1)); } [Fact] public void It_runs_dotnet_new_capturing_stdout() { - _dotnetNewCommandMock.Verify(c => c.CaptureStdOut(), Times.Exactly(2)); + _dotnetNewCommandMock.Verify(c => c.CaptureStdOut(), Times.Exactly(1)); } [Fact] public void It_runs_dotnet_new_capturing_stderr() { - _dotnetNewCommandMock.Verify(c => c.CaptureStdErr(), Times.Exactly(2)); + _dotnetNewCommandMock.Verify(c => c.CaptureStdErr(), Times.Exactly(1)); } [Fact] public void It_actually_runs_dotnet_new() { - _dotnetNewCommandMock.Verify(c => c.Execute(), Times.Exactly(2)); + _dotnetNewCommandMock.Verify(c => c.Execute(), Times.Exactly(1)); } [Fact] @@ -157,7 +154,7 @@ namespace Microsoft.DotNet.Configurer.UnitTests new [] {"-s", $"{PACKAGES_ARCHIVE_PATH}"}, null, Constants.DefaultConfiguration), - Times.Exactly(2)); + Times.Exactly(1)); } [Fact] @@ -187,25 +184,25 @@ namespace Microsoft.DotNet.Configurer.UnitTests [Fact] public void It_runs_dotnet_restore_using_the_temporary_folder() { - _dotnetRestoreCommandMock.Verify(c => c.WorkingDirectory(TEMPORARY_FOLDER_PATH), Times.Exactly(2)); + _dotnetRestoreCommandMock.Verify(c => c.WorkingDirectory(TEMPORARY_FOLDER_PATH), Times.Exactly(1)); } [Fact] public void It_runs_dotnet_restore_capturing_stdout() { - _dotnetRestoreCommandMock.Verify(c => c.CaptureStdOut(), Times.Exactly(2)); + _dotnetRestoreCommandMock.Verify(c => c.CaptureStdOut(), Times.Exactly(1)); } [Fact] public void It_runs_dotnet_restore_capturing_stderr() { - _dotnetRestoreCommandMock.Verify(c => c.CaptureStdErr(), Times.Exactly(2)); + _dotnetRestoreCommandMock.Verify(c => c.CaptureStdErr(), Times.Exactly(1)); } [Fact] public void It_actually_runs_dotnet_restore() { - _dotnetRestoreCommandMock.Verify(c => c.Execute(), Times.Exactly(2)); + _dotnetRestoreCommandMock.Verify(c => c.Execute(), Times.Exactly(1)); } [Fact] diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Assertions/DirectoryInfoAssertions.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Assertions/DirectoryInfoAssertions.cs index 3b0c99d9d..367d94d90 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Assertions/DirectoryInfoAssertions.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Assertions/DirectoryInfoAssertions.cs @@ -156,6 +156,25 @@ namespace Microsoft.DotNet.Tools.Test.Utilities return new AndConstraint(this); } + public AndConstraint NotHaveDirectory(string unexpectedDir) + { + var dir = _dirInfo.EnumerateDirectories(unexpectedDir, SearchOption.TopDirectoryOnly).SingleOrDefault(); + Execute.Assertion.ForCondition(dir == null) + .FailWith("Directory {0} should not be found in directory {1}.", unexpectedDir, _dirInfo.FullName); + + return new AndConstraint(new DirectoryInfoAssertions(dir)); + } + + public AndConstraint NotHaveDirectories(IEnumerable unexpectedDirs) + { + foreach (var unexpectedDir in unexpectedDirs) + { + NotHaveDirectory(unexpectedDir); + } + + return new AndConstraint(this); + } + public AndConstraint OnlyHaveFiles(IEnumerable expectedFiles) { var actualFiles = _dirInfo.EnumerateFiles("*", SearchOption.TopDirectoryOnly).Select(f => f.Name); diff --git a/test/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs b/test/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs index 9ca7b7404..18f1c2a79 100644 --- a/test/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs +++ b/test/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs @@ -110,11 +110,10 @@ namespace Microsoft.DotNet.Cli.Publish.Tests .ExecuteWithCapturedOutput() .Should().Pass(); - var rid = DotnetLegacyRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier(); var configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug"; var outputProgram = rootDir - .GetDirectory("bin", configuration, "netcoreapp1.0", "publish", $"{rootDir.Name}.dll") + .GetDirectory("bin", configuration, "netcoreapp2.0", "publish", $"{rootDir.Name}.dll") .FullName; new TestCommand(outputProgram) diff --git a/test/dotnet.Tests/GivenThatTheUserIsRunningDotNetForTheFirstTime.cs b/test/dotnet.Tests/GivenThatTheUserIsRunningDotNetForTheFirstTime.cs index 9fe46af73..7e6ee264a 100644 --- a/test/dotnet.Tests/GivenThatTheUserIsRunningDotNetForTheFirstTime.cs +++ b/test/dotnet.Tests/GivenThatTheUserIsRunningDotNetForTheFirstTime.cs @@ -91,6 +91,13 @@ A command is running to initially populate your local package cache, to improve List expectedDirectories = new List() { "microsoft.netcore.app", + "microsoft.netcore.platforms", + "netstandard.library", + }; + + // https://github.com/dotnet/cli/issues/5505 - add the "2.0" asp.net packages into the offline cache + List unexpectedDirectories = new List() + { "microsoft.aspnetcore.diagnostics", "microsoft.aspnetcore.mvc", "microsoft.aspnetcore.routing", @@ -111,12 +118,8 @@ A command is running to initially populate your local package cache, to improve .HaveDirectories(expectedDirectories); _nugetCacheFolder - .GetDirectory("system.runtime") - .Should().HaveDirectories(new string[] { "4.1.0", "4.3.0" }); - - _nugetCacheFolder - .GetDirectory("microsoft.aspnetcore.mvc") - .Should().HaveDirectories(new string[] { "1.0.2", "1.1.0" }); + .Should() + .NotHaveDirectories(unexpectedDirectories); } private string GetDotnetVersion() diff --git a/test/dotnet.Tests/¬/.dotnet/optimizationdata/1.0.0-rc4-004536/osx.10.11-x64/dotnet b/test/dotnet.Tests/¬/.dotnet/optimizationdata/1.0.0-rc4-004536/osx.10.11-x64/dotnet deleted file mode 100644 index 30393cb6d..000000000 Binary files a/test/dotnet.Tests/¬/.dotnet/optimizationdata/1.0.0-rc4-004536/osx.10.11-x64/dotnet and /dev/null differ diff --git a/tools/Archiver/Archiver.csproj b/tools/Archiver/Archiver.csproj index a7b11575b..0eb984676 100644 --- a/tools/Archiver/Archiver.csproj +++ b/tools/Archiver/Archiver.csproj @@ -4,7 +4,7 @@ netcoreapp2.0 Exe - win7-x64;win7-x86;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;osx.10.10-x64;rhel.7-x64 + $(CLI_SharedFrameworkVersion) diff --git a/tools/CrossGen.Dependencies/CrossGen.Dependencies.csproj b/tools/CrossGen.Dependencies/CrossGen.Dependencies.csproj new file mode 100644 index 000000000..5edc68a17 --- /dev/null +++ b/tools/CrossGen.Dependencies/CrossGen.Dependencies.csproj @@ -0,0 +1,11 @@ + + + + + netcoreapp2.0 + win7-x64;win7-x86;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;osx.10.10-x64;rhel.7-x64 + + + + + \ No newline at end of file