Skip to content
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

With .NET 6 Preview6, build netstandard2.0 classlib failed with error: CSC : error CS8630: Invalid 'nullable' value: 'Enable' for C# 7.3. Please use language version '8.0' or greater. #3297

Closed
NicoleWang001 opened this issue Jun 16, 2021 · 11 comments · Fixed by #3318
Assignees
Labels
triaged The issue was evaluated by the triage team, placed on correct area, next action defined.

Comments

@NicoleWang001
Copy link
Member

Repro steps:

  1. Install .NET 6 Preview6 SDK
  2. Create a new netstandard2.0 classlib and build it

Expected Result:
Classlib could be built successfully

Actual Result:
build netstandard2.0 classlib failed with error:

Microsoft (R) Build Engine version 17.0.0-preview-21304-01+a5ea6d2ca for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
 
  Determining projects to restore...
  All projects are up-to-date for restore.
  You are using a preview version of .NET. See: https://aka.ms/dotnet-core-preview
CSC : error CS8630: Invalid 'nullable' value: 'Enable' for C# 7.3. Please use language version '8.0' or greater. [/home/nicole/myclass1/myclass1.csproj]
 
Build FAILED.
 
CSC : error CS8630: Invalid 'nullable' value: 'Enable' for C# 7.3. Please use language version '8.0' or greater. [/home/nicole/myclass1/myclass1.csproj]
    0 Warning(s)
    1 Error(s)
 
Time Elapsed 00:00:00.83

Note: It not repro with .NET 6 Preview5

Dotnet info:
.NET SDK (reflecting any global.json):
Version: 6.0.100-preview.6.21315.23
Commit: 8f09936962

Runtime Environment:
OS Name: Windows
OS Version: 10.0.19043
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\6.0.100-preview.6.21315.23\

Host (useful for support):
Version: 6.0.0-preview.6.21306.1
Commit: 5b8e1780ad

.NET SDKs installed:
6.0.100-preview.5.21302.13 [C:\Program Files\dotnet\sdk]
6.0.100-preview.6.21315.23 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.0-preview.5.21301.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0-preview.6.21306.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.0-preview.5.21301.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.0-preview.6.21306.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.0-preview.5.21301.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.0-preview.6.21305.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download

@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@NicoleWang001
Copy link
Member Author

Adding binary log via dotnet build myclass.csproj /bl:out.binlog
out.binilog.zip

@jaredpar
Copy link
Member

The project file has the following structure

  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
    <Nullable>enable</Nullable>
  </PropertyGroup>

The default language version for “netstandard2.0” is 7.3 and that is not compatible with enable. Either the element needs to be removed or needs to be explicitly set to 8.0 or higher.

Closing as the behavior for the SDK + Compiler is as expected given this project file structure.

@richaverma1
Copy link

@NicoleWang001, @jaredpar, this is a template issue then. @dsplaisted who owns the netstandard classlib template?

@richaverma1 richaverma1 reopened this Jun 17, 2021
@dsplaisted dsplaisted transferred this issue from dotnet/sdk Jun 17, 2021
@dsplaisted
Copy link
Member

@jmarolf It looks like #3173 broke the class library template when created for .NET Standard 2.0. Probably it also broke other target frameworks where the default language version doesn't support nullable.

@jmarolf
Copy link
Contributor

jmarolf commented Jun 17, 2021

The tests don't crate netstandard version of the templates? I'll submit a fix here

@jmarolf jmarolf self-assigned this Jun 17, 2021
@vlada-shubina vlada-shubina added the triaged The issue was evaluated by the triage team, placed on correct area, next action defined. label Jun 22, 2021
@vdanche
Copy link
Member

vdanche commented Jun 25, 2021

it has been fixed on 6.0.100-preview.6.21323.12(runtime-6.0.0-preview.6.21323.11)

image

@Amy-Li03
Copy link

Amy-Li03 commented Oct 9, 2021

We also encounter this issue on .NET SDK 6.0.100 - rc.2.21505.57 which inserted into 17.0 Preview 5, when multi- target Frameworks, the error message pops up after build WinForms project.
<TargetFrameworks>net472;net6.0-windows</TargetFrameworks>
image

@vlada-shubina
Copy link
Member

@Amy-Li03 have you followed this guidance when creating the multi-target framework project? dotnet/docs#25383

thanks

@Amy-Li03
Copy link

@vlada-shubina We just want to use .NET framework designer in .NET core project, firstly create a WinForms project targeting .NET 6.0 by default, then in XXX.csproj file change TargetFramework from <TargetFramework>net6.0-windows</TargetFramework> to <TargetFrameworks>net48;net6.0-windows</TargetFrameworks>,
after build this project, will pop up above error message, please correct us if we have done something wrong.

@vlada-shubina
Copy link
Member

@Amy-Li03 please double check wtih dotnet/winforms for this case, I'm not sure, if it's supported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triaged The issue was evaluated by the triage team, placed on correct area, next action defined.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants