Update dotnet new to generate a "2.0" project.
This commit is contained in:
parent
23207df2ae
commit
fd65cb03b6
16 changed files with 83 additions and 66 deletions
|
@ -62,7 +62,8 @@
|
|||
<Output TaskParameter="VersionBadgeMoniker" PropertyName="VersionBadgeMoniker" />
|
||||
</GenerateBuildVersionInfo>
|
||||
|
||||
<GenerateNuGetPackagesArchiveVersion RepoRoot="$(RepoRoot)">
|
||||
<GenerateNuGetPackagesArchiveVersion RepoRoot="$(RepoRoot)"
|
||||
SharedFrameworkVersion="$(CLI_SharedFrameworkVersion)">
|
||||
<Output TaskParameter="Version" PropertyName="NuGetPackagesArchiveVersion"/>
|
||||
</GenerateNuGetPackagesArchiveVersion>
|
||||
|
||||
|
|
|
@ -62,8 +62,7 @@
|
|||
<FilesToClean Include="$(NuGetPackagesArchiveProject)/**/*" />
|
||||
<FilesToClean Include="$(NuGetPackagesArchiveFolder)/**/*" />
|
||||
|
||||
<NuGetPackagesArchiveDirectory Include="$(NuGetPackagesArchiveProject)/Web" />
|
||||
<NuGetPackagesArchiveDirectory Include="$(NuGetPackagesArchiveProject)/Web1.1" />
|
||||
<NuGetPackagesArchiveDirectory Include="$(NuGetPackagesArchiveProject)/Console" />
|
||||
<NuGetPackagesArchiveDirectory Include="$(NuGetPackagesArchiveFolder)" />
|
||||
</ItemGroup>
|
||||
|
||||
|
@ -72,22 +71,13 @@
|
|||
<MakeDir Directories="@(NuGetPackagesArchiveDirectory)"/>
|
||||
|
||||
<DotNetNew ToolPath="$(Stage2Directory)"
|
||||
TemplateType="Web"
|
||||
WorkingDirectory="$(NuGetPackagesArchiveProject)/Web" />
|
||||
TemplateType="Console"
|
||||
WorkingDirectory="$(NuGetPackagesArchiveProject)/Console" />
|
||||
|
||||
<DotNetRestore ToolPath="$(Stage2Directory)"
|
||||
Packages="$(NuGetPackagesArchiveFolder)"
|
||||
SkipInvalidConfigurations="True"
|
||||
WorkingDirectory="$(NuGetPackagesArchiveProject)/Web" />
|
||||
|
||||
<DotNetNew ToolPath="$(Stage2Directory)"
|
||||
TemplateType="Web1.1"
|
||||
WorkingDirectory="$(NuGetPackagesArchiveProject)/Web1.1" />
|
||||
|
||||
<DotNetRestore ToolPath="$(Stage2Directory)"
|
||||
Packages="$(NuGetPackagesArchiveFolder)"
|
||||
SkipInvalidConfigurations="True"
|
||||
WorkingDirectory="$(NuGetPackagesArchiveProject)/Web1.1" />
|
||||
WorkingDirectory="$(NuGetPackagesArchiveProject)/Console" />
|
||||
|
||||
<Delete Files="$(IntermediateArchive);$(IntermediateArchive).zip" />
|
||||
|
||||
|
|
|
@ -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}'");
|
||||
|
|
|
@ -12,8 +12,7 @@ namespace Microsoft.DotNet.Configurer
|
|||
{
|
||||
private static string[] s_TemplatesUsedToPrimeCache = new string[]
|
||||
{
|
||||
"Web",
|
||||
"Web1.1"
|
||||
"Console",
|
||||
};
|
||||
|
||||
private readonly ICommandFactory _commandFactory;
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp1.0</TargetFramework>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<RuntimeFrameworkVersion>$CurrentSharedFrameworkVersion$</RuntimeFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<configuration>
|
||||
<packageSources>
|
||||
<add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
|
||||
</packageSources>
|
||||
</configuration>
|
|
@ -1,8 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp1.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
|
@ -1,12 +0,0 @@
|
|||
using System;
|
||||
|
||||
namespace ConsoleApp
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("Hello World!");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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" },
|
||||
|
|
|
@ -62,10 +62,7 @@ namespace Microsoft.DotNet.Configurer.UnitTests
|
|||
_dotnetNewCommandMock = new Mock<ICommand>();
|
||||
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<ICommand>();
|
||||
|
@ -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]
|
||||
|
|
|
@ -156,6 +156,25 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
|||
return new AndConstraint<DirectoryInfoAssertions>(this);
|
||||
}
|
||||
|
||||
public AndConstraint<DirectoryInfoAssertions> 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<DirectoryInfoAssertions>(new DirectoryInfoAssertions(dir));
|
||||
}
|
||||
|
||||
public AndConstraint<DirectoryInfoAssertions> NotHaveDirectories(IEnumerable<string> unexpectedDirs)
|
||||
{
|
||||
foreach (var unexpectedDir in unexpectedDirs)
|
||||
{
|
||||
NotHaveDirectory(unexpectedDir);
|
||||
}
|
||||
|
||||
return new AndConstraint<DirectoryInfoAssertions>(this);
|
||||
}
|
||||
|
||||
public AndConstraint<DirectoryInfoAssertions> OnlyHaveFiles(IEnumerable<string> expectedFiles)
|
||||
{
|
||||
var actualFiles = _dirInfo.EnumerateFiles("*", SearchOption.TopDirectoryOnly).Select(f => f.Name);
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -91,6 +91,13 @@ A command is running to initially populate your local package cache, to improve
|
|||
List<string> expectedDirectories = new List<string>()
|
||||
{
|
||||
"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<string> unexpectedDirectories = new List<string>()
|
||||
{
|
||||
"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()
|
||||
|
|
Binary file not shown.
|
@ -4,7 +4,7 @@
|
|||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RuntimeIdentifiers>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</RuntimeIdentifiers>
|
||||
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="**\*.cs" />
|
||||
|
|
11
tools/CrossGen.Dependencies/CrossGen.Dependencies.csproj
Normal file
11
tools/CrossGen.Dependencies/CrossGen.Dependencies.csproj
Normal file
|
@ -0,0 +1,11 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<RuntimeIdentifiers>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</RuntimeIdentifiers>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NETCore.Runtime.CoreCLR" Version="$(CLI_CoreCLRVersion)" />
|
||||
</ItemGroup>
|
||||
</Project>
|
Loading…
Reference in a new issue