Fix Templating
This commit is contained in:
parent
cca71ad4d2
commit
82701c1eba
|
|
@ -1,36 +1,20 @@
|
||||||
<Project>
|
<Project>
|
||||||
|
<Import Project="../../../eng/Versions.props" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
|
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Label="Package Versions">
|
<PropertyGroup Label="Package Versions">
|
||||||
<AngleSharpPackageVersion>0.9.9</AngleSharpPackageVersion>
|
<MicrosoftAspNetCoreAppPackageVersion>3.0.0-preview-19065-0365</MicrosoftAspNetCoreAppPackageVersion>
|
||||||
<DotNetEfPackageVersion>3.0.0-preview-181109-02</DotNetEfPackageVersion>
|
<MicrosoftAspNetCoreAuthenticationAzureADB2CUIPackageVersion>3.0.0-preview-19059-0307 </MicrosoftAspNetCoreAuthenticationAzureADB2CUIPackageVersion>
|
||||||
<InternalAspNetCoreSdkPackageVersion>3.0.0-alpha1-20181017.4</InternalAspNetCoreSdkPackageVersion>
|
<MicrosoftAspNetCoreAuthenticationAzureADUIPackageVersion>3.0.0-preview-19059-0307 </MicrosoftAspNetCoreAuthenticationAzureADUIPackageVersion>
|
||||||
<MicrosoftAspNetCoreAppPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreAppPackageVersion>
|
|
||||||
<MicrosoftAspNetCoreAuthenticationAzureADB2CUIPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreAuthenticationAzureADB2CUIPackageVersion>
|
|
||||||
<MicrosoftAspNetCoreAuthenticationAzureADUIPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreAuthenticationAzureADUIPackageVersion>
|
|
||||||
<MicrosoftAspNetCoreComponentsPackageVersion>3.0.0-preview-19064-0342</MicrosoftAspNetCoreComponentsPackageVersion>
|
<MicrosoftAspNetCoreComponentsPackageVersion>3.0.0-preview-19064-0342</MicrosoftAspNetCoreComponentsPackageVersion>
|
||||||
<MicrosoftAspNetCoreDiagnosticsEntityFrameworkCorePackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreDiagnosticsEntityFrameworkCorePackageVersion>
|
<MicrosoftAspNetCoreDiagnosticsEntityFrameworkCorePackageVersion>3.0.0-preview-19059-0307 </MicrosoftAspNetCoreDiagnosticsEntityFrameworkCorePackageVersion>
|
||||||
<MicrosoftAspNetCoreIdentityEntityFrameworkCorePackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreIdentityEntityFrameworkCorePackageVersion>
|
<MicrosoftAspNetCoreIdentityEntityFrameworkCorePackageVersion>3.0.0-preview-19059-0307 </MicrosoftAspNetCoreIdentityEntityFrameworkCorePackageVersion>
|
||||||
<MicrosoftAspNetCoreIdentityUIPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreIdentityUIPackageVersion>
|
<MicrosoftAspNetCoreIdentityUIPackageVersion>3.0.0-preview-19059-0307 </MicrosoftAspNetCoreIdentityUIPackageVersion>
|
||||||
<MicrosoftAspNetCorePackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCorePackageVersion>
|
<MicrosoftAspNetCorePackageVersion>3.0.0-preview-19059-0307 </MicrosoftAspNetCorePackageVersion>
|
||||||
<MicrosoftAspNetCoreMvcNewtonsoftJsonPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreMvcNewtonsoftJsonPackageVersion>
|
<MicrosoftAspNetCoreMvcNewtonsoftJsonPackageVersion>3.0.0-preview-19059-0307 </MicrosoftAspNetCoreMvcNewtonsoftJsonPackageVersion>
|
||||||
<MicrosoftAspNetCoreSpaServicesExtensionsPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreSpaServicesExtensionsPackageVersion>
|
<MicrosoftAspNetCoreSpaServicesExtensionsPackageVersion>3.0.0-preview-19059-0307 </MicrosoftAspNetCoreSpaServicesExtensionsPackageVersion>
|
||||||
<MicrosoftAspNetCoreTestingPackageVersion>3.0.0-preview-181113-11</MicrosoftAspNetCoreTestingPackageVersion>
|
<MicrosoftAspNetCoreTestingPackageVersion>3.0.0-preview-181113-11</MicrosoftAspNetCoreTestingPackageVersion>
|
||||||
<MicrosoftEntityFrameworkCoreSqlitePackageVersion>3.0.0-preview-181109-02</MicrosoftEntityFrameworkCoreSqlitePackageVersion>
|
|
||||||
<MicrosoftEntityFrameworkCoreSqlServerPackageVersion>3.0.0-preview-181109-02</MicrosoftEntityFrameworkCoreSqlServerPackageVersion>
|
|
||||||
<MicrosoftEntityFrameworkCoreToolsPackageVersion>3.0.0-preview-181109-02</MicrosoftEntityFrameworkCoreToolsPackageVersion>
|
|
||||||
<MicrosoftExtensionsCommandLineUtilsSourcesPackageVersion>3.0.0-preview-181113-11</MicrosoftExtensionsCommandLineUtilsSourcesPackageVersion>
|
|
||||||
<MicrosoftNETCoreAppPackageVersion>3.0.0-preview1-26907-05</MicrosoftNETCoreAppPackageVersion>
|
|
||||||
<MicrosoftNETSdkRazorPackageVersion>3.0.0-preview-19057-06</MicrosoftNETSdkRazorPackageVersion>
|
|
||||||
<MicrosoftNETTestSdkPackageVersion>15.6.1</MicrosoftNETTestSdkPackageVersion>
|
|
||||||
<SeleniumSupportPackageVersion>3.12.1</SeleniumSupportPackageVersion>
|
|
||||||
<SeleniumWebDriverMicrosoftDriverPackageVersion>17.17134.0</SeleniumWebDriverMicrosoftDriverPackageVersion>
|
|
||||||
<SeleniumWebDriverPackageVersion>3.12.1</SeleniumWebDriverPackageVersion>
|
|
||||||
<SystemSecurityPermissionsPackageVersion>4.6.0-preview1-26907-04</SystemSecurityPermissionsPackageVersion>
|
|
||||||
<XunitAnalyzersPackageVersion>0.10.0</XunitAnalyzersPackageVersion>
|
|
||||||
<XunitPackageVersion>2.3.1</XunitPackageVersion>
|
|
||||||
<XunitRunnerVisualStudioPackageVersion>2.4.0</XunitRunnerVisualStudioPackageVersion>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(DotNetPackageVersionPropsPath)" Condition=" '$(DotNetPackageVersionPropsPath)' != '' " />
|
<Import Project="$(DotNetPackageVersionPropsPath)" Condition=" '$(DotNetPackageVersionPropsPath)' != '' " />
|
||||||
<PropertyGroup Label="Package Versions: Pinned" />
|
<PropertyGroup Label="Package Versions: Pinned" />
|
||||||
|
|
|
||||||
|
|
@ -9,4 +9,4 @@ $ErrorActionPreference = 'Stop'
|
||||||
|
|
||||||
. $PSScriptRoot\Test-Template.ps1
|
. $PSScriptRoot\Test-Template.ps1
|
||||||
|
|
||||||
Test-Template "mvc" "mvc -au Individual" "Microsoft.DotNet.Web.ProjectTemplates.3.0.3.0.0-alpha1.nupkg" $false
|
Test-Template "mvc" "mvc -au Individual" "Microsoft.DotNet.Web.ProjectTemplates.3.0.3.0.0-preview-t000.nupkg" $false
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,7 @@ function Test-Template($templateName, $templateArgs, $templateNupkg, $isSPA) {
|
||||||
$tmpDir = "$PSScriptRoot/$templateName"
|
$tmpDir = "$PSScriptRoot/$templateName"
|
||||||
Remove-Item -Path $tmpDir -Recurse -ErrorAction Ignore
|
Remove-Item -Path $tmpDir -Recurse -ErrorAction Ignore
|
||||||
|
|
||||||
& "$PSScriptRoot/../build.cmd" /t:Package
|
Run-DotnetNew "--install", "$PSScriptRoot/../../../artifacts/Debug/packages/product/$templateNupkg"
|
||||||
Run-DotnetNew "--install", "$PSScriptRoot/../artifacts/build/$templateNupkg"
|
|
||||||
|
|
||||||
New-Item -ErrorAction Ignore -Path $tmpDir -ItemType Directory
|
New-Item -ErrorAction Ignore -Path $tmpDir -ItemType Directory
|
||||||
Push-Location $tmpDir
|
Push-Location $tmpDir
|
||||||
|
|
@ -20,14 +19,14 @@ function Test-Template($templateName, $templateArgs, $templateNupkg, $isSPA) {
|
||||||
$proj = "$tmpDir/$templateName.$extension"
|
$proj = "$tmpDir/$templateName.$extension"
|
||||||
$projContent = Get-Content -Path $proj -Raw
|
$projContent = Get-Content -Path $proj -Raw
|
||||||
$projContent = $projContent -replace ('<Project Sdk="Microsoft.NET.Sdk.Web">', "<Project Sdk=""Microsoft.NET.Sdk.Web"">
|
$projContent = $projContent -replace ('<Project Sdk="Microsoft.NET.Sdk.Web">', "<Project Sdk=""Microsoft.NET.Sdk.Web"">
|
||||||
<Import Project=""$PSScriptRoot/../test/Templates.Test/bin/Debug/netcoreapp2.2/TemplateTests.props"" />
|
<Import Project=""$PSScriptRoot/../test/Templates.Test/bin/Debug/netcoreapp3.0/TemplateTests.props"" />
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include=""Microsoft.NET.Sdk.Razor"" Version=""`$(MicrosoftNETSdkRazorPackageVersion)"" />
|
<PackageReference Include=""Microsoft.NET.Sdk.Razor"" Version=""`$(MicrosoftNETSdkRazorPackageVersion)"" />
|
||||||
</ItemGroup>")
|
</ItemGroup>")
|
||||||
$projContent | Set-Content $proj
|
$projContent | Set-Content $proj
|
||||||
|
|
||||||
dotnet publish --configuration Release
|
dotnet publish --configuration Release
|
||||||
dotnet bin\Release\netcoreapp2.2\publish\$templateName.dll
|
dotnet bin\Release\netcoreapp3.0\publish\$templateName.dll
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
Pop-Location
|
Pop-Location
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="${MicrosoftEntityFrameworkCoreSqlServerPackageVersion}" Condition=" '$(IndividualLocalAuth)' == 'True' AND '$(UseLocalDB)' == 'True'" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="${MicrosoftEntityFrameworkCoreSqlServerPackageVersion}" Condition=" '$(IndividualLocalAuth)' == 'True' AND '$(UseLocalDB)' == 'True'" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="${MicrosoftEntityFrameworkCoreSqlitePackageVersion}" Condition=" '$(IndividualLocalAuth)' == 'True' AND '$(UseLocalDB)' != 'True'" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="${MicrosoftEntityFrameworkCoreSqlitePackageVersion}" Condition=" '$(IndividualLocalAuth)' == 'True' AND '$(UseLocalDB)' != 'True'" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="${MicrosoftEntityFrameworkCoreToolsPackageVersion}" Condition=" '$(IndividualLocalAuth)' == 'True' " />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="${MicrosoftEntityFrameworkCoreToolsPackageVersion}" Condition=" '$(IndividualLocalAuth)' == 'True' " />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="3.0.0-preview-181109-02" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
<Project>
|
<Project>
|
||||||
<Target Name="GenerateTestProps" BeforeTargets="CoreCompile">
|
<Target Name="GenerateTestProps" BeforeTargets="CoreCompile">
|
||||||
|
<Message Text="$(MicrosoftAspNetCoreAppPackageVersion)" Importance="High" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PropsProperties>
|
<PropsProperties>
|
||||||
RestoreSources=$([MSBuild]::Escape($(RestoreSources)));
|
RestoreSources=$([MSBuild]::Escape($(RestoreSources)));
|
||||||
RuntimeFrameworkVersion=$(RuntimeFrameworkVersion);
|
RuntimeFrameworkVersion=$(RuntimeFrameworkVersion);
|
||||||
MicrosoftNETSdkRazorPackageVersion=$(MicrosoftNETSdkRazorPackageVersion);
|
MicrosoftNETSdkRazorPackageVersion=$(MicrosoftNETSdkRazorPackageVersion);
|
||||||
BundledAspNetCoreAppTargetFrameworkVersion=$(MicrosoftAspNetCoreAppPackageVersion.Split('.')[0]).$(MicrosoftAspNetCoreAppPackageVersion.Split('.')[1]);
|
MicrosoftAspNetCoreAppPackageVersion=$(MicrosoftAspNetCoreAppPackageVersion)
|
||||||
BundledAspNetCoreAppPackageVersion=$(MicrosoftAspNetCoreAppPackageVersion)
|
|
||||||
</PropsProperties>
|
</PropsProperties>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,13 @@
|
||||||
<RestoreSources>${RestoreSources}</RestoreSources>
|
<RestoreSources>${RestoreSources}</RestoreSources>
|
||||||
<RuntimeFrameworkVersion>${RuntimeFrameworkVersion}</RuntimeFrameworkVersion>
|
<RuntimeFrameworkVersion>${RuntimeFrameworkVersion}</RuntimeFrameworkVersion>
|
||||||
<MicrosoftNETSdkRazorPackageVersion>${MicrosoftNETSdkRazorPackageVersion}</MicrosoftNETSdkRazorPackageVersion>
|
<MicrosoftNETSdkRazorPackageVersion>${MicrosoftNETSdkRazorPackageVersion}</MicrosoftNETSdkRazorPackageVersion>
|
||||||
<BundledAspNetCoreAppTargetFrameworkVersion>${BundledAspNetCoreAppTargetFrameworkVersion}</BundledAspNetCoreAppTargetFrameworkVersion>
|
|
||||||
<BundledAspNetCoreAppPackageVersion>${BundledAspNetCoreAppPackageVersion}</BundledAspNetCoreAppPackageVersion>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<KnownFrameworkReference
|
||||||
|
Update="Microsoft.AspNetCore.App"
|
||||||
|
DefaultRuntimeFrameworkVersion="${MicrosoftAspNetCoreAppPackageVersion}"
|
||||||
|
LatestRuntimeFrameworkVersion="${MicrosoftAspNetCoreAppPackageVersion}"
|
||||||
|
TargetingPackVersion="${MicrosoftAspNetCoreAppPackageVersion}" />
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
namespace Templates.Test.Helpers
|
||||||
|
{
|
||||||
|
public static class MondoHelpers
|
||||||
|
{
|
||||||
|
public static string[] GetNupkgFiles()
|
||||||
|
{
|
||||||
|
var mondoRoot = GetMondoRepoRoot();
|
||||||
|
#if DEBUG
|
||||||
|
var configuration = "Debug";
|
||||||
|
#else
|
||||||
|
var configuration = "Release";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return Directory.GetFiles(Path.Combine(mondoRoot, "artifacts", configuration, "packages"), "*.nupkg", SearchOption.AllDirectories);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string GetMondoRepoRoot()
|
||||||
|
{
|
||||||
|
return FindAncestorDirectoryContaining(".gitmodules");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string FindAncestorDirectoryContaining(string filename)
|
||||||
|
{
|
||||||
|
var dir = AppContext.BaseDirectory;
|
||||||
|
while (dir != null)
|
||||||
|
{
|
||||||
|
if (File.Exists(Path.Combine(dir, filename)))
|
||||||
|
{
|
||||||
|
return dir;
|
||||||
|
}
|
||||||
|
|
||||||
|
dir = Directory.GetParent(dir)?.FullName;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new InvalidOperationException($"Could not find any ancestor directory containing {filename} at or above {AppContext.BaseDirectory}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
@ -70,7 +70,7 @@ namespace Templates.Test.Helpers
|
||||||
|
|
||||||
public static ProcessEx RunDotNetNew(ITestOutputHelper output, string arguments, bool assertSuccess)
|
public static ProcessEx RunDotNetNew(ITestOutputHelper output, string arguments, bool assertSuccess)
|
||||||
{
|
{
|
||||||
lock(DotNetNewLock)
|
lock (DotNetNewLock)
|
||||||
{
|
{
|
||||||
var proc = ProcessEx.Run(
|
var proc = ProcessEx.Run(
|
||||||
output,
|
output,
|
||||||
|
|
@ -100,10 +100,7 @@ namespace Templates.Test.Helpers
|
||||||
VerifyCannotFindTemplate(output, "reactredux");
|
VerifyCannotFindTemplate(output, "reactredux");
|
||||||
VerifyCannotFindTemplate(output, "angular");
|
VerifyCannotFindTemplate(output, "angular");
|
||||||
|
|
||||||
// Locate the artifacts directory containing the built template packages
|
var builtPackages = MondoHelpers.GetNupkgFiles();
|
||||||
var solutionDir = FindAncestorDirectoryContaining("Templating.sln");
|
|
||||||
var artifactsDir = Path.Combine(solutionDir, "artifacts", "build");
|
|
||||||
var builtPackages = Directory.GetFiles(artifactsDir, "*.nupkg");
|
|
||||||
foreach (var packagePath in builtPackages)
|
foreach (var packagePath in builtPackages)
|
||||||
{
|
{
|
||||||
if (_templatePackages.Any(name => Path.GetFileName(packagePath).StartsWith(name, StringComparison.OrdinalIgnoreCase)))
|
if (_templatePackages.Any(name => Path.GetFileName(packagePath).StartsWith(name, StringComparison.OrdinalIgnoreCase)))
|
||||||
|
|
@ -146,21 +143,5 @@ namespace Templates.Test.Helpers
|
||||||
Directory.Delete(tempDir, recursive: true);
|
Directory.Delete(tempDir, recursive: true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string FindAncestorDirectoryContaining(string filename)
|
|
||||||
{
|
|
||||||
var dir = AppContext.BaseDirectory;
|
|
||||||
while (dir != null)
|
|
||||||
{
|
|
||||||
if (File.Exists(Path.Combine(dir, filename)))
|
|
||||||
{
|
|
||||||
return dir;
|
|
||||||
}
|
|
||||||
|
|
||||||
dir = Directory.GetParent(dir)?.FullName;
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new InvalidOperationException($"Could not find any ancestor directory containing {filename} at or above {AppContext.BaseDirectory}");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue