aspire: [WebToolsE2E] With VS 17.10 P1 installed (including Aspire 8.0 P3), if we then install .NET SDK 9.0 P1, VS does not show the Aspire templates anymore

REPRO STEPS

  1. Clean machine: Win11 x64 23h2 ENU
  2. Install VS 17.10 Preview 1 (includes .NET SDK 8.0.200 and .NET Aspire workload 8.0 Preview 3)
  3. Open VS, create new solution using ‘Aspire Starter Application’ template, build and run using VS – it works fine
  4. Close VS
  5. Install .NET SDK 9.0 Preview 1
  6. Open VS

ACTUAL During project creation,

  • The ‘Aspire Starter Application’ and other aspire templates don’t show up in VS New project dialog anymore image
  • When creating a new web app or api app, the ‘Enlist in Aspire’ checkbox does not show up in New Project dialog image

If you go to command-line and run dotnet --info, it incorrectly shows that the 9.0 Aspire workload is installed, even though I didn’t run any commands to install the 9.0 Aspire workload.

image

image

EXPECTED During project creation,

  • VS should continue to show the 8.0 Aspire templates
  • When creating a new web app or api app, the ‘Enlist in Aspire’ checkbox should show up in New Project dialog

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 2
  • Comments: 15 (14 by maintainers)

Most upvoted comments

SET VS_TEMPLATELOCATOR_SDKVERSION=version

Where version is any of:

dotnet --info

.NET SDKs installed:
  6.0.419 [C:\Program Files\dotnet\sdk]
  7.0.406 [C:\Program Files\dotnet\sdk]
  8.0.100-rtm.23523.3 [C:\Program Files\dotnet\sdk]
  8.0.200 [C:\Program Files\dotnet\sdk]
  8.0.300-preview.24101.10 [C:\Program Files\dotnet\sdk]
  9.0.100-preview.1.24101.2 [C:\Program Files\dotnet\sdk]

for example (via cmd shell) SET VS_TEMPLATELOCATOR_SDKVERSION=8.0.300-preview.24101.10

When this is set, there will be an additional entry in the VS Activity log similar to the following. This should help in diagnosing issues where people get “stuck” on an unexpected version. sdk version override: 8.0.300-preview.24101.10

@joperezr The environment variable workaround is in, but I have a better one.

I currently have a change in flight for 17.10 preview 2 which will allow for multiple versions of the same template pack to be installed, either by the SDK locator, or via dotnet new.

With this new change, we can work around the issue by running

dotnet new install [path to 8.0 template pack under PF\dotnet\template_packs]

Keep in mind that templates installed this way will have precedence over those installed from the SDK, so it is critical to run the uninstall command after the manifest updates get into the product.

Or, via manifest update, these are changes which could be made today with the existing names and identities of the template packs: This assumes that there are template packs called Aspire.ProjectTemplates.9.0.0-preview.1.24113.3 and Aspire.ProjectTemplates.8.0.0-preview.3.24105.21 on disk. This requires the change I just made in WebTools due to the template packs being passed to us have the same identity, and we would normally just take the highest versioned template pack. Allowing this was a simple configuration change in the WebTools host. The challenge here is keeping the net8 version number in sync in the net 9 manifest.

"Aspire.ProjectTemplates.net9": {
   "kind": "template",
   "version": "9.0.0-preview.1.24113.3",
   "alias-to": {
     "any": "Aspire.ProjectTemplates"
   }
 },
 "Aspire.ProjectTemplates.net8": {
   "kind": "template",
   "version": "8.0.0-preview.3.24105.21",
   "alias-to": {
     "any": "Aspire.ProjectTemplates"
   }
 },

Alternatively, when/f the template packs are renamed to indicate net8 vs net9, we can drop the ‘alias-to’, these assume that This assumes that there are template packs called Aspire.ProjectTemplates.net9.9.0.0-preview.1.24113.3 and Aspire.ProjectTemplates.net8.8.0.0-preview.3.24105.21 on disk. This manifest change would not have needed the workaround I just checked into WebTools, as the nupkg identities would have actually been distinct.

    "Aspire.ProjectTemplates.net9": {
      "kind": "template",
      "version": "9.0.0-preview.1.24113.3"
    },
    "Aspire.ProjectTemplates.net8": {
      "kind": "template",
      "version": "8.0.0-preview.3.24105.21"
    },