Open ThomasMader opened 1 year ago
Is the application you're running targeting net7.0? EnablePreviewFeatures only works on the latest TFM for the SDK being used and it's possible that changing the working directory changes which SDK ends up getting used (because of a global.json or other reason).
CC @terrajobst @jaredpar
Is there an issue with the uploaded solution for you? Otherwise all your questions are answered by that solution. To me it looks like it should not matter which SDK is used, in the end it should compile nevertheless.
I compiled successfully by adding lines
Describe the bug
Running the test project using
dotnet run --project <someAbsolutePath>\ConsoleApp1\ConsoleApp1\ConsoleApp1.csproj
works if the current working directory is<someAbsolutePath>\ConsoleApp1
but if it is<someAbsolutePath>
theEnablePreviewFeatures
setting is somehow not recognized because it leads to the following error.error CS8703: The modifier 'abstract' is not valid for this ite m in C# 10.0. Please use language version '11.0' or greater.
To Reproduce
Use the description of the bugs with the attached ConsoleApp1 solution.
Further technical details
ConsoleApp1.zip
.NET SDK: Version: 7.0.102 Commit: 4bbdd14480
Runtime Environment: OS Name: Windows OS Version: 10.0.19042 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\7.0.102\
Host: Version: 7.0.2 Architecture: x64 Commit: d037e070eb
.NET SDKs installed: 6.0.405 [C:\Program Files\dotnet\sdk] 7.0.102 [C:\Program Files\dotnet\sdk]
.NET runtimes installed: Microsoft.AspNetCore.App 6.0.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 6.0.13 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found: x86 [C:\Program Files (x86)\dotnet] registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables: Not set
global.json file: Not found
Learn more: https://aka.ms/dotnet/info
Download .NET: https://aka.ms/dotnet/download`