Open mwaaas opened 1 year ago
Willing to contribute in fixing this if I get some help
I've got the same issue right now.
@jpringle1 @CalebFrancis @mwaaas We are evaluating the best way to support .NET Framework projects within C# Dev Kit and we would like to understand some more things about the types of work being done and the most important features you would like to use in C# Dev Kit for these projects.
We look forward to hearing your feedback!
Known at this point - C# dev kit not supporting .NET framework
@webreidi
IMO the most important features in lieu of full support would be the ability to at least edit code i.e. language server integration / intellisense. Running tests, debugging etc. can all take place in traditional IDEs such as Visual Studio, and building an (essentially) new IDE for a framework that was essentially superceded 5 years ago would not be the best use of time in my opinion (and I maintain several .NET Framework projects in my day job). Is this issue going to be used to track any work done in this space? Or will a new issue be created to set expectations / track progress (if or when that ever happens)?
@peabnuts123 thank you for the feedback. We are using this issue to understand the types of .NET Framework projects that developers want to edit in VS Code and the types of features that would make their lives easier for those types of projects. We will update this issue if we add anything new for handling .NET Framework projects.
Currently, if you have C# Dev Kit installed and try to open a .NET Framework project, you will get a pop-up telling you that it is not currently supported in C# Dev Kit and offering for you to set to use the C# extension for that project. If you set the setting, while you are editing that project, the C# extension will take over and load the project and provide language server integration and IntelliSense. This setting is on a per-project basis, so if you open another .NET 6, 7, or 8 project, C# Dev Kit will take back over and provide all the extra features.
Ah I see, interesting. I had thought the C# extension was kind of braindead now without omnisharp (syntax highlighting - formatting and the like)! Thanks for the advice :)
@peabnuts123 we updated the C# extension to be LSP-based and to utilize Roslyn, the same used in Visual Studio for syntax highlighting error handling, IntelliSense and so much more. It provides the language services for C# Dev Kit.
@webreidi, thanks a lot for clarifying how we can activate language server / IntelliSense on a project-by-project basis. It would be really helpful if the error message from C# Dev Kit were to suggest that setting as an alternative to migrating to .NET 5+. Sometimes, it is absolutely necessary to edit legacy .NET Framework 4.x projects, to urgently fix bugs in legacy systems, for example. And now that Visual Studio for Mac is retired, VS Code is really the only remaining option for Mac users.
I had quite a hard time finding out about the “Dotnet: Prefer CSharp Extension” setting. In fact, this thread is the only pointer that I have found so far. Thus, for the benefit of other Mac users, please update the error messages with either an explicit reference, or a link to a documentation page that explains the options.
@Michael-Eng let's review the toast message that pops up when a .Net Framework project is detected. I thought we give them the option to enable the "Prefer C#" flag but want to check to make sure. Also, do we message if they click on the error in SE?
Hi @webreidi, I now realize that the popup indeed offers to set the project up for legacy .NET Framework use, but on my machine, at least, it is only shown for 15 seconds (I timed it just now), which is not a lot of time to digest the information and choose to click the button. That must be why I previously missed it. I instead chose to look at the warning and error messages displayed when clicking the red button, which just were just of this kind:
The project file '….csproj' is in unsupported format (for example, a traditional .NET Framework project). It need be converted to new SDK style to work in C# Dev Kit.
Failed to load project '….csproj'. One or more errors occurred. (This project is not supported in C# Dev Kit.)
I can confirm that the button in the popup does work, though, and performs exactly the right settings change. Only, I previously never noticed it.
Describe the Issue
Loading a net framework project failing with the following error
is in unsupported format (for example, a traditional .Net Framework project). It need be converted to new SDK style to work in C# Dev Kit.
For ominsharp I was using this settings to work
"omnisharp.useModernNet": false, "omnisharp.projectLoadTimeout": 120,
and this extra ominsharp setting json
{ "msbuild": { "enabled": true, "ToolsVersion": null, "VisualStudioVersion": null, "Configuration": null, "Platform": null, "EnablePackageAutoRestore" : false, "MSBuildExtensionsPath": null, "TargetFrameworkRootPath" : null, "MSBuildSDKsPath": null, "RoslynTargetsPath" : null, "CscToolPath": null, "CscToolExe": null, "loadProjectsOnDemand": false, "GenerateBinaryLogs": false }, "MSBuild": { "msbuildoverride": { "MSBuildPath": "\Current\Bin",
"Name": "OmniSharp MSBuild"
}
}
}
And it was working as expected.
Steps To Reproduce
No response
Expected Behavior
No response
Environment Information
No response