Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

C# Compiler Location of csproj files

Discussion in 'Experimental Scripting Previews' started by TJHeuvel-net, Dec 12, 2022.

  1. TJHeuvel-net

    TJHeuvel-net

    Joined:
    Jul 31, 2012
    Posts:
    838
    We use a lot of packages, plugins and asmdefs. I also really want them to be in my visual studio solution.

    As a result, the root folder of my project is absolutely full of generated .csproj files. If changes are being made here, would it be possible to move these to a subfolder? It makes navigating much easier.

    Thanks in advance!
     
    RKSWD and Kichang-Kim like this.
  2. Kichang-Kim

    Kichang-Kim

    Joined:
    Oct 19, 2010
    Posts:
    1,010
    +1. It may be "Library/ScriptProjects".
     
  3. HaraldNielsen

    HaraldNielsen

    Unity Technologies

    Joined:
    Jun 8, 2016
    Posts:
    138
    Hi, problem with placing the csproj's at a not rooted location to the source files, like `Library/ScriptProjects`, is that then all source files then needs to be added as `link`, and tooling like extract class to separate file will not work properly.
    We are working on a MSBuild workflow where csproj's will be more as a normal C# project layout, so similar placement where the asmdef's today. That would remove the file clutter/mess from the project folder
     
  4. TJHeuvel-net

    TJHeuvel-net

    Joined:
    Jul 31, 2012
    Posts:
    838
    Thanks for the response.

    So will my root directory still look like this? Just slightly lessfrom our own asmdefs upload_2022-12-12_16-43-3.png
     
  5. HaraldNielsen

    HaraldNielsen

    Unity Technologies

    Joined:
    Jun 8, 2016
    Posts:
    138
    @TJHeuvel-net you can limit that by changing your preferences to only generate csproj's to your own, as it seem you have set it to do for all packages. Though is you want to move around and look at the package code, you need to have it enabled.
     
  6. TJHeuvel-net

    TJHeuvel-net

    Joined:
    Jul 31, 2012
    Posts:
    838
    Thanks, but i am indeed interested in looking around these packages very often.
     
    HaraldNielsen likes this.
  7. krs-two

    krs-two

    Joined:
    Aug 27, 2021
    Posts:
    14
    Can you please detail that a bit?

    Let's say I have a Unity project folder containing a generated csproj file like:
    /MyUnityProject/MyCode.csproj
    and that csproj file contains rows like
    <Compile Include="Assets\Scripts\SomeFolder\MyCSharpFile.cs" />

    If that csproj file instead was located in
    /MyUnityProject/Assets/Scripts/SomeFolder/MyCode.csproj
    the lines it contains would be more like
    <Compile Include="MyCSharpFile.cs" />

    How does "link" come into play here?
     
  8. HaraldNielsen

    HaraldNielsen

    Unity Technologies

    Joined:
    Jun 8, 2016
    Posts:
    138
    @krs-two Yes if the csproj was at that location it would work just fine.
    It was more if the csproj's was located ie. under /MyUnityProject/Library/... then all file cs includes are links