New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[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 #2186
Comments
More information, after installing NET 9.0 The template locator reports no template packages:
Although the workload IS installed:
sdk-manifests\9.0.100-preview.1\microsoft.net.sdk.aspire\9.0.0-preview.1.24079.4\WorkloadManifest.json:
However, no template pack is installed for 9.0:
After running dotnet workload install aspire: Aspire now shows up for net 9.0 - net 8.0 template is totally gone. I believe that needs to happen, is that when 9.0 SDK is installed, the Template Locator must still return the NET 8 templates, so that they can be used by Visual Studio if we expect customers to have both NET 8 and NET 9 SDKs SxS and able to support both 8.0 and 9.0 Aspire on same Dev box. Alternatively, the NET 9 aspire templates could target ALL supported, released TFMs like Winforms do (https://github.com/dotnet/winforms/blob/980b02212d847cc3e9f294bbb900ccb3249bc0a2/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/template.json#L27) @marcpopMSFT, FYI related to template locator and SxS issues in templates |
@joperezr FYI, as well. |
Thanks @phenning, we were actually talking about this problem yesterday in Tactics with @marcpopMSFT. Is there a way to "force" the template location logic to use a specific SDK band? I know that if you already have a project, you can use a global.json that specifies 8.0.200 for example in order for the 9.0.100 one to not get used, but when it comes to brand new projects, there isn't a global.json that can be used. Is there some sort of environment variable to be used as a workaround for this? If not, would it be possible to add it? I understand using environment variables is not a very user friendly solution, but IMO it is better than the current alternative which is to uninstall 9.0 SDK if you want 8.0 aspire templates to come back. |
@joperezr I just tested something like that out Currently we do something like this:
i've updated it to (essentially)
SET OVERRIDE_VARNAME_TBD=8.0.300-preview.24101.10 And box lights up for net8 and doesn't show for 9.0 I think this will be a good interim workaround in 17.10 preview 2 and later until we solve the larger issue. I'll probably add some code to make sure that the override is actually still present as well to guard against stale environments. |
Sounds like @phenning was able to add a way to force a specific version in NPD. Phil, this is different than using global.json though correct as it's only getting the list of templates but will still use the default SDK (which is 9 in this case). Without multi-targeting support in 9, you'd be able to create the template using that ENV but then have to add a global.json, correct? Including @baronfel and @dsplaisted for comment As to the original issue, this was what we wanted documented per the tactics discussion for now until we have a chance to explore better long-term options. Is there a known issue filed yet covering it? |
This would be awesome, @phenning. I do agree with your previous points that we should also make the 9.0 workload of aspire to also support 8.0 Aspire apps and templates, but I think that we should do a multiple-solution approach that both does this, plus adds your environment variable so that users have different options. I know environment variables are not very discoverable or user friendly, but I think that they are at least a step in the right direction for allowing customers to choose how things get resolved. |
Not yet, I wanted to first see our options with you and @phenning, and sounds like we are likely going to get some workarounds in 17.10 P2 which is great. |
If we already had some surface area in Tools/Options for the Template Engine host in VS, I'd say we could add it there instead of env var, but I'm hesitant to add a config page/section for just this. |
@marcpopMSFT to your point about global.json, I just tried this. With NET 9 SDK installed and the ENV set to point to NET 8. It build with the NET 9.0 SDK, but then was runnable and loaded the NET 8 assemblies and runtime, so global.json is optional in this case, I think. |
@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
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.
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.
|
Applied preview 4 milestone for consideration. Please triage and move it out if needed. Note: As Phil mentions above, we have a workaround for this issue now. |
@phenning can you share what the environment variable is and what should the value to set it to? (Path to SDK to use to resolve, SDK version to use, something else?) The dotnet new install trick is also good to have, but as you pointed out, it does feel like a more advanced scenario which can lead to breaks in the future if folks forget to uninstall the packs, so perhaps we should stick with the env variable as the documented workaround? |
Where version is any of:
for example (via cmd shell) 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. |
There is nothing really actionable for this issue so moving out of P5 milestone. We'll keep it open in case people hit this issue as a refcount and so that they can find the workaround (env variable) to set. |
REPRO STEPS
ACTUAL
During project creation,
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.EXPECTED
During project creation,
The text was updated successfully, but these errors were encountered: