Fixing the build for ProjectTemplates

This commit is contained in:
Artak Mkrtchyan 2019-04-01 11:25:07 -07:00 committed by Artak
parent df3a702190
commit 77e6be4c28
2 changed files with 12 additions and 5 deletions

View File

@ -3,12 +3,19 @@
## Getting Started ## Getting Started
These are project templates which are used in .NET Core for creating ASP.NET Core applications. These are project templates which are used in .NET Core for creating ASP.NET Core applications.
## Prerequisites
Some projects in this repository (like SignalR Java Client) require JDK installation and configuration of `JAVA_HOME` environment variable.
1. If you don't have the JDK installed, you can find it from https://www.oracle.com/technetwork/java/javase/downloads/index.html
1. After installation define a new environment variable named `JAVA_HOME` pointing to the root of the latest JDK installation (for Windows it will be something like `c:\Program Files\Java\jdk-12`).
1. Add the `%JAVA_HOME%\bin` directory to the `PATH` environment variable
## Building Templates ## Building Templates
1. Run `. .\activate.ps1` if you haven't already. 1. Run `. .\activate.ps1` if you haven't already.
2. Run `build.cmd -all -pack` in the repository root to build all of the dependencies. 1. Run `git submodule update` in the repository root if you haven't already.
3. Run `build.cmd` in this directory will produce NuGet packages for each class of template in the artifacts directory. 1. Run `build.cmd -all -pack` in the repository root to build all of the dependencies.
4. Because the templates build against the version of `Microsoft.AspNetCore.App` that was built during step 2 it is NOT advised that you install templates created on your local machine via `dotnet new -i [nupkgPath]`. Instead, use the `Run-[Template]-Locally.ps1` scripts in the script folder. These scripts do `dotnet new -i` with your packages, but also apply a series of fixes and tweeks to the created template which keep the fact that you don't have a production `Microsoft.AspNetCore.App` from interfering. 1. Run `build.cmd` in this directory will produce NuGet packages for each class of template in the artifacts directory.
5. The ASP.NET localhost development certificate must also be installed and trusted or else you'll get a test error "Certificate error: Navigation blocked". 1. Because the templates build against the version of `Microsoft.AspNetCore.App` that was built during the previous step, it is NOT advised that you install templates created on your local machine via `dotnet new -i [nupkgPath]`. Instead, use the `Run-[Template]-Locally.ps1` scripts in the script folder. These scripts do `dotnet new -i` with your packages, but also apply a series of fixes and tweaks to the created template which keep the fact that you don't have a production `Microsoft.AspNetCore.App` from interfering.
1. The ASP.NET localhost development certificate must also be installed and trusted or else you'll get a test error "Certificate error: Navigation blocked".
** Note** Templating tests require Visual Studio unless a full build (CI) is performed. ** Note** Templating tests require Visual Studio unless a full build (CI) is performed.

View File

@ -26,7 +26,7 @@ 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/bin/Debug/netcoreapp3.0/TemplateTests.props"" /> <Import Project=""$PSScriptRoot/../test/bin/Debug/netcoreapp3.0/TestTemplates/TemplateTests.props"" />
<ItemGroup> <ItemGroup>
<PackageReference Include=""Microsoft.NET.Sdk.Razor"" Version=""`$(MicrosoftNETSdkRazorPackageVersion)"" /> <PackageReference Include=""Microsoft.NET.Sdk.Razor"" Version=""`$(MicrosoftNETSdkRazorPackageVersion)"" />
</ItemGroup> </ItemGroup>