Update to template engine build 166 and updates to 2.0 templates

This commit is contained in:
Mike Lorbetske 2017-03-27 17:46:32 -07:00
parent 3634da519a
commit 9bb88734ea
6 changed files with 12 additions and 43 deletions

View file

@ -5,6 +5,7 @@
<clear />
<add key="templating" value="https://dotnet.myget.org/F/templating/api/v3/index.json" />
<add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
<add key="aspnetcore-dev" value="https://dotnet.myget.org/F/aspnetcore-ci-dev/api/v3/index.json" />
<add key="cli-deps" value="https://dotnet.myget.org/F/cli-deps/api/v3/index.json" />
<add key="roslyn" value="https://dotnet.myget.org/f/roslyn/api/v3/index.json" />
<add key="xunit" value="https://www.myget.org/F/xunit/api/v3/index.json" />

View file

@ -2,7 +2,7 @@
<ItemGroup>
<BundledTemplate Include="Microsoft.DotNet.Common.ItemTemplates" Version="$(TemplateEngineTemplateVersion)" />
<BundledTemplate Include="Microsoft.DotNet.Common.ProjectTemplates.2.0" Version="$(TemplateEngineTemplate2_0Version)" />
<BundledTemplate Include="Microsoft.DotNet.Test.ProjectTemplates" Version="$(TemplateEngineTemplateVersion)" />
<BundledTemplate Include="Microsoft.DotNet.Web.ProjectTemplates" Version="$(TemplateEngineTemplateVersion)" />
<BundledTemplate Include="Microsoft.DotNet.Test.ProjectTemplates.2.0" Version="$(TemplateEngineTemplateVersion)" />
<BundledTemplate Include="Microsoft.DotNet.Web.ProjectTemplates.2.0" Version="$(TemplateEngineTemplateVersion)" />
</ItemGroup>
</Project>

View file

@ -11,9 +11,9 @@
<SharedFrameworkVersion>$(CLI_SharedFrameworkVersion)</SharedFrameworkVersion>
<SharedHostVersion>$(CLI_SharedFrameworkVersion)</SharedHostVersion>
<HostFxrVersion>$(CLI_SharedFrameworkVersion)</HostFxrVersion>
<TemplateEngineVersion>1.0.0-beta1-20170202-111</TemplateEngineVersion>
<TemplateEngineTemplateVersion>1.0.0-beta1-20170131-110</TemplateEngineTemplateVersion>
<TemplateEngineTemplate2_0Version>1.0.0-beta1-20170209-117</TemplateEngineTemplate2_0Version>
<TemplateEngineVersion>1.0.0-beta1-20170324-166</TemplateEngineVersion>
<TemplateEngineTemplateVersion>1.0.0-beta1-20170324-166</TemplateEngineTemplateVersion>
<TemplateEngineTemplate2_0Version>1.0.0-beta1-20170324-166</TemplateEngineTemplate2_0Version>
<PlatformAbstractionsVersion>1.0.3</PlatformAbstractionsVersion>
<DependencyModelVersion>1.0.3</DependencyModelVersion>
<CliCommandLineParserVersion>0.1.0-alpha-88</CliCommandLineParserVersion>

View file

@ -76,15 +76,7 @@ namespace Microsoft.DotNet.New.Tests
[InlineData("classlib", "NetStandardImplicitPackageVersion", "netstandard.library")]
public void NewProjectRestoresCorrectPackageVersion(string type, string propertyName, string packageName)
{
// These will fail when templates stop including explicit version.
// Collapse back to one method and remove the explicit version handling when that happens.
NewProjectRestoresCorrectPackageVersion(type, propertyName, packageName, deleteExplicitVersion: true);
NewProjectRestoresCorrectPackageVersion(type, propertyName, packageName, deleteExplicitVersion: false);
}
private void NewProjectRestoresCorrectPackageVersion(string type, string propertyName, string packageName, bool deleteExplicitVersion)
{
var rootPath = TestAssets.CreateTestDirectory(identifier: $"_{type}_{deleteExplicitVersion}").FullName;
var rootPath = TestAssets.CreateTestDirectory(identifier: $"_{type}").FullName;
var packagesDirectory = Path.Combine(rootPath, "packages");
var projectName = "Project";
var expectedVersion = GetFrameworkPackageVersion();
@ -94,8 +86,6 @@ namespace Microsoft.DotNet.New.Tests
.Execute($"{type} --name {projectName} -o .")
.Should().Pass();
ValidateAndRemoveExplicitVersion();
new RestoreCommand()
.WithWorkingDirectory(rootPath)
.Execute($"--packages {packagesDirectory}")
@ -130,28 +120,6 @@ namespace Microsoft.DotNet.New.Tests
return dependency.Version;
}
}
// Remove when templates stop putting an explicit version
void ValidateAndRemoveExplicitVersion()
{
var projectFileName = $"{projectName}.csproj";
var projectPath = Path.Combine(rootPath, projectFileName);
var projectDocument = XDocument.Load(projectPath);
var explicitVersionNode = projectDocument
.Elements("Project")
.Elements("PropertyGroup")
.Elements(propertyName)
.SingleOrDefault();
explicitVersionNode.Should().NotBeNull();
explicitVersionNode.Value.Should().Be(expectedVersion);
if (deleteExplicitVersion)
{
explicitVersionNode.Remove();
projectDocument.Save(projectPath);
}
}
}
}
}

View file

@ -20,9 +20,9 @@ namespace Microsoft.DotNet.New.Tests
[InlineData("C#", "classlib", false)]
[InlineData("C#", "mstest", false)]
[InlineData("C#", "xunit", false)]
[InlineData("C#", "web", true)]
[InlineData("C#", "mvc", true)]
[InlineData("C#", "webapi", true)]
[InlineData("C#", "web", false)]
[InlineData("C#", "mvc", false)]
[InlineData("C#", "webapi", false)]
// Uncomment the test below once https://github.com/dotnet/netcorecli-fsc/issues/92 is fixed.
//[InlineData("F#", "console", false)]
//[InlineData("F#", "classlib", false)]

View file

@ -16,7 +16,7 @@ namespace Microsoft.DotNet.New.Tests
cmd.ExitCode.Should().NotBe(0);
cmd.StdErr.Should().StartWith("No templates matched the input template name: [Web1.1]");
cmd.StdErr.Should().StartWith("No templates matched the input template name: Web1.1.");
}
[Fact]
@ -26,7 +26,7 @@ namespace Microsoft.DotNet.New.Tests
cmd.ExitCode.Should().NotBe(0);
cmd.StdErr.Should().StartWith("Unable to determine the desired template from the input template name: [c]");
cmd.StdErr.Should().StartWith("Unable to determine the desired template from the input template name: c.");
}
}
}