JoC0de / UnityVisualStudioSolutionGenerator

Visual Studio Solution Generator for Unity to improve developer productivity when working with multi-package unity projects
MIT License
9 stars 1 forks source link

Failed to generate csproj errors for embedded packages #5

Closed laicasaane closed 1 year ago

laicasaane commented 1 year ago

Tested on this project https://github.com/Dreaming381/lsss-wip

Environment:

Unity 2022.3.8f1 With "Visual Studio Editor 2.0.20" package installed.

Generating Visual Studio Solution file (latios-spaceshooter-wip.sln) failed with: System.InvalidOperationException: The csproj file 'D:\Projects\latios-spaceshooter-wip\Unity.ShaderGraph.Editor.csproj' need to have exactly one '.asmdef' file but it has ['']
  at UnityVisualStudioSolutionGenerator.ProjectFileGeneratorBase.ExtractAssemblyDefinitionFilePath () [0x000b2] in .\Library\PackageCache\com.github-joc0de.visual-studio-solution-generator@1.0.0\Editor\ProjectFileGeneratorBase.cs:227 
  at UnityVisualStudioSolutionGenerator.ProjectFileGeneratorBase.get_AssemblyDefinitionFilePath () [0x00000] in .\Library\PackageCache\com.github-joc0de.visual-studio-solution-generator@1.0.0\Editor\ProjectFileGeneratorBase.cs:72 
  at UnityVisualStudioSolutionGenerator.ProjectFileGeneratorBase.IsProjectFromPackage () [0x00000] in .\Library\PackageCache\com.github-joc0de.visual-studio-solution-generator@1.0.0\Editor\ProjectFileGeneratorBase.cs:96 
  at UnityVisualStudioSolutionGenerator.ProjectFileGeneratorBase.DetermineNewProjectFilePath (System.String projectFilePath) [0x0000d] in .\Library\PackageCache\com.github-joc0de.visual-studio-solution-generator@1.0.0\Editor\ProjectFileGeneratorBase.cs:87 
  at UnityVisualStudioSolutionGenerator.VisualStudioAssetPostprocessor+<>c.<DetermineNewSolutionProjects>b__5_1 (UnityVisualStudioSolutionGenerator.ProjectFile project) [0x00000] in .\Library\PackageCache\com.github-joc0de.visual-studio-solution-generator@1.0.0\Editor\VisualStudioAssetPostprocessor.cs:141 
  at System.Linq.Enumerable+SelectListIterator`2[TSource,TResult].ToList () [0x0002a] in <f3cb625e9a3f437991ebaf58a99c81f7>:0 
  at System.Linq.Enumerable.ToList[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x0001f] in <f3cb625e9a3f437991ebaf58a99c81f7>:0 
  at UnityVisualStudioSolutionGenerator.VisualStudioAssetPostprocessor.DetermineNewSolutionProjects (System.String currentSolutionContent, System.String solutionDirectoryPath) [0x00035] in .\Library\PackageCache\com.github-joc0de.visual-studio-solution-generator@1.0.0\Editor\VisualStudioAssetPostprocessor.cs:140 
  at UnityVisualStudioSolutionGenerator.VisualStudioAssetPostprocessor.OnGeneratedSlnSolution (System.String path, System.String content) [0x00036] in .\Library\PackageCache\com.github-joc0de.visual-studio-solution-generator@1.0.0\Editor\VisualStudioAssetPostprocessor.cs:98 

image

image

JoC0de commented 1 year ago

Hi @laicasaane thanks for the bug report. I fixed it, release is pending … But e.g. Unity.ShaderGraph.Editor is not a embedded package. Unity doesn't always delete packages from .sln so it looks like you once enabled 'Build-in packages' and they are still in the solution. For now I keep the project files of Packages (all the ones that are inside the PackageCache and not locally) untouched.