Search Unity

[Solved] Is there a way to force Unity to regenerate csproj files?

Discussion in 'Entity Component System' started by Lieene-Guo, Apr 15, 2020.

  1. Lieene-Guo

    Lieene-Guo

    Joined:
    Aug 20, 2013
    Posts:
    547
    Is there a api or some thing that I can force unity to regenerate .csproj and .sln? including package .csproj for Entitiies or Collections

    The default behavior of csproj generation is like it only update thoese csproj that has change, adding or removing source file. But if I delete the csproj itself for some reason, it is not considered dirty. so even if all .csproj and .sln is deleted. by double clicking a source Unity wont make new ones. By using Open in c# Project from context menue It generates only .csproj for assembly define in Asset folder, no including package assembly. My Preferences->External Tools-> Generate all .csproj files is Checked.

    And the reason, I remove .csproj files is a TestRuner+Burst bug keep corrupting my .csproj. I am trying to figure out why.

    But I really want to know if I can force unity to regenerate ALL .csproj by some UnityEditor Api or so.
     
  2. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,761
    upload_2020-4-15_12-20-50.png

    Under Preferences/External Tools

    Shouldn't be too hard to reverse it and call it from from a script if API doesn't already exist.
     
  3. Lieene-Guo

    Lieene-Guo

    Joined:
    Aug 20, 2013
    Posts:
    547
    :( I don't have it as I am on 2019.3.2f1
    Are you on 2020?
     
  4. Lieene-Guo

    Lieene-Guo

    Joined:
    Aug 20, 2013
    Posts:
    547
  5. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,761
    This screenshot was 2019.3.9f1

    So either it was added in a later 19.3 version or I guess rider might inject it in
     
  6. Lieene-Guo

    Lieene-Guo

    Joined:
    Aug 20, 2013
    Posts:
    547
    Where is that?....
    On my Unities..
    2020.1.0
    upload_2020-4-15_12-3-9.png
    2019.3.2
    upload_2020-4-15_12-3-47.png
     
  7. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,761
    Must be a rider feature.

    Rider master race.
     
  8. Lieene-Guo

    Lieene-Guo

    Joined:
    Aug 20, 2013
    Posts:
    547
    Thanks for the hint.
    upload_2020-4-15_14-12-26.png
    I got it now.
    It's nether UnityEditor version nor Rider Inject.
    But Rider/VSCode Editor package version 1.2.0 up would have this
     
  9. eizenhorn

    eizenhorn

    Joined:
    Oct 17, 2016
    Posts:
    2,685
    Truth truth
     
  10. Vivraan

    Vivraan

    Joined:
    Feb 2, 2018
    Posts:
    26
    Is it possible to do something similar in 2018.4 LTS? Kinda stuck on this release for our project.
     
  11. dormouse

    dormouse

    Joined:
    Mar 1, 2011
    Posts:
    82
    I simple question:
    Why it shows: Generate all .csproj files,
    sometimes, it shows individually:
    Generate .csproj for:
    Embedded Packages..
    ..
    ...


    Thanks
     
  12. Lieene-Guo

    Lieene-Guo

    Joined:
    Aug 20, 2013
    Posts:
    547
    It depends on which IDE you are using and Unity's package version of your IDE's supporter tools.
     
  13. Pangkywannamakegame

    Pangkywannamakegame

    Joined:
    Apr 30, 2021
    Posts:
    1
    fking eror code.jpg It be like this I dont know obvious version but how i set external tool for this version?
     
    astracat111 and RatherGood like this.
  14. SepM

    SepM

    Joined:
    Jun 23, 2014
    Posts:
    3
    This saved me a lot of trouble. Thanks!
    Turns out I had the Visual Studio Editor package instead of the Visual Studio Code one.
     
  15. longshotgames

    longshotgames

    Joined:
    Nov 16, 2014
    Posts:
    8
    Thanks! This was the info I needed. After upgrading from 2020.3 to 2021.3 I couldn't see generate csproj button/settings. In the package manager I already had 'Visual Studio Code Editor' installed but I did not have 'Visual Studio Editor'. Installing both packages resolved the issue for me.
     
  16. AmitTiwari4Unity

    AmitTiwari4Unity

    Joined:
    Aug 26, 2021
    Posts:
    7
    Thanks
    Installing Visual Studio Editor from Package manager helped.
     
    DebbyX3 and breylinlee like this.
  17. TheDarkArtist

    TheDarkArtist

    Joined:
    Jul 6, 2023
    Posts:
    1
    what do you mean, i'm having the same issue, could you help out
     
  18. Rebaken-Enterprises

    Rebaken-Enterprises

    Joined:
    Nov 17, 2014
    Posts:
    17
    Ahhh, mine was set to "Open by file extension" :( So wasn't getting the regenerate option.
     
  19. washynator

    washynator

    Joined:
    Oct 27, 2015
    Posts:
    1
    This fixed it for me, thanks!