Skip to content

After upgrade from net6 preview 7 to rc1, build project which is created with net6 preview 7 with error "C:\Users\v-danche\RC1\before\myconsole\Program.cs(2,1): error CS0103: The name 'Console' does not exist in the current context [C:\Users\v-danche\RC1\before\myconsole\myconsole.csproj]" #20509

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
vdanche opened this issue Sep 2, 2021 · 2 comments
Labels
Area-NetSDK untriaged Request triage from a team member

Comments

@vdanche
Copy link
Member

vdanche commented Sep 2, 2021

Environment:
Windows10
Repro steps
1.Install net6 preview 7 SDK(https://dotnet.microsoft.com/download/dotnet/6.0).
2. Run dotnet new console -o myconsole to create console app.
3. Install the latest net6 rc1--6.0.100-rc.1.21430.44(runtime-6.0.0-rc.1.21430.11) to upgrade.
dotnet build "myconsole" project
We got below error
image

Note: we can build successfully with below workarounds.
Workaround1
Add <ImplicitUsings>enable</ImplicitUsings> to myconsole.csproj file
image

or
Workaround2
Use the old template in program.cs
image

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-NetSDK untriaged Request triage from a team member labels Sep 2, 2021
@KalleOlaviNiemitalo
Copy link
Contributor

I think this is by design because implicit usings were disabled by default per #19521, after having been enabled by default in 6.0 preview 7 only. If you were upgrading from 5.0.* or 6.0 preview 6, the problem would not occur.

@vdanche
Copy link
Member Author

vdanche commented Oct 9, 2021

close it by design

@vdanche vdanche closed this as completed Oct 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-NetSDK untriaged Request triage from a team member
Projects
None yet
Development

No branches or pull requests

2 participants