missing / outdated solution and assembly files -> missing assembly references
See original GitHub issueEnvironment 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:
- Created 5 years ago
- Reactions:2
- Comments:13 (2 by maintainers)
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)
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:
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.