-
Notifications
You must be signed in to change notification settings - Fork 175
Description
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:
dotnet/vscode-csharp#1867
dotnet/vscode-csharp#1676
dotnet/vscode-csharp#2209