Skip to content

Visual Studio does not retain 'Do not use top-level statements' check. #41631

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
1 task done
TanvirArjel opened this issue May 11, 2022 · 12 comments · Fixed by #42311
Closed
1 task done

Visual Studio does not retain 'Do not use top-level statements' check. #41631

TanvirArjel opened this issue May 11, 2022 · 12 comments · Fixed by #42311
Assignees
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates enhancement This issue represents an ask for new feature or an enhancement to an existing one feature-templates
Milestone

Comments

@TanvirArjel
Copy link
Contributor

TanvirArjel commented May 11, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

First of all, thank you ASP.NET Core Team for adding an option in templates to avoid top-level statement.

However, we have noticed that Visual Studio is not retaining the Do not use top-level statement check.

First Time:

Capture1

Second Time:

Capture2

Note: All other checks are retaining their last choice.

Expected Behavior

Check should retain the last choice.

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version

6.0.300 and 7.0.100-preview.4.22252.9

Anything else?

Visual Studio Version: 2022 17.3 preview 1.

@TanayParikh
Copy link
Contributor

cc/ @DamianEdwards as I believe this was recently added.

@mkArtakMSFT
Copy link
Contributor

This seems to be a feedback for VS, isn't it ?

@TanvirArjel
Copy link
Contributor Author

@mkArtakMSFT Is it not part of templating? However, please redirect to the appropriate channel.

@DamianEdwards
Copy link
Member

@phenning

@javiercn javiercn added the External This is an issue in a component not contained in this repository. It is open for tracking purposes. label May 11, 2022
@phenning
Copy link
Contributor

We don't by default save the previous choice of any "custom" parameters. Custom here meaning anything below the Docker choices in the UI.

Templates must opt into this explicitly. We do have some mechanisms where we can override this in Visual Studio, or it can be done directly in the host file. @DamianEdwards I'll ping you offline to see how we want to approach this.

@DamianEdwards DamianEdwards self-assigned this May 11, 2022
@DamianEdwards DamianEdwards added this to the 7.0-preview5 milestone May 11, 2022
@mkArtakMSFT mkArtakMSFT added the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label May 11, 2022
@DamianEdwards
Copy link
Member

DamianEdwards commented May 11, 2022

Details for the change we need to make to the ide.host.json for each web project template, including the console template, in 7.0:

{
  "id": "UseProgramMain",
  "isVisible": true,
  "PersistenceScope": "Shared",
  "PersistenceScopeName": "Microsoft"
}

@phenning is going to ensure that once we make this change in 7.0, any customer with both 6.x and 7.0 installed will see this option become sticky for all versions of the template available, i.e. it will become sticky in 6.x templates too.

/Cc @vlada-shubina

@TanvirArjel
Copy link
Contributor Author

Hello @DamianEdwards , Here is another issue: #41636

@DamianEdwards
Copy link
Member

Thanks, that's a known issue that we're currently working on getting a fix in to 7.0 and 6.0 for (#41491).

@mkArtakMSFT mkArtakMSFT added enhancement This issue represents an ask for new feature or an enhancement to an existing one and removed External This is an issue in a component not contained in this repository. It is open for tracking purposes. labels May 24, 2022
@ghost
Copy link

ghost commented May 24, 2022

Thanks for contacting us.

We're moving this issue to the .NET 7 Planning milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. We will re-evaluate this issue, during our next planning meeting(s).
If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues.
To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

@mkArtakMSFT mkArtakMSFT modified the milestones: .NET 7 Planning, 7.0-rc1 Jun 8, 2022
DamianEdwards added a commit that referenced this issue Jun 20, 2022
- Make option values sticky in VS
- Remove unused sections in ide.host.json

Fixes #41638 #41637 #41631
@DamianEdwards DamianEdwards linked a pull request Jun 20, 2022 that will close this issue
DamianEdwards added a commit that referenced this issue Jun 21, 2022
- Make option values sticky in VS
- Remove unused sections in ide.host.json

Fixes #41638 #41637 #41631
@TanvirArjel
Copy link
Contributor Author

TanvirArjel commented Jul 13, 2022

@DamianEdwards I have checked with .NET SDK 6.0.7 and 7.0.0 preview6 with Visual Studio 2022 version 17.3 Preview 3. The issue has not been fixed.

@phenning
Copy link
Contributor

@DamianEdwards I was looking at another related issue this morning and saw this, so I took a look. It looks like Preview 3 did not have the 7.0.0 preview6 version that had this change. It looks like 7.0.100-preview.6.22352.1 SDK does have the fix though.

@DamianEdwards
Copy link
Member

Yeah this fix is in the 7.0 SDK and thus will only apply to 6.0 projects when 7.0.100-preview.6 is installed. VS 17.4 will default to including .NET 7 SDK at which point this will be fixed for 6.0 projects too.

@ghost ghost locked as resolved and limited conversation to collaborators Aug 13, 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 enhancement This issue represents an ask for new feature or an enhancement to an existing one feature-templates
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants