Unity Visual Studio Solution Generator
Improves Visual Studio solution generation for multi-package Unity projects by streamlining the project hierarchy and enabling file renaming in local packages. Supports modern SDK-style project files with enhanced code analyzer support, replacing Unity's default Visual Studio C# integration for cleaner organization and better developer productivity.
com.github-joc0de.visual-studio-solution-generator Install via UPM
Add to Unity Package Manager using this URL
https://www.pkglnk.dev/visual-studio-solution-generator.git?path=src/UnityVisualStudioSolutionGenerator/Assets README Markdown
Copy this to your project's README.md
## Installation
Add **Unity Visual Studio Solution Generator** to your Unity project via Package Manager:
1. Open **Window > Package Manager**
2. Click **+** > **Add package from git URL**
3. Enter:
```
https://www.pkglnk.dev/visual-studio-solution-generator.git?path=src%2FUnityVisualStudioSolutionGenerator%2FAssets
```
[](https://www.pkglnk.dev/pkg/visual-studio-solution-generator)Dependencies (2)
README
Unity Visual Studio Solution Generator
Visual Studio Solution Generator for Unity to improve developer productivity when working with multi-package unity projects. This package intercepts the Visual Studio Solution generation done by Unity's Visual Studio C# integration. It preforms the following changes to the solution / project files:
Reduced project hierarchy
Placing projects next to code so the file hierarchy inside Visual Studio Solution Explorer is cleaner.
| Solution generated by Unity | Solution generated by this package |
|---|---|
![]() |
![]() |
Allow renaming files from local package dependencies
In the normal Solution generated by Unity projects of local package dependencies are referenced as a Link. This has the side effect that you can't rename the file using Visual Studio. The Visual Studio Solution generated by this package creates the project file (the .csproj) inside the folder containing the local package therefore the .cs files are imported as normal files -> they can be renamed.
Allow generating project file in the new SDK-Style
Currently the C# project files (.csproj) generated by the Unity Visual Studio integration are using the legacy (non-SDK-style) project format normally used by .NET Framework. We provide a option to generate SDK-style project files.
Advantages of using SDK-style projects:
- More default enabled code analyzers
- Better tooling support so e.g. it provides the ability to add additional code analyzers as NuGet package e.g. StyleCop or Sonar Analyzer. Just create a
Directory.Build.propsin any parent directory of your Unity project (the settings apply to all .csproj files below it) and add the NuGet packages asPackageReferenceitems for example see src/Directory.Build.props and Microsoft documentation.
Note: All changes related to the generated
.csprojfiles or settings changes usingDirectory.Build.propsonly work inside Visual Studio, Unity build doesn't recognize them. So e.g. analyzer warnings of analyzers configured insideDirectory.Build.propsare only visible inside Visual Studio, not inside Unity build logs.
Disadvantages of using SDK-style projects:
- The Visual Studio Unity Plugin doesn't detect the projects as Unity Projects this leads to some changes in the behavior of Visual Studio so e.g. to start debugging instead of
Attach to Unityyou need to useDebug -> Attach Unity Debugger
.
Settings
This package tries to be customizable to match individual requirements. So it has many configuration options, they can changed using the Preferences UI that can be opened directly using the custom menu item Visual Studio -> Preferences or using Edit -> Project Settings -> Visual Studio Solution Generator. All settings are stored per project inside the file: ProjectSettings/Packages/com.github-joc0de.visual-studio-solution-generator/Settings.json. 


No comments yet. Be the first!