NuGet / Home

Repo for NuGet Client issues
Other
1.5k stars 252 forks source link

[Bug Bash] An error occurred when reloading project according to warning tips after installing “Fsharp.Net.SDk” package for “F# Console Application (.NET framework)” project #13896

Open CiciLi1 opened 2 weeks ago

CiciLi1 commented 2 weeks ago

NuGet Product Used

Visual Studio Package Management UI

Product Version

NuGet Client Dev\6.13.0.50

Worked before?

It is not a regression since it also reproes on D16.11\34601.136 with implicit NuGet Client 5.11.6.4 and D17.12.5\35424.85 with implicit NuGet Client 6.12.0.129.

Impact

It bothers me. A fix would be nice

Repro Steps & Context

Notes:  

  1. The repro rate is 100%. 

  2. The package was installed successfully on step 4.

  3. An additional error was showing on the top of VS after step 4 on D16.11\34601.136 with implicit NuGet Client 5.11.6.4 as the screenshot below. image

Repro Steps:   

  1. Create a “F# Console Application (.NET framework)” project.   

  2. Right-click the project in Solution Explorer and select "Manage NuGet Packages…" menu item to open PM UI.   

  3. Click “Browse” tab and select “nuget.org” from Package source drop-down list.

  4. Search 'FSharp.NET.Sdk ' package in the filter of “Browse” tab and click the ‘Install’ button on the right panel.

  5. An error “MSB4057: The target "CollectNuGetAuditSuppressions" does not exist in the project.” occur in error list window.

  6. Observe the top of VS and click the “Reload Projects” button.

Expected:   

The project was reloaded successfully.

Actual:   

An error “The project file cannot be opened by the project system, because it is missing some critical imports or the referenced SDK cannot be found.” occurred when reloading project as below screenshot. It makes the solution fail to use. fsharp net sdk_firstInstall

Verbose Logs

No response

donnie-msft commented 5 days ago

I'm not able to repro this. The package installs and there's no warnings/errors. I wonder if your machine has another version of MSBuild in the GAC or something and it's finding the wrong targets it expects for that SDK. Also, which specific .NET Framework version is this? I tried framework 4.7.

image

On your repro machine, could you run the following PowerShell Developer Command Prompt and compare it to the output from my machine below. gacutil /l | Select-String -Pattern "Microsoft.Build|MSBuild" | Sort-Object

My GAC command output > Microsoft.Build, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL > Microsoft.Build.Conversion.v3.5, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL > Microsoft.Build.Conversion.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL > Microsoft.Build.Conversion.v4.0.resources, Version=4.0.0.0, Culture=ja, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL > Microsoft.Build.Engine, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL > Microsoft.Build.Engine, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL > Microsoft.Build.Engine, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL > Microsoft.Build.Engine.Resources, Version=2.0.0.0, Culture=ja, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL > Microsoft.Build.Engine.resources, Version=4.0.0.0, Culture=ja, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL > Microsoft.Build.Framework, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL > Microsoft.Build.Framework, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL > Microsoft.Build.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL > Microsoft.Build.resources, Version=4.0.0.0, Culture=ja, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL > Microsoft.Build.Tasks, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL > Microsoft.Build.Tasks.Resources, Version=2.0.0.0, Culture=ja, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL > Microsoft.Build.Tasks.v3.5, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL > Microsoft.Build.Tasks.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL > Microsoft.Build.Tasks.v4.0.resources, Version=4.0.0.0, Culture=ja, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL > Microsoft.Build.Utilities, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL > Microsoft.Build.Utilities.Resources, Version=2.0.0.0, Culture=ja, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL > Microsoft.Build.Utilities.v3.5, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL > Microsoft.Build.Utilities.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL > Microsoft.Build.Utilities.v4.0.resources, Version=4.0.0.0, Culture=ja, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL > MSBuild, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=AMD64 > MSBuild, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=x86 > MSBuild, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=AMD64 > MSBuild, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=x86
CiciLi1 commented 2 days ago

Hi @donnie-msft, the framework we were using before was 4.8.1, we can still repro this issue when we use framework 4.7 on VS Main\35511.74 + NuGet Client Dev\6.13.0.60, here is my GAC command output, could you please help to look at it?

GAC command output
 
  Microsoft.Build, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL
  Microsoft.Build.Conversion.v3.5, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL
  Microsoft.Build.Conversion.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL
  Microsoft.Build.Conversion.v4.0.resources, Version=4.0.0.0, Culture=de, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL
  Microsoft.Build.Conversion.v4.0.resources, Version=4.0.0.0, Culture=fr, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL
  Microsoft.Build.Engine, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL
  Microsoft.Build.Engine, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL
  Microsoft.Build.Engine, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL
  Microsoft.Build.Engine.Resources, Version=2.0.0.0, Culture=de, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL
  Microsoft.Build.Engine.Resources, Version=2.0.0.0, Culture=fr, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL
  Microsoft.Build.Engine.resources, Version=4.0.0.0, Culture=de, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL
  Microsoft.Build.Engine.resources, Version=4.0.0.0, Culture=fr, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL
  Microsoft.Build.Framework, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL
  Microsoft.Build.Framework, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL
  Microsoft.Build.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL
  Microsoft.Build.resources, Version=4.0.0.0, Culture=de, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL
  Microsoft.Build.resources, Version=4.0.0.0, Culture=fr, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL
  Microsoft.Build.Tasks, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL
  Microsoft.Build.Tasks.Resources, Version=2.0.0.0, Culture=de, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL
  Microsoft.Build.Tasks.Resources, Version=2.0.0.0, Culture=fr, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL
  Microsoft.Build.Tasks.v3.5, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL
  Microsoft.Build.Tasks.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL
  Microsoft.Build.Tasks.v4.0.resources, Version=4.0.0.0, Culture=de, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL
  Microsoft.Build.Tasks.v4.0.resources, Version=4.0.0.0, Culture=fr, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL
  Microsoft.Build.Utilities, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL
  Microsoft.Build.Utilities.Resources, Version=2.0.0.0, Culture=de, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL
  Microsoft.Build.Utilities.Resources, Version=2.0.0.0, Culture=fr, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL
  Microsoft.Build.Utilities.v3.5, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL
  Microsoft.Build.Utilities.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL
  Microsoft.Build.Utilities.v4.0.resources, Version=4.0.0.0, Culture=de, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL
  Microsoft.Build.Utilities.v4.0.resources, Version=4.0.0.0, Culture=fr, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL
  MSBuild, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=AMD64
  MSBuild, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=x86
  MSBuild, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=AMD64
  MSBuild, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=x86
donnie-msft commented 2 days ago

Can you install this package with CLI? If so, please collect an MSBuild binlog. If it's only in VS, you can collect a binlog by following this guide, https://learn.microsoft.com/visualstudio/ide/msbuild-logs?view=vs-2022#create-a-binary-msbuild-log-by-using-the-project-system-tools-extension

CiciLi1 commented 1 day ago

Hi @donnie-msft, this issue is also repro when we use the CLI to install the package "FSharp.NET.Sdk" as below screenshot, the binlog file that is generated after installing the package is uploaded to the \\mlangfs1\public\NuGet\Bug_13896. could you please help to look at it? image

Note: We installed “Project System Tools 2017/2019” according to the first step you provided in above documentation when trying to collect binlogs in VS but the installation fails as follows: image This is a log of failed installations: dd_VSIXInstaller_20241113172521_5630.log