Search Unity

Bug: SLN/CPROJ files no longer generated on Linux in 2018

Discussion in 'Linux Editor' started by jmills, May 23, 2018.

  1. jmills

    jmills

    Joined:
    Apr 15, 2013
    Posts:
    11
    Reproduction:

    - Delete .sln and .cproj files.
    - Open Unity 2018
    - Save a script within the project
    - Unity will not generate sln and cproj files, making new changes to code not available to something such as the Omnisharp server

    Additionally, "Reimport All" and "Build" do not seem to generate .sln or .cproj files either.

    I use omnisharp-vim, and the current workaround I have is to switch my external editor to VSCode and open a file with it through Unity to get VSCode to generate the `sln` and `cproj` files, but it's really, really irritating as I basically have to interrupt my development every 2-3 hours to do this.

    Unity 2017 for Linux seems to generate sln and cproj files just fine.
     
    xdegtyarev and SergeyDevZ like this.
  2. Tak

    Tak

    Unity Technologies

    Joined:
    Mar 8, 2010
    Posts:
    1,000
    Unity won't generate project files if you're not using an external editor that it thinks knows about them.
     
  3. jmills

    jmills

    Joined:
    Apr 15, 2013
    Posts:
    11
    This seems kind of strange. Unity 2017 was working with the exact same external editors and created the `sln` file without doing any fooling on my part.

    Why would Unity care at all about the editor/attempt to maintain a list of editors that it thinks can handle the `sln` and `csproj`? It seems like it should just be an option in the External Editor preferences to tell Unity to generate an `sln/csproj` file or not. Wouldn't it be more error prone to try to guess if a particular binary wants a `sln` or `csproj` file? There are a lot of editors for Linux that use Omnisharp/Omnisharp-roslyn.

    How does unity determine this information? By name? If I changed my external editor script (which issues a command to open my editor and a few other things) to `code`, would Unity generate the sln?
     
    SergeyDevZ likes this.
  4. Tak

    Tak

    Unity Technologies

    Joined:
    Mar 8, 2010
    Posts:
    1,000
    The reason that Unity knows/cares about the editor is that different editors have different ways to pass them the solution/file/line when launching them.
    The reason that the solution and projects aren't always generated is that it takes nonzero time, and we want to avoid making people wait for the generation of files they're never going to use.
    However, maybe it will be reasonable to add a way to generate project files for an "unknown" editor.
     
  5. jmills

    jmills

    Joined:
    Apr 15, 2013
    Posts:
    11
    Just as an FYI, I was very happily using the Linux editor for almost 3 years before this change. This issue has forced me to switch back to the Windows editor. Needless to say, I'm pretty unhappy with it.

    I would greatly appreciate it if this option would be added in the future *or* if Unity for Linux was modified such that it always generated .sln files. The vast # of editors available for Linux and the nature of it's open ecosystem should mandate that Unity be flexible in this regard.

    While it is "non zero" time to compile an .sln, it is barely noticeable in projects of any size. It's usually a fairly small fraction of the overall compile time. It's not like I was suddenly blown away by Unity's compile speed when it no longer compiled the .sln file in my fairly large project.

    I can understand the engineering aims but I think this is unneeded optimization that does more harm than good.

    It's fine to integrate directly with supported editors such as VSCode and VS, but it seems strange to then prevent editors Unity has no idea about from working with an .sln file when you already provide configuration options to pass the current File/Line information in a particular way.
     
    Last edited: May 31, 2018
  6. bitinn

    bitinn

    Joined:
    Aug 20, 2016
    Posts:
    834
    Hi Tak,

    Just wondering about one small detail, say I am using VS Code and a Unknown editor, and I have used Unity's VS Code integration to generate sln/csproj files:

    - Now I switch to the unknown editor in Unity preference, will Unity continue to refresh these sln/csproj files?

    - I believe it should, but how can I verify or initiate the refresh?

    I am asking because we have to use the unknown editor for following reasons:

    https://forum.unity.com/threads/editor-integration-improvement.534493/

    Thx!
     
    Last edited: Jun 4, 2018
  7. DGLWilkins

    DGLWilkins

    Joined:
    Sep 25, 2012
    Posts:
    7
    I'm finding the exact same issue while using Rider. Has been working perfectly fine before.
     
  8. icedane

    icedane

    Joined:
    Jul 9, 2018
    Posts:
    2
    Are you really being serious?

    How on earth is unity even trying to determine which editor is in use? Using the name?

    If unity has the ability to generate the appropriate csproj and sln files, **this needs to be exposed to the user so we can actually work on our projects**.

    I'm trying to develop on linux, and it's quite literally impossible because no solution or csproj files are being generated. What am I supposed to do? Write them by hand?
     
    SergeyDevZ likes this.
  9. unityoracle

    unityoracle

    Joined:
    Jul 3, 2018
    Posts:
    12
    Here is my workaround from a similar thread: https://forum.unity.com/threads/cant-get-vscode-to-work-properly-with-unity.538224/

    This issue is that Unity Editor expects the file used to launch VSCode to have a specific name. It seems that unity will only trigger the .sln/.csproj generation routine if the filename matches a hard-coded value.

    Specifically, creating a symlink named "code" that opens VSCode fixed this issue for me. The normal binary was named "visual-studio-code", which Unity didn't recognize as VSCode.

    Unity devs may want to consider a more sophisticated method of determining whether the selected external editor is VSCode, VS, etc.
     
    SergeyDevZ likes this.
  10. icedane

    icedane

    Joined:
    Jul 9, 2018
    Posts:
    2
    Yes, I had figured out the same thing and it's such an unfathomably stupid decision I simply have no idea how on Earth someone thought it was a reasonable way to do things.

    Unity's Linux support seems to be nearly mostly a farce since it seems like there is hardly ever any input from any official unity people. Making your program buildable on Linux and then otherwise just dumping it on the community and forgetting about it is not how you add Linux support. It's absolutely pathetic that unity will literally generate projects that you can't even work with on Linux without using a specific editor.
     
  11. LitchiSzu

    LitchiSzu

    Joined:
    May 14, 2016
    Posts:
    17
unityunity