Closed Romaleks360 closed 4 days ago
@Romaleks360 Sorry you are running into issues. The C# extension for VS Code does not have a 'New Class' command. I think this would be an issue for the csharpextensions extension.
@Romaleks360 Sorry you are running into issues. The C# extension for VS Code does not have a 'New Class' command. I think this would be an issue for the csharpextensions extension.
Hello @JoeRobich! Thank you for your reply. Sure it doesn't, but this is not the point of my issue. The point is when I create a new .cs file inside VSCode (either manually in Explorer or via csharpextensions, doesn't matter), it isn't included in the project and exists in some temp project generated by OmniSharp. I can't reference this class in the project, and I can't reference project entities inside this new class as well. Without csharpextensions the result is the same. Creating a new file inside Visual Studio or Unity results in a new class being added to the project immediately. I can begin referencing other classes of my project inside the new file right after creating it. Unfortunately, this doesn't work in VSCode for me. I have to manually add this new file to the project by editing or regenerating .csproj.
I did my best to describe the problem well. I am ready to add more info if needed.
Doesn't Unity use old-style .NET projects, where each file must be manually added to the compilation in csproj file? OmniSharp doesn't take care of doing that, you need to do it manually.
Doesn't Unity use old-style .NET projects, where each file must be manually added to the compilation in csproj file? OmniSharp doesn't take care of doing that, you need to do it manually.
You are right. Yet it would be very convenient to automate this process, as Visual Studio does. Doing it manually takes a lot of time, and it's an absolute must-have feature. I basically can't create a new editable file without leaving VSCode, that's weird.
It is now recommended to use the Unity extension for VS Code.
Issue Description
New files created in the Explorer panel (either manually or via the C# Extensions "New Class" option) are not included in the current project. IntelliSense works in them, but they belong to OmniSharpMiscellaneousFiles.csproj.
I am using VSCode with Unity. I found two ways to add a new file to the project:
I want this process to be done automatically.
Steps to Reproduce
Create a project with Unity, add a new .cs file in the Explorer panel.
Expected Behavior
The new file is added to the project.
Actual Behavior
The file is not included in the current project. OmniSharp Log shows this warning:
Logs
OmniSharp log
Environment information
VSCode version: 1.61.2 C# Extension: 1.23.16
Dotnet Information
����� SDK ��� .NET (��ࠦ��騩 �� global.json): Version: 5.0.402 Commit: e9d3381880 �।� �믮������: OS Name: Windows OS Version: 10.0.17763 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\5.0.402\ Host (useful for support): Version: 5.0.11 Commit: f431858f8b .NET SDKs installed: 5.0.402 [C:\Program Files\dotnet\sdk] .NET runtimes installed: Microsoft.AspNetCore.App 5.0.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 5.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 5.0.11 [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| |---|---|---| |cpptools|ms-vscode|1.7.1| |csharp|ms-dotnettools|1.23.16| |csharpextensions|jchannon|1.3.1| |material-icon-theme|PKief|4.10.0| |shader|slevesque|1.1.5| |unity-debug|Unity|3.0.2|;