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

Prompted to run restore every time a C# project is opened #1272

Closed
thecodejunkie opened this issue Feb 28, 2017 · 7 comments
Closed

Prompted to run restore every time a C# project is opened #1272

thecodejunkie opened this issue Feb 28, 2017 · 7 comments
Assignees
Milestone

Comments

@thecodejunkie
Copy link

Environment data

dotnet --info output:

.NET Command Line Tools (1.0.0-rc4-004849)

Product Information:
 Version:            1.0.0-rc4-004849
 Commit SHA-1 hash:  7dcefb5076

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.12
 OS Platform: Darwin
 RID:         osx.10.12-x64
 Base Path:   /usr/local/share/dotnet/sdk/1.0.0-rc4-004849

VS Code version: 1.10.0-insider
C# Extension version: 1.8.0-beta
Platform: OSX

Steps to reproduce

  1. Open https://github.com/thecodejunkie/Nancy/tree/migration-spike in VSCode
  2. When prompted about unresolved dependencies, click the restore-button for each project
  3. Close VSCode
  4. Open VSCode again
  5. Open Nancy again

Expected behavior

I should not be prompted about missing dependencies again

Actual behavior

I get prompted about missing dependencies again

@DustinCampbell
Copy link
Member

OK. I can reproduce the issue. Performing a couple of dotnet restores at the command line got it to stop recommending to restore most of the projects but three still remain:

image

@thecodejunkie
Copy link
Author

@DustinCampbell Cool. Any idea about the actual root cause?

@guardrex
Copy link

@DustinCampbell Related ...

I use VSC to work on documentation projects that include .NET Core samples. When I open folders to work on sample files, these sample projects should not be restored/built. The extension keeps creating obj and bin folders automatically against my wishes, and I need to then manually delete them from the samples.

I'm aware of ...

"csharp.suppressDotnetInstallWarning": true,
"csharp.suppressDotnetRestoreNotification": true,

... but those don't actually prevent the auto-restore/build behavior when I open a folder.

@DustinCampbell
Copy link
Member

@guardrex: Are the bin and obj folders empty? If so, this is because OmniSharp is simply using MSBuild to process the sample project. In other words, these folders will get created by MSBuild as part of its normal operation to resolve assembly references which OmniSharp uses to provide language service information. The settings you listed above won't affect this behavior and it isn't related to this particular issue. Could you track a separate issue for the problem you described?

@DustinCampbell
Copy link
Member

Sorry, I meant, could "file" a separate issue?

@DustinCampbell
Copy link
Member

@thecodejunkie: OmniSharp/omnisharp-roslyn#814 should handle most of the problem you were seeing here. With this fix I still see unresolved dependencies reported for two projects (which is much better than all projects 😄). My suspicion is that this is due to the package downgrade warnings that this project gets on restore. I'll dig a little deeper, but that may be harder to fix.

@DustinCampbell
Copy link
Member

OK. I've gotten this down to just one restore prompt. The situation here is that there's an implicit package reference in Nancy.Tests.Functional to Microsoft.NETCore.App, 1.0.4 that gets downgraded to 1.0.3. There's a similar issue in Nancy.Tests as well. However, the restore prompt doesn't appear because OmniSharp is assuming that the target framework of Nancy.Tests is net452 and not netcoreapp1.0 since net452 appears first in the project file. If I swap the order of the target frameworks in Nancy.Functional.csproj, I get no more restore prompts with my latest OmniSharp fixes.

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

No branches or pull requests

3 participants