ionide / ionide-vscode-fsharp

VS Code plugin for F# development
http://ionide.io
MIT License
858 stars 277 forks source link

Ionide stuck at project load when project file imports a non-dotnet targets file #1972

Open ronnieholm opened 9 months ago

ronnieholm commented 9 months ago

Within a .NET 4.8 project where foo.fsproj is in SDK format, if at the bottom of foo.fsproj I import

<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v17.0\WebApplications\Microsoft.WebApplication.targets" />

Ionide is stuck with "Project loading" in the status bar and no relevant output in the Ionide or Ionide: MSBuild output windows.

If however I open a C# project which itself doesn't import Microsoft.WebApplication.targets, but references a project which does, the C# output window shows:

[Error - 10:23:29 AM] [LanguageServerProjectSystem] Failure while loading c:\Users\rh\source\repos\identityprovider\IntegrationTests\IntegrationTests.csproj: The imported project "C:\Program Files\dotnet\sdk\8.0.100\Microsoft\VisualStudio\v17.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the expression in the Import declaration "C:\Program Files\dotnet\sdk\8.0.100\Microsoft\VisualStudio\v17.0\WebApplications\Microsoft.WebApplication.targets" is correct, and that the file exists on disk.

In the C# output window, the path to Microsoft.WebApplication.targets is wrong and may be what's confusing Ionide:

C:\Program Files\dotnet\sdk\8.0.100\Microsoft\VisualStudio\v17.0\WebApplications\Microsoft.WebApplication.targets

. Microsoft.WebApplication.targets is actually located at

C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VisualStudio\v17.0\WebApplications\Microsoft.WebApplication.targets

The error in the C# output window doesn't prevent a C# project from loading and shouldn't prevent Ioniode either.

Machine info

Additional context

Importing Microsoft.WebApplication.targets in a .NET 4.8 project is required for Kudu deploys to succeed.