Search Unity

Feedback Could Unity add csproj of each package project into the solution file?

Discussion in 'Package Manager' started by jayatubi, May 15, 2019.

  1. jayatubi

    jayatubi

    Joined:
    Dec 9, 2013
    Posts:
    74
    The vs sln file generated by Unity editor only contains the project under Assets folder. However, there are also csproj files for each package project next to the sln file. Could Unity editor involve these package project csproj files into the sln as well?
     
  2. mathieur

    mathieur

    Unity Technologies

    Joined:
    Jul 22, 2015
    Posts:
    29
    This should be what is happening. What version of Unity are you using?
     
  3. jayatubi

    jayatubi

    Joined:
    Dec 9, 2013
    Posts:
    74
    I'm using the 2018.3.10f1. I could see the csproj file generated but they were not added to the sln file.
     
  4. mathieur

    mathieur

    Unity Technologies

    Joined:
    Jul 22, 2015
    Posts:
    29
    That's strange. I just tested it and it does seem to work, albeit I am using 2018.3.12f1. If you have a simple project which reproduces the issue I could take further look.

    Screen Shot 2019-05-16 at 10.58.17 AM.png

    Screen Shot 2019-05-16 at 10.58.26 AM.png
     
  5. jayatubi

    jayatubi

    Joined:
    Dec 9, 2013
    Posts:
    74

    Maybe you misunderstood what I meant.

    I meant the projects from the Asset folder, such as my own code or asmdef project, would be generated and added into the solution file.

    But the projects from the packages, which were installed via Package Manager, would NOT be added into the solutions file.
     
  6. mathieur

    mathieur

    Unity Technologies

    Joined:
    Jul 22, 2015
    Posts:
    29
    Ah! I see what you mean. So I believe that only the in-development packages (eg: those located inside your project's Packages folder) will generate a csproj file. The read-only packages (eg: those installed via package manager window) will indeed not create a csproj. There are ide such as Jetbrains Rider which does have support to automatically add the read-only projects to your solution, but that is dependent on which ide you use.
     
    SugoiDev likes this.
  7. jayatubi

    jayatubi

    Joined:
    Dec 9, 2013
    Posts:
    74
    Could it be possible for visual studio?
     
    OndrejP likes this.
  8. OndrejP

    OndrejP

    Joined:
    Jul 19, 2017
    Posts:
    68
    This is essential for development, because it allows you to use Go To Definition (and other IDE features) and see the implementation easily.

    Also it fixes the issue with "missing" XML documentation in referenced packages.
    (e.g. Unity.Entities contains a lot of documentation comments, but they won't show because there's no Unity.Entities.xml in Library\ScriptAssemblies)
     
    Last edited: May 19, 2019
    Erothez and De-Panther like this.
  9. Erothez

    Erothez

    Joined:
    May 27, 2015
    Posts:
    15
    Packages using csproj with default unity folder layout stuff would be nice, been doing some stuff with file:// packages and being able to reference/find stuff and see comments has been a god send.
     
    OndrejP likes this.
  10. AdminOhrizon

    AdminOhrizon

    Joined:
    Feb 11, 2016
    Posts:
    4
    Is there any update on this?
     
  11. Adrian

    Adrian

    Joined:
    Apr 5, 2008
    Posts:
    397
    This was added in (I think) 2019.3. Enable the "Generate all .csproj files" option in Unity's preferences under "External Tools".

    After enabling the option, you need to get Unity to regenerate the project, e.g. by selecting "Assets" » "Open C# Project". You then should see a lot more csproj files in your Unity project from all your package's assembly definitions.

    When enabling this option and using VSCode, the documentation for all packages is displayed and go to definition jumps directly to the source code.

    I did run into an issue where the option would be forgotten and I hat to uncheck, recheck and then regenerate the project to enable it again.
     
    OndrejP likes this.
  12. AdminOhrizon

    AdminOhrizon

    Joined:
    Feb 11, 2016
    Posts:
    4
    It also works with Unity 2019.2.17. Thanks a lot for pointing this out!
     
unityunity