Skip to content

With .NET 7.0 SDK, I cannot create .NET 6.0 web project, the target net6.0 can't be found. #39731

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

Closed
Andy-Win opened this issue Jan 24, 2022 · 28 comments
Assignees
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates bug This issue describes a behavior which is not expected - a bug. Done This issue has been fixed External This is an issue in a component not contained in this repository. It is open for tracking purposes. feature-templates
Milestone

Comments

@Andy-Win
Copy link

Repro steps:

  1. Install latest main build VS from main-32123.28 (Run preinstall command first)
  2. Download .NET 7 SDK(7.0.100-alpha.1.22071.3) from main branch of https://github.com/dotnet/installer
  3. Open VS, apply feed: https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet7/nuget/v3/index.json
  4. Open Command Prompt and run"dotnet new mvc -f net6.0 -o Mvc60" to create ASP.NET Core 6.0 MVC project.

Expected Result
The project should be created successfully.

Actual Result:
image
image

dotnet --info
image

@WenJunJi01
Copy link

This issue only occurs on web projects, and creating a .NET 6.0 console/classlib/wpf/winforms project can succeed.
image

Dotnet info:
image

@Andy-Win Andy-Win changed the title Jan 24, 2022
@marcpopMSFT marcpopMSFT transferred this issue from dotnet/installer Jan 24, 2022
@marcpopMSFT
Copy link
Member

From Nicole, this is only a web template issue so routing to aspnet
For Andy’s [New]#13105, it only occurs on web projects, and creating a .NET 6.0 console/classlib/wpf/winforms project can succeed

@Pilchie Pilchie added area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates feature-templates labels Jan 24, 2022
@mkArtakMSFT
Copy link
Contributor

@dougbu any idea why this may be the case?

@mkArtakMSFT
Copy link
Contributor

Also tagging @joeloff in case you have thoughts too

@dougbu
Copy link
Contributor

dougbu commented Jan 24, 2022

@wtgodbe wasn't there an issue in earlier 7.0 SDKs relating to net6.0 templates❔

@wtgodbe
Copy link
Member

wtgodbe commented Jan 24, 2022

There was an issue a couple weeks ago with net7.0 templates in 7.0 SDKs, before the templates were added, but I don't remember 7.0 SDKs having problems with net6.0, that surprises me. I can try to repro after lunch

@mkArtakMSFT
Copy link
Contributor

@wtgodbe do you have any updates here?

@wtgodbe
Copy link
Member

wtgodbe commented Jan 24, 2022

I've confirmed that it repros on the SDK mentioned, but not on an older SDK from October, so something changed recently to introduce this. I'm still investigating

@wtgodbe
Copy link
Member

wtgodbe commented Jan 24, 2022

I believe this is related to dotnet/installer#12946, the error doesn't repro on SDKs before we added the net7.0 templates. @dsplaisted do you know where in dotnet/sdk the error described is getting triggered?

@wtgodbe
Copy link
Member

wtgodbe commented Jan 24, 2022

Also adding @vlada-shubina for the above question

@dsplaisted
Copy link
Member

I think this would be the expected behavior if you just installed the .NET 7 SDK standalone. For the mvc template (and most or all of the ASP.NET ones), you only get the templates for the version of the SDK you have installed. So if you wanted the .NET 6 templates you would also have to install the .NET 6 SDK.

