1
\$\begingroup\$

I'm using git with a Unity project of mine. I'm working on my home machine and also on one at school.
I started it at home and it works perfectly on my machine.
Once I cloned it at school it opened fine and everything still worked. Only problem was VS did not generate a project. At home I have 2019 and school has 2017.

If I generate a new Unity Project at school it has the .sln and I can open it using Assets -> Open C# Project. There is no such project generated when opening the cloned project.
I need get around this as it's near impossible for me to code efficiently at school.
Because it is an EDU machine I have very limited access to certain things. Can I create a project by hand or run a command to generate one?

\$\endgroup\$

3 Answers 3

2
\$\begingroup\$

I was able to get around this.
First I looked up VS in the start menu and clicked "Open File Location" which lead me to a shortcut to the school server. Then I made a link to that link on my desktop.
In Unity went to preferences and set the default editor to that like. Then I opened a .cs file and it generated the solution.

On my machine it opened ALL of Unity's code as seperate projects in one big solution which doesn't bug me.
On another computer it only opened the scripts written by us.
Unsure which it will normally do but it solved the situation.

\$\endgroup\$
1
\$\begingroup\$

To regenerate your .sln and related files:

  1. Edit -> Preferences
  2. External Tools
  3. Under External Script Editor select Microsoft Visual Studio 20xx (pick your version)
  4. Press Regenerate project files
\$\endgroup\$
0
\$\begingroup\$

Well you can create a solution from a console with the dotnet SDK:

dotnet new sln

And add Projects with:
dotnet sln <SLN_FILE> add <PROJECT_PATH>

I don't know if Unity works with a default C#-Solution, or if it needs a.

(Of course you need to replace the <SLN_FILE> and <PROJECT_PATH>).

\$\endgroup\$
1
  • 2
    \$\begingroup\$ This is not something that should be done on Unity as it relies on it's own method for building projects for Visual Studio to consume \$\endgroup\$ Commented Jan 23, 2021 at 12:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .