vscode: Unable to resolve assembly

Me and many others have had this problem for a while now.
The generated dlls are being placed in a directory that vscode’s omnisharp c# extension cannot find.

Expected: Temp/bin/Debug/...
Actual: Library/ScriptAssemblies/...

It’s been more than a year and the github issue linked HERE on omnisharp’s vscode repo is all but barren in terms of contributor responses.
Is there any decent solution to this problem?

3 Likes

any fix for this?

This method worked for me(temporary and dirty method!)
I’m not sure this works for all or not,but you can try

(just in case) close vs code

1.(project should be opened in unity) copy Assembly-CSharp.dll file from {YourProjectPath}\Library\ScriptAssemblies and paste it to {YourProjectPath}\Temp\bin\Debug

(if Assembly-CSharp.dll does not exist in ScriptAssemblies folder try copying it from other projects)

2.open your C# script in Unity and check if the error has gone

hope it works

remember after closing the project the Temp folder will be deleted!so copying that dll file is required for next times
this is not the best method, but at least it may help in some cases!

This works for me, but as you said it’s both very temporary and dirty. This is a persistent and annoying problem, we need a solution here bad.

1 Like

same problem :frowning:

I get this problem a lot too … but now I’m running into a new problem … I get lots of errors like this in OmniSharp output:

C:\.....\vscode\extensions\ms-dotnettools.csharp-1.21.14\.omnisharp\1.34.14\.msbuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(1875,5): Error: The referenced project 'UnityEditor.UI.csproj' does not exist.

This is 2019.3.5f1 with vs code package 1.1.4

EDIT: updated vs code package to 1.2.0 and no errors, but intellisense still doesn’t work … intellisense popup is stuck on Loading…

EDIT: solution is to revert the vs code omnisharp/C# / extension back to previous version Changing marketplace publisher from ms-vscode to ms-dotnettools causes extension recommendations to repeat ad nauseum · Issue #3620 · dotnet/vscode-csharp · GitHub

1 Like

My solution is to revert back to visual studio code editor package 1.1.3

1 Like

Adding to this: the instability of the C# and Unity plugins has been a major pain point over the last several weeks. By default VS Code updates these extensions automatically, and it’s extremely frustrating to sit down to work and have to debug your tooling for several hours once a week. I hope you can either pressure the C# extension team to keep their package in check, or remove it as a “supported” editor tool from the Unity documentation. (The cheeky note about it not being supported is the icing on the cake, but it’s still consistently listed as a Scripting tool.)

4 Likes