With Visual Studio it works a bit different, so it's possible there's a bug in the setup authoring. But I think the way it's supposed to work in Visual Studio is that you wouldn't get the templates for .NET 6 unless you installed the .NET 6 runtime (as you wouldn't by default be able to run a project targeting 6.0 without the 6.0 runtime).

What versions of the .NET SDK and runtimes are installed? Can you paste the output of dotnet --info from a repro machine?

Also adding @joeloff as he is more familiar with the VS setup authoring.

@MichalPavlik
Copy link
Member

I was debugging the templating engine and there is the ApplyFilters method, where the engine is trying to find a match for parameters. I see it loads templates for all installed versions, but for some reason, in case of the mvc (and maybe other web templates) I can't see loaded templates for version 6. Need more time to investigate.

@joeloff
Copy link
Member

joeloff commented Jan 25, 2022

For VS we insert multiple installers for the templates, e.g. for the 6.0 SDK there would be the 6.0 copies of the 5.0, 3.1 templates. These typically only ship with VS.

@joeloff
Copy link
Member

joeloff commented Jan 25, 2022

I was looking at a local build of the 6.0 templates. The installer we generate for VS is building items that are still marked as 6.0.0-rc2 and some that are marked as 6.0.1.

image

@mkArtakMSFT mkArtakMSFT added the External This is an issue in a component not contained in this repository. It is open for tracking purposes. label Jan 25, 2022
@mkArtakMSFT mkArtakMSFT added this to the 7.0-preview1 milestone Jan 25, 2022
@mkArtakMSFT mkArtakMSFT added the bug This issue describes a behavior which is not expected - a bug. label Jan 25, 2022
@mkArtakMSFT mkArtakMSFT self-assigned this Jan 25, 2022
@dsplaisted
Copy link
Member

@joeloff No, they should ideally be updated to 6.0.100 or whatever the latest version available for the 6.0 band is. For example: https://github.com/dotnet/installer/blob/release/6.0.1xx/eng/Versions.props#L34

@joeloff
Copy link
Member

joeloff commented Jan 25, 2022

Right, but the ASP.NET ones are tracking runtime versions so those should be 6.0.1 or 6.0.2 I think

@wtgodbe
Copy link
Member

wtgodbe commented Jan 25, 2022

It sounds like we should update https://github.com/dotnet/installer/blob/1a828392f79d5d7a391b2a387e962e204fb245cd/eng/Versions.props#L109-L111, but if that was the issue, wouldn't 5.0 Asp.Net templates be broken too because of line 110?

@joeloff
Copy link
Member

joeloff commented Jan 25, 2022

It sounds like we should update https://github.com/dotnet/installer/blob/1a828392f79d5d7a391b2a387e962e204fb245cd/eng/Versions.props#L109-L111, but if that was the issue, wouldn't 5.0 Asp.Net templates be broken too because of line 110?

I'm not sure

@wtgodbe
Copy link
Member

wtgodbe commented Jan 25, 2022

Opened dotnet/installer#13113 to see if it helps

@wtgodbe
Copy link
Member

wtgodbe commented Jan 25, 2022

dotnet/installer#13113 didn't do the trick - @MichalPavlik were you able to get anywhere in your investigation?

@MichalPavlik
Copy link
Member

The package for net6 is loaded and scanned for templates, so it seems they are filtered out later in the process. I'm narrowing down the issue slowly and I hope I will get the answer today.

@MichalPavlik
Copy link
Member

MichalPavlik commented Jan 26, 2022

I believe I found the root cause. There is a deduplication step which basically adds discovered templates to dictionary with template's identity as a key. Templates for net7.0 have still same identity name, so they replaced net6.0 templates.

Changing identity to reflect new version should help. I can create PR for you, but I'm not sure this is only thing you want to modify. I see there is also thirdPartyNotices field with probably old link.

@wtgodbe
Copy link
Member

wtgodbe commented Jan 26, 2022

Thanks! Looks like we should have updated that at the same time we updated branding - I'll push a PR for it & update our documentation.

@mkArtakMSFT
Copy link
Contributor

mkArtakMSFT commented Jan 31, 2022

@wtgodbe is this blocked on dotnet/installer#13125?

@wtgodbe
Copy link
Member

wtgodbe commented Jan 31, 2022

@wtgodbe is this blocked on dotnet/installer#13125?

Yes, and that's blocked on dotnet/sdk#23597, which should get in once CI passes

@dsplaisted
Copy link
Member

The PRs have all merged, so hopefully this is now fixed.

@wtgodbe
Copy link
Member

wtgodbe commented Feb 1, 2022

Confirmed that this is now fixed
Screenshot 2022-02-01 094040
:

@wtgodbe wtgodbe closed this as completed Feb 1, 2022
@wtgodbe wtgodbe added the Done This issue has been fixed label Feb 1, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Mar 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates bug This issue describes a behavior which is not expected - a bug. Done This issue has been fixed External This is an issue in a component not contained in this repository. It is open for tracking purposes. feature-templates
Projects
None yet
Development

No branches or pull requests

10 participants