question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

missing / outdated solution and assembly files -> missing assembly references

See original GitHub issue

Environment data

dotnet --info output:

.NET Command Line Tools (1.0.0-preview2-003131)

Product Information: Version: 1.0.0-preview2-003131 Commit SHA-1 hash: 635cf40e58

Runtime Environment: OS Name: Windows OS Version: 10.0.16299 OS Platform: Windows RID: win10-x64

VS Code version:

Version 1.23.1 Commit d0182c3417d225529c6d5ad24b7572815d0de9ac Datum 2018-05-10T17:11:17.614Z Shell 1.7.12 Renderer 58.0.3029.110 Node 7.9.0 Architektur x64

C# Extension version:

1.15.2

Steps to reproduce

  • deinstall VS Community if you have it on your machine
  • install Unity 2018.1.f2 without VS Community and without the VS integration.
  • install code and and the unity vs code extension.
  • there is no way to create the solution and assembly files needed by omnisharp (Assembly-CSharp.csproj, Assembly-CSharp-Editor.csproj, Assembly-CSharp-Editor-firstpass.csproj, Assembly-CSharp-firstpass.csproj, projectname.sln)
  • Assets -> Open C# Project does not do anything

Expected behavior

  • always up-to-date solution and assembly files

Actual behavior

  • no solution and assembly files at all, or only outdated ones (if they were generated before)
  • omnisharp will not find any (new) references

How I fixed it dirty

  • install VS Community with the unity intergration.
  • disable vs code and switch to VS Community in the unity preferences
  • click Assets -> Open C# Project to create the solution and assembly files (which only works with VS Community)
  • switch back to vs code
  • vs code with omnisharp is working again as expected

You have to do this all the time something changed, so this solution is really not practically!

How I fixed it less dirty

First I still need to have visual studio community with the unity plugin installed.

Second, I changed the constructor (line 284) to this:

        static VSCode()
        {
            if (Enabled)
            {
                UpdateUnityPreferences(true);
                
                // disable vs code and reset vs community as the default external editor
                EditorPrefs.SetString("kScriptsDefaultApp", EditorPrefs.GetString("VSCode_PreviousApp"));
                
                // sync will now successfully create or update the solution and project files
                SyncSolution();  
                
                UpdateLaunchFile();

                // UpdateSolution is not needed anymore because it is called over the OnGeneratedCSProjectFiles callback which gets triggered by SyncSolution()
                // UpdateSolution(); 
                
                // reenable vscode
                EditorPrefs.SetString("kScriptsDefaultApp", CodePath);
                
                // Add Update Check
                DateTime targetDate = LastUpdate.AddDays(UpdateTime);
                if (DateTime.Now >= targetDate && AutomaticUpdates)
                {
                    CheckForUpdate();
                }
            }
            
            // Event for when script is reloaded 
            System.AppDomain.CurrentDomain.DomainUnload += System_AppDomain_CurrentDomain_DomainUnload;
        }

Related Issues ??

Maybe this problem is also the reason for these releated issues:

https://github.com/OmniSharp/omnisharp-vscode/issues/1867 https://github.com/OmniSharp/omnisharp-vscode/issues/1676 https://github.com/OmniSharp/omnisharp-vscode/issues/2209

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:2
  • Comments:13 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
xahoncommented, Aug 11, 2018

I’ve tested that latest 2017.x version of unity works with this plugins and vscode create csproj and sln files correctly (https://unity3d.com/get-unity/download/archive?_ga=2.176330017.583502768.1533393667-1270968443.1532679919) (In my case version of unity is 2017.4.8f1, vscode 1.26.0-insider)

2reactions
grofiecommented, Jun 22, 2018

Hi @DMlightup,

finally someone joined me in this thread =D

I still had version 2.7 in my project, that’s why the line numbers did not match. I just downloaded version 2.8 - and the solution files dont get created automatically again (means the plugin is still broken in version 2.8). Then I replaced the constructor with the code above (you’re right, now it’s in line to 301 - 328) and it works fine again. Thx for the hint, I will change the line numbers in the comment above.

I think the unity plugin gets installed automatically when you install visual studio over the unity installer.

If you install visual studio separately (like I did), make sure you put the check mark for unity:

image

To be honest, I am not 100% sure if the plugin is really necessary, but I installed it anyways and did not test the problem without it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

missing / outdated solution and assembly files
missing / outdated solution and assembly files -> missing assembly references #2325 ... omnisharp will not find any (new) references ...
Read more >
c# - I'm getting the "missing a using directive or assembly ...
Guidance: 1) assembly loaded?, 2) assembly loaded matches with origin assembly?, 3) "using" directives pointing to old or none valid references?
Read more >
Visual Studio 2022 assembly references missing
If I start a new project and selct .net 4.8 then the references seem fine in the solution explorer window but a build...
Read more >
Missing Assembly References in Test Studio Project
SOLUTION · 1. Open your test project in Visual Studio. · 2. Go to Solution Explorer. · 3. Expand the project and open...
Read more >
Problem with missing assembly reference when using Visual ...
I am developing Unity game apps on a PC using C#, running Visual Studio Code as the editor. The apps are targeted at...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found