2020.1.0a8 (and earlier) Visual Studio .sln file not saved...

How to reproduce:

  • create a project
  • add a script to the camera, or the light, or any object,
  • add code to the script in Visual Studio and save the script,
  • go back to Unity and test your code,
  • save the project and quit Unity,
  • quit Visual Studio: Visual Studio will ask you about saving the .sln file.

The .sln file should be saved automatically as soon as you save the script or the project in Unity.

Yeah I get this nagging too.

yup … its bad and have to restart unity everytime and delete all of VS project :[
unity 2020.1.0a8 + VS 16.3

Why?

cus of this :
5067578--498065--Capture.JPG

some of assemblies can’t detect on vs if open scripts again :confused:

@LeonhardP The problem is still there with 2020.1.0a9.

I am in contact with Microsoft to look into why this problem occurs.

1 Like

Thanks!

Since you are here, do you know that the faulty Visual Studio Editor package is still installed in some of the toturials that are proposed in the Learn section?

I passed the information on to the appropriate team.

1 Like

Bonjour @ ,

I do not repro your issue with the sln file. Could you share with me more information:

  • In Visual Studio, Help/About, use copy info and paste the result here (or send us everything to vstusp[at]microsoft[dot]com). Perhaps one of your VS extensions is interfering.
  • In Unity, Help/About could you share the VSTU version you see displayed (on the bottom left corner of the window).
  • Following your repro could you share the content of the solution file before AND after your manual last save before quitting ?

Thank you and best regards
Sebastien

What version of Unity did you use to try and reproduce the problem? This happens only with 2020.1.

Sorry, I have no idea how to do that. (See below)

Okay, I tried the following:

  • started the project in 2020.1.,
  • opened the script from Unity,
  • Visual Studio opened, I didn’t modified the script,
  • the content of the .sln file open in Notepad++ is the following:
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 16
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp", "Assembly-CSharp.csproj", "{5CCFC07A-2A51-79A4-10FA-4ABD2D79C9B0}"
EndProject
Global
    GlobalSection(SolutionConfigurationPlatforms) = preSolution
        Debug|Any CPU = Debug|Any CPU
        Release|Any CPU = Release|Any CPU
    EndGlobalSection
    GlobalSection(ProjectConfigurationPlatforms) = postSolution
        {5CCFC07A-2A51-79A4-10FA-4ABD2D79C9B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
        {5CCFC07A-2A51-79A4-10FA-4ABD2D79C9B0}.Debug|Any CPU.Build.0 = Debug|Any CPU
        {5CCFC07A-2A51-79A4-10FA-4ABD2D79C9B0}.Release|Any CPU.ActiveCfg = Release|Any CPU
        {5CCFC07A-2A51-79A4-10FA-4ABD2D79C9B0}.Release|Any CPU.Build.0 = Release|Any CPU
    EndGlobalSection
    GlobalSection(SolutionProperties) = preSolution
        HideSolutionNode = FALSE
    EndGlobalSection
EndGlobal

Even though I didn’t modify the script, VS asked about saving the .sln on quitting which I did. The content of the .sln file open in Notepad++ is now the following:

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29418.71
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp", "Assembly-CSharp.csproj", "{1555CFEA-8013-20C8-0315-C35A555A8F51}"
EndProject
Global
    GlobalSection(SolutionConfigurationPlatforms) = preSolution
        Debug|Any CPU = Debug|Any CPU
        Release|Any CPU = Release|Any CPU
    EndGlobalSection
    GlobalSection(ProjectConfigurationPlatforms) = postSolution
        {1555CFEA-8013-20C8-0315-C35A555A8F51}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
        {1555CFEA-8013-20C8-0315-C35A555A8F51}.Debug|Any CPU.Build.0 = Debug|Any CPU
        {1555CFEA-8013-20C8-0315-C35A555A8F51}.Release|Any CPU.ActiveCfg = Release|Any CPU
        {1555CFEA-8013-20C8-0315-C35A555A8F51}.Release|Any CPU.Build.0 = Release|Any CPU
    EndGlobalSection
    GlobalSection(SolutionProperties) = preSolution
        HideSolutionNode = FALSE
    EndGlobalSection
    GlobalSection(ExtensibilityGlobals) = postSolution
        SolutionGuid = {351217FB-0D9F-403B-9615-45C80AEA767A}
    EndGlobalSection
EndGlobal

Note: Visual Studio was updated just before I did that, it still asks about saving the .sln file on quitting.

Note 2: The same content of the .sln file in a 2019.2 project. This content is unchanged if I open the script and do not modify it.

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 16
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp", "Assembly-CSharp.csproj", "{D0639992-E2EC-E986-9972-A3E6FA1E3A45}"
EndProject
Global
    GlobalSection(SolutionConfigurationPlatforms) = preSolution
        Debug|Any CPU = Debug|Any CPU
        Release|Any CPU = Release|Any CPU
    EndGlobalSection
    GlobalSection(ProjectConfigurationPlatforms) = postSolution
        {D0639992-E2EC-E986-9972-A3E6FA1E3A45}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
        {D0639992-E2EC-E986-9972-A3E6FA1E3A45}.Debug|Any CPU.Build.0 = Debug|Any CPU
        {D0639992-E2EC-E986-9972-A3E6FA1E3A45}.Release|Any CPU.ActiveCfg = Release|Any CPU
        {D0639992-E2EC-E986-9972-A3E6FA1E3A45}.Release|Any CPU.Build.0 = Release|Any CPU
    EndGlobalSection
    GlobalSection(SolutionProperties) = preSolution
        HideSolutionNode = FALSE
    EndGlobalSection
EndGlobal

From what I notice, these two lines are added automatically when VS is opened from within Unity 2020.1 whether you modify the script or not.

Ok,

So I tried with a custom build of 2020.1.a06 on which we are working with @miniwolf_unity , and I do not repro.
Just downloaded the latest a09, and indeed I repro on this one.

Seb

The problem was there in a08 too but it’s not really important. :slight_smile:

@miniwolf_unity we had a deeper look, and we repro even when disabling completely our bridge (so with pure generation on the Unity side).

Starting with a08, for this super simple scenario, Unity is generating a csproj and a solution with distinct ProjectGuids !? for the project.

After reading the solution, VS detects the mismatch and try to fix that in-memory. That’s why it is asking about saving the .sln file on quit.

In the example @ gave:

  • Unity is generating the csproj with a ProjectGuid = 1555CFEA-8013-20C8-0315-C35A555A8F51
  • Unity is generating the solution with a ProjectGuid = 5CCFC07A-2A51-79A4-10FA-4ABD2D79C9B0
  • Then VS loads the solution, detects the mismatch and want to use 1555CFEA-8013-20C8-0315-C35A555A8F51 in the solution instead of 5CCFC07A-2A51-79A4-10FA-4ABD2D79C9B0.

Given ProjectGuids are generated using a hash on a name, starting with a08, the island/project name is perhaps changing between the csproj and the sln generation.

What do you think @miniwolf_unity ?

Regards
Seb

That sounds like we introduce a regression indeed. The ProjectGUID should match. We just updated with an entire new test suite, and it sounds like one of the tests verified the invalid case, which caused this to have been fixed incorrectly. I will get on that. To keep track of this issue, it would be great if a bug could be created.

Maybe you should do that; you know what words to use.

This problem has been resolved and was merged in October 18th.
So it should be available in the next alpha release. :slight_smile:

1 Like