dotnet / dotnet/project-system

Visual Studio unable to restore packages and build solution

Open
#6,801 3 comments 0 reactions 0 assignees View on GitHub
Triage-Investigate
Dominant language
C#
Stars
1k
Forks
415
PR merge metrics
No merged PRs in 30d

Description

(Moved from https://github.com/NuGet/Home/issues/10401 by @paulomorgado
based on this comment:

> Using CPS_DiagnosticRuntime=1 as per project system's debugging instructions, I see that project system is not nominating any package references to NuGet.
>
> we should move this to dotnet/project-system.

https://github.com/NuGet/Home/issues/10401#issuecomment-748322417)

**Visual Studio Version**:VisualStudio.16.Release/16.8.3+30804.86

**Summary**:
## Details about Problem

dotnet.exe --version: 5.0.100

VS version: VisualStudio.16.Release/16.8.3+30804.86

OS version: Microsoft Windows [Version 10.0.21277.1000]

## Detailed repro steps so we can see the same problem

1. Delete the **.vs** folder
2. Delete all **bin** and **obj** folders
3. Open the solution in Visual Studio
1. Visual Studio should restore packages, but doesn't
1. Visual Studio should show solution packages in NuGet UI, but doesn't
2. Running `dotnet restore` solves this.
2. Visual Studio should build the solution but doesn't
1. Running `dotnet build` solves this.

#### global.json
```JSON
{
"sdk": {
"version": "5.0.100",
"rollForward": "disable",
"allowPrerelease": true
}
}
```

#### Directory.Build.props
```XML


embedded
true
enable
preview
true
false








```

#### Directory.Build.targets
```XML






$(CloudBuildNumber)






<_Parameter1>BuildNumber
<_Parameter2>$(Build_BuildNumber)



<_Parameter1>BuildId
<_Parameter2>$(Build_BuildId)



<_Parameter1>GitCommitId
<_Parameter2>$(GitCommitId)



<_Parameter1>GitCommitIdShort
<_Parameter2>$(GitCommitIdShort)



$(PublishZipDir)\
$(PublishZipDir)$(ProjectName)
$(PublishZip).$(NuGetPackageVersion)
$(PublishZip).zip

```

#### csproj
```XML


net5.0
win-x86
embedded
true
true
0dc62f18-5c85-4829-9b06-32cf8ae1c37b
true
AllEnabledByDefault
true










all
runtime; build; native; contentfiles; analyzers; buildtransitive


all
runtime; build; native; contentfiles; analyzers; buildtransitive

```

Note: Solution sent privately to the team

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.