Tanay Parikh 82565c7b9b Add back strings.json for WebApi-CSharp (#40153) 4 ani în urmă
..
BlazorTemplates.Tests fdbe28e9c3 Skip Playwright Tests Running in Quarantined Pipeline (#40129) 4 ani în urmă
Shared f9de7e4b9d [main] Update dependencies from dotnet/runtime dotnet/efcore (#39853) 4 ani în urmă
TestInfrastructure 1f11b07fa9 !nit! Be consistent about `msbuild` quotes (#40108) 4 ani în urmă
Web.Client.ItemTemplates 7203d56273 Enable template localization (#38867) 4 ani în urmă
Web.ItemTemplates 000c45828d [main] Add the `displayName` Property to Project Template Parameters (#40119) 4 ani în urmă
Web.ProjectTemplates 82565c7b9b Add back strings.json for WebApi-CSharp (#40153) 4 ani în urmă
migrations 33bc4576da Convert ProjectTemplates to build using ProjectReferences (#6935) 7 ani în urmă
scripts 70c05f178a [main] Update dependencies from dotnet/runtime dotnet/efcore (#36328) 4 ani în urmă
test de3019b7da Enable IDE2000 (#39803) 4 ani în urmă
testassets 44c0e6651e Shorten package version properties (#27784) 5 ani în urmă
.gitignore d1aa53721b Add launchSettings.json to worker template (#7550) 7 ani în urmă
.vsconfig 8700479997 Clean up remaining `net461` references (#37731) 4 ani în urmă
Directory.Build.props f072ff85b5 !nits! Build cleanup (#38979) 4 ani în urmă
Directory.Build.targets a8cd18906f Bump spa-templates SHA to pick up local build fix (#34746) 4 ani în urmă
GenerateContent.targets 9fd548ff70 Remove dependency on Internal.AspNetCore.BuildTasks (#33449) 4 ani în urmă
ProjectTemplates.slnf 779db7f3e6 Dougbu/check.solution.filters (#36449) 4 ani în urmă
ProjectTemplatesNoDeps.slnf 0d6b22308a Use spa-templates repo as a submodule (#34366) 4 ani în urmă
README.md a3bb765f38 Running Project Templates Locally Documentation (#40127) 4 ani în urmă
THIRD-PARTY-NOTICES 64a0d0396e Upgrade jQuery in samples to version 3.5.1 (#21577) 5 ani în urmă
TemplateProjects.props affd7e00df [automated] Merge branch 'release/3.1' => 'master' (#15394) 6 ani în urmă
build.cmd a8cd18906f Bump spa-templates SHA to pick up local build fix (#34746) 4 ani în urmă
build.sh 0d6b22308a Use spa-templates repo as a submodule (#34366) 4 ani în urmă
startvs.cmd 3117f43c33 Migrate to single sln file + slnf files (#23581) 5 ani în urmă
templates.nuspec affd7e00df [automated] Merge branch 'release/3.1' => 'master' (#15394) 6 ani în urmă
xunit.runner.json 9829e88a1c [Blazor][Templates] Replaces selenium with playwright for our E2E Tests (#29873) 5 ani în urmă

README.md

Templates

These are project templates which are used in .NET Core for creating ASP.NET Core applications.

Description

The following contains a description of each sub-directory in the ProjectTemplates directory.

  • BlazorTemplates.Tests: Contains the source files for the Blazor template tests, these are currently split out due to not being Helix ready yet.
  • Shared: Contains a collection of shared constants and helper methods/classes including the infrastructure for managing dotnet processes to create, build, run template tests.
  • Web.Client.ItemTemplates: Contains the Web Client-Side File templates, includes things like less, scss, and typescript
  • Web.ItemTemplates: Contains the Web File templates, includes things like: protobuf, razor component, razor page, view import and start pages
  • Web.ProjectTemplates: Contains the ASP.NET Core Web Template pack, including Blazor Server, WASM, Empty, Grpc, Razor Class Library, RazorPages, MVC, WebApi.
  • migrations: Contains migration related scripts.
  • scripts: Contains a collection of scripts that help running tests locally that avoid having to install the templates to the machine.
  • test: Contains the end to end template tests.
  • testassets: Contains assets used by the tests, like a dotnet tools installer

Build

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
  2. 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).
  3. Add the %JAVA_HOME%\bin directory to the PATH environment variable

Microsoft.DotNet.Web.Spa.ProjectTemplates.csproj contains the Single Page Application templates, including Angular, React. This is brought in by a submodule from the dotnet/spa-templates repo.

To build the ProjectTemplates, use one of:

  1. Run eng\build.cmd -all -pack -configuration Release in the repository root to build and pack all of the repo, including template projects.
  2. Run src\ProjectTemplates\build.cmd -pack -configuration Release to produce NuGet packages only for the template projects.
    • This will also build and pack the shared framework.

Note use eng/build.sh or src/ProjectTemplates/build.sh on non-Windows platforms.

Test

Running ProjectTemplate tests:

To run ProjectTemplate tests, first ensure the ASP.NET localhost development certificate is installed and trusted. Otherwise, you'll get a test error "Certificate error: Navigation blocked".

Then, use one of:

  1. Run src\ProjectTemplates\build.cmd -test -NoRestore -NoBuild -NoBuilddeps -configuration Release (or equivalent src\ProjectTemplates\build.sh` command) to run all template tests.
  2. To test specific templates, 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.
  3. Run templates manually with custom-hive and disable-sdk-templates to install to a custom location and turn off the built-in templates e.g.
    • dotnet new -i Microsoft.DotNet.Web.Spa.ProjectTemplates.6.0.6.0.0-dev.nupkg --debug:custom-hive C:\TemplateHive\
    • dotnet new angular --auth Individual --debug:disable-sdk-templates --debug:custom-hive C:\TemplateHive\
  4. Install the templates to an existing Visual Studio installation.
    1. Pack the ProjectTemplates: src\ProjectTemplates\build.cmd -pack -configuration Release
      • This will produce the *dev.nupkg containing the ProjectTemplates at artifacts\packages\Release\Shipping\Microsoft.DotNet.Web.ProjectTemplates.7.0.7.0.0-dev.nupkg
    2. Install ProjectTemplates in local Visual Studio instance: dotnet new -i "<REPO_PATH>\artifacts\packages\Release\Shipping\Microsoft.DotNet.Web.ProjectTemplates.7.0.7.0.0-dev.nupkg"
    3. Run Visual Studio and test out templates manually.
    4. Uninstall ProjectTemplates from local Visual Studio instance: dotnet new --uninstall Microsoft.DotNet.Web.ProjectTemplates.7.0

Note ProjectTemplates tests require Visual Studio unless a full build (CI) is performed.

Note 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 using just dotnet new -i [nupkgPath].

More Information

For more information, see the ASP.NET Core README.