Skip to content

Latest commit

 

History

History
75 lines (47 loc) · 2.85 KB

File metadata and controls

75 lines (47 loc) · 2.85 KB

How to Build dotnet scaffold

This guide is based on my experience installing and running the dotnet scaffold repository locally.

📦 Repository Location

Clone the repository from GitHub:

https://github.com/dotnet/Scaffolding

I recommend cloning it under your user profile directory.

🚀 Getting Started: Dev loop

  1. Navigate to the cloned Scaffolding directory. Edit as needed.

  2. Install dev package

    from cmd: run scripts\install-scaffold.cmd OR from powershell run: scripts\install-scaffold.sh

    These scripts will install the Nuget Packages associated with your local changes on your machine.

  3. Test changes

    From a cmd (or powershell), test your changes locally. Run dotnet scaffold or the command you are trying to test. For debugging testing, attach the debugger as outlined below and repeat these steps.

🧪 Debugging Setup

  1. Open the all.sln solution in a separate instance of Visual Studio.

  2. Set any breakpoints you want to hit.

  3. Before running the install script, add the following line near the top of the project you want to debug (e.g., dotnet-scaffold-aspnet, etc.):

    System.Diagnostics.Debugger.Launch();

    This will automatically launch a debugger. Otherwise, you’ll need to attach one manually.

  4. In a terminal, navigate to a project that is ready for scaffolding (a relatively blank project with a basic model class).

  5. Run dotnet scaffold from there.

✅ Requirements

⚠️ Things to Watch Out For

  • .config folders in the root of either the scaffolding project or the project you're scaffolding.
  • Missing or overlapping SDK versions:
    • I encountered issues with two .NET 10.0 preview versions and had to delete the newer one.

How to Install the most recent packages

  1. generate a personal access token (PAT). a. go to Azure DevOps b. click the User settings next to your picture in the top right c. click on Personal Access Token toward the bottom of the menu d. click "+ New Token" and copy it. You will need this token to run the following scripts

  2. Log in to az CLI with your Microsoft account with az login

  3. set your PAT environment variable with running $env:PAT = [your PAT]

  4. run scripts\download-artifacts.ps1 optionally, specify the branch for example: powershell.exe -File c:\Scaffolding\scripts\download-artifacts.ps1 -Branch release/10.0, branch defaults to main

  5. Ensure that the correct versions are installed. The installed packages should be Microsoft.dotnet-msidenity, dotnet-aspnet-codegenerator, and Microsoft.dotnet-scaffold.