Open roumcha opened 2 years ago
@roumcha You really are on the cutting edge if you have a .NET 8 SDK installed. =)
.NET SDKs installed:
8.0.100 [C:\Program Files\dotnet\sdk]
@filipw Should we update the script support to use default references based on which TFM O# was built against?
@JoeRobich Oops, I will fix it🙃
I will move this to OmniSharp Roslyn. Indeed, it would make sense to use default references based on O# TFM.
@roumcha in your case the problem is your configuration was invalid all along.
the config file should be
{
"script": {
"enableScriptNuGetReferences": true,
"defaultTargetFramework": "net6.0"
}
}
only with enableScriptNuGetReferences
set to true
, the defaultTargetFramework
setting has any effect. Previously, when you set it "net6.0"
only, it was still using the default desktop CLR references from the OmniSharp build.
@filipw Oh I didn't know that. Thanks for telling me!
I have the same problem of CS0103 on Console.WriteLine("Hello, World") for a CSX file.
Using OmniSharp config:
{
"script": {
"enableScriptNuGetReferences": true,
"defaultTargetFramework": "net6.0"
}
}
+1 I have the same problem using the same configuration as @CHerSun
with 1.39.2-net6.0 everything works fine
{
"script": {
"enabled": true,
"enableScriptNuGetReferences": true,
"defaultTargetFramework": "net6.0"
}
}
Issue Description
When editing a script in a folder which contains omnisharp.json but no project, C# extension v1.25.0 gives CS0103 error for
System.Console
.To avoid this, I need create a C# project in the folder.
Is this a bug or expected behavior since v1.25.0?
v1.24.4
v1.25.0
Steps to Reproduce
{ "script": { "defaultTargetFramework": "net6.0" } }
to the folder. (omnisharp.json seems to be needed to avoid a syntax highlighting failure and also avoid CS0518 in a script in a folder with a project)System.Console
doesn't get suggested or syntax-highlighted but gets underlined in red.dotnet new console
in the folder. Reload VSCode.Expected Behavior
Writing script files without creating a project.
Actual Behavior
Logs
OmniSharp log
C# log
Environment information
VSCode version: 1.67.2 C# Extension: 1.25.0
Dotnet Information
.NET SDK (global.json �f): Version: 6.0.300 Commit: 8473146e7d �����^�C����: OS Name: Windows OS Version: 10.0.22000 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\6.0.300\ Host (useful for support): Version: 6.0.5 Commit: 70ae3df4a6 .NET SDKs installed: 6.0.100 [C:\Program Files\dotnet\sdk] 6.0.105 [C:\Program Files\dotnet\sdk] 6.0.300 [C:\Program Files\dotnet\sdk] .NET runtimes installed: Microsoft.AspNetCore.App 6.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.1.25 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.25 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] To install additional .NET runtimes or SDKs: https://aka.ms/dotnet-downloadVisual Studio Code Extensions
|Extension|Author|Version| |---|---|---| |code-runner|formulahendry|0.11.7| |cpptools|ms-vscode|1.9.8| |csharp|ms-dotnettools|1.25.0| |docomment|k--kato|0.1.31| |dotnet-interactive-vscode|ms-dotnettools|1.0.3256010| |gc-excelviewer|GrapeCity|4.2.54| |git-graph|mhutchie|1.30.0| |indent-rainbow|oderwat|8.3.1| |Ionide-fsharp|Ionide|6.0.4| |jupyter|ms-toolsai|2022.4.1021342353| |jupyter-renderers|ms-toolsai|1.0.7| |markdown-all-in-one|yzhang|3.4.3| |markdown-pdf|yzane|1.4.4| |material-icon-theme|PKief|4.17.0| |partial-diff|ryu1kn|1.4.3| |prettier-vscode|esbenp|9.5.0| |python|ms-python|2022.6.2| |r|REditorSupport|2.5.0| |remote-repositories|ms-vscode|0.10.0| |remote-wsl|ms-vscode-remote|0.66.3| |remotehub|GitHub|0.32.0| |vscode-dotnet-runtime|ms-dotnettools|1.5.0| |vscode-drawio|hediet|1.6.4| |vscode-eslint|dbaeumer|2.2.2| |vscode-language-babel|mgmcdermott|0.0.36| |vscode-language-pack-ja|MS-CEINTL|1.67.3| |vscode-markdownlint|DavidAnson|0.47.0| |vscode-pylance|ms-python|2022.5.3| |vscode-regexp-preivew|Lulus|1.0.0| |vscode-yaml|redhat|1.7.0| |xml|DotJoshJohnson|2.5.1|;