Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'dotnet: Restore Packages' VS Code command does not work #1175

Closed
MiKom opened this issue Feb 3, 2017 · 10 comments · Fixed by #1176
Closed

'dotnet: Restore Packages' VS Code command does not work #1175

MiKom opened this issue Feb 3, 2017 · 10 comments · Fixed by #1176
Assignees
Milestone

Comments

@MiKom
Copy link

MiKom commented Feb 3, 2017

Environment data

dotnet --info output:

.NET Command Line Tools (1.0.0-rc3-004530)

Product Information:
 Version:            1.0.0-rc3-004530
 Commit SHA-1 hash:  0de3338607

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.14393
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\1.0.0-rc3-004530

.Net core installer downloaded from: https://github.com/dotnet/core/blob/master/release-notes/rc3-download.md

VS Code version: 1.9.0 64-bit (on Windows 10 Pro 1607)

C# Extension version: 1.6.2, 1.7.0-beta2

Steps to reproduce

  1. Extract attached project:
    mvc5.zip
    Project was created by running dotnet new -t web1.1
  2. Open project's folder in Visual Studio Code

Expected behavior

  1. On load, a package restore is done and user can work with the project

Actual behavior

Restore is not done, no namespaces are resolved. OmniSharp produces the following output:

Starting OmniSharp server at 3.02.2017, 12:33:45
    Target: c:\Users\milosz.kosobucki\Documents\asptest\mvc5

OmniSharp server started
    Path: C:\Users\milosz.kosobucki\.vscode\extensions\ms-vscode.csharp-1.6.2\bin\omnisharp\OmniSharp.exe
    PID: 32

OmniSharp: -s c:\Users\milosz.kosobucki\Documents\asptest\mvc5 --hostPID 9536 --stdio DotNet:enablePackageRestore=false --encoding utf-8 formattingOptions:useTabs=false formattingOptions:tabSize=4 formattingOptions:indentationSize=4
[INFORMATION:OmniSharp.Startup] Omnisharp server running using Stdio at location 'c:\Users\milosz.kosobucki\Documents\asptest\mvc5' on host 9536.
[INFORMATION:OmniSharp.DotNet.DotNetProjectSystem] Initializing in c:\Users\milosz.kosobucki\Documents\asptest\mvc5
[INFORMATION:OmniSharp.DotNet.DotNetProjectSystem] Auto package restore: False
[INFORMATION:OmniSharp.DotNet.DotNetProjectSystem] Update workspace context
[INFORMATION:OmniSharp.DotNet.DotNetProjectSystem] Resolving projects references
[INFORMATION:OmniSharp#MSBuild] MSBUILD_EXE_PATH environment variable set to C:\Users\milosz.kosobucki\.vscode\extensions\ms-vscode.csharp-1.6.2\bin\omnisharp\msbuild\MSBuild.exe
[INFORMATION:OmniSharp#MSBuild] MSBuildExtensionsPath environment variable set to C:\Users\milosz.kosobucki\.vscode\extensions\ms-vscode.csharp-1.6.2\bin\omnisharp\msbuild
[INFORMATION:OmniSharp#MSBuild] MSBuildSDKsPath environment variable set to C:\Users\milosz.kosobucki\.vscode\extensions\ms-vscode.csharp-1.6.2\bin\omnisharp\msbuild\Sdks
[INFORMATION:OmniSharp#MSBuild] No solution files found in 'c:\Users\milosz.kosobucki\Documents\asptest\mvc5'
[INFORMATION:OmniSharp#MSBuild] Add project: c:\Users\milosz.kosobucki\Documents\asptest\mvc5\mvc5.csproj
[INFORMATION:OmniSharp#MSBuild] Update project: mvc5
[INFORMATION:OmniSharp.Script.ScriptProjectSystem] Detecting CSX files in 'c:\Users\milosz.kosobucki\Documents\asptest\mvc5'.
[INFORMATION:OmniSharp.Script.ScriptProjectSystem] Could not find any CSX files
[INFORMATION:OmniSharp.Startup] Configuration finished.

Manually running Ctrl+Shift+p and typing dotnet restore results in:

image

@DustinCampbell
Copy link
Member

DustinCampbell commented Feb 3, 2017

Hi @MiKom -- a few things:

  1. We haven't released a version of C# for Visual Code yet that fully supports the very latest for .NET Core projects. You can try the latest beta release at https://github.com/OmniSharp/omnisharp-vscode/releases which should be a little better (though it doesn't auto-restore packages yet). Please use the instructions at Installing Beta Releases to install the very latest.

  2. The work to implement package auto-restore is in progress. You can track the issue here: Determine how to implement NuGet auto-restore for MSBuild-based .NET Core projects #770.

  3. There is a bug where performing a dotnet restore won't have an effect on the project loaded in VS Code until you restart. This is tracked by Loaded .csproj project is not refreshed when 'dotnet restore' is executed #1114.

  4. Thanks for reporting issue about the 'dotnet: Restore Packages' command not working in VS Code! I'll use this to specifically track that issue.

You should be able to get your project working in VS Code by doing the following:

$ dotnet new -t web1.1
$ dotnet restore

Then, open the folder in Visual Studio Code.

@DustinCampbell DustinCampbell changed the title Visual Studio Code doesn't work with web1.1 project from .NET Core SDK 1.0.0-rc3 'dotnet: Restore Packages' VS Code command does not work Feb 3, 2017
@DustinCampbell DustinCampbell added this to the 1.7 milestone Feb 3, 2017
@Matthias247
Copy link

@DustinCampbell For when is the 1.7 release approximatly planned? Since I updated my project files to support the VS2017 version of the .NET core SDK the Visual Studio extension does not work properly anymore (can't find various type references). I'm now interested whether I should just wait for the next release or try the beta.

@DustinCampbell
Copy link
Member

We're working on it as fast as we can, but it'll likely be a couple of weeks yet. I'd recommend using the latest beta in the meantime.

@DustinCampbell
Copy link
Member

The "Restore Packages" command is now fixed.

@Matthias247
Copy link

@DustinCampbell Thanks for the feedback. As waiting a couple of weeks to get it working again is too long I tried the beta release. And Intellisense and code errors now work correctly again!

Maybe it's worth it to release what's currently available a little bit earlier, since lots of other users might also have upgraded to the newest VS2017 release, which requires a .csproj file update, which then in turn makes it incompatible with the latest omnisharp-vscode release.

@DustinCampbell
Copy link
Member

I'd love some information on the csproj update that is breaking it with the latest beta of C# for Visual Studio Code. The C# extension should be in lock-step with the VS 2017 RC3 now. Could you file a separate issue for that?

Aside:
Note both of these releases (VS 2017 RC3 and C# for Visual Studio Code) have not hit RTM yet and, hence, shouldn't be used for production. The fact C# for VS Code doesn't have a way to just ship to just those who want to try our the latest unreleased bits complicates things a significantly. Once we push the extension to the VS marketplace it goes to everyone, which gives us pause. This is why we've done significant work in C# for VS Code to ensure that project.json projects continue to work. VS 2017 has the luxury to drop support, C# for VS Code does not.

@spboyer
Copy link

spboyer commented Feb 3, 2017

installed extension using code-insiders --install-extension <filename> (version 1.7.0beta3)
replicated in vcode stable

  • "Reload" image continues to appears even after hard quit+reload and/or soft reload.
  • Error message reports still occurs

@DustinCampbell
Copy link
Member

Did you uninstall the previous version of the extension first? I recommend following these instructions as that process works around this VS Code bug.

@spboyer
Copy link

spboyer commented Feb 3, 2017

@DustinCampbell - thanks! I did somethingclose

Command Palette has "Install from VSIX" as well. However appears to not do the same as the ... from the extension panel?? Bug?

@DustinCampbell
Copy link
Member

The important point is uninstalling the old extension first. There is a known issue in VS Code where installing an extension from a VSIX will not necessarily uninstall the previous version in all cases. Even worse, VS Code will look like it has the newer extension installed but load the older one. You can check %UserProfile%\.vscode.extensions or ~/.vscode/extensions to see if you have more than one version of ms-vscode.csharp.

Also, could you file a separate issue for this rather than piling onto an unrelated closed issue? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants