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

Adding an .esproj project to the solution breaks dotnet list package #12817

Open
cremor opened this issue Aug 17, 2023 · 6 comments
Open

Adding an .esproj project to the solution breaks dotnet list package #12817

cremor opened this issue Aug 17, 2023 · 6 comments
Labels
Area:ErrorHandling warnings and errors/log messages & related error codes. Functionality:ListPackage dotnet.exe list package Priority:3 Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog. Product:dotnet.exe Type:Bug

Comments

@cremor
Copy link

cremor commented Aug 17, 2023

NuGet Product Used

dotnet.exe

Product Version

7.0.400

Worked before?

No response

Impact

It's more difficult to complete my work

Repro Steps & Context

  1. Create a new solution with a .NET 7 project.
  2. Run dotnet list package in the solution folder. Notice that it shows a correct output for the project.
  3. Add a new "Standalone TypeScript Angular Project" to the solution. (This is an .esproj file type.)
  4. Make sure to save the solution.
  5. Run dotnet list package in the solution folder. Notice that it shows an error about the project "AngularProject1.esproj" saying that it uses "package.config" for NuGet packages. This is wrong!
  6. Add another new .NET 7 project to the solution
  7. Make sure to save the solution.
  8. Run dotnet list package in the solution folder. Notice that it shows the exact same output as in step 5. There is no output for the new project created in step 6!
  9. Modify the solution file so that the "AngularProject1.esproj" is listed after the two .NET projects.
  10. Run dotnet list package in the solution folder. Notice that it now lists both .NET projects before showing the error. This means that the behavior of dotnet list package is dependent on the order of the projects in the solution folder!

Expected behavior:

  • dotnet list package should not show an error about .esproj projects in the solution.
  • dotnet list package should continue with other projects in the solution even if it has an error with one project.

Actual behavior:

  • dotnet list package shows a wrong error message when there is an .esproj project in the solution.
  • dotnet list package doesn't continue with other projects in the solution once it finds an .esproj project

Additional Information:
I'm using flags like dotnet list package --outdated to check my solution for outdated/deprecated/vulnerable NuGet packages.

Verbose Logs

> dotnet list package --verbosity diag
Project 'ConsoleApp1' has the following package references
   [net7.0]: No packages were found for this framework.
The project `C:\Projects\ConsoleApp1\AngularProject1\AngularProject1.esproj` uses package.config for NuGet packages, while the command works only with package reference projects.
@martinrrm martinrrm added Functionality:ListPackage dotnet.exe list package Area:ErrorHandling warnings and errors/log messages & related error codes. Product:dotnet.exe and removed Triage:Untriaged labels Aug 17, 2023
@jeffkl
Copy link
Contributor

jeffkl commented Aug 17, 2023

Team Triage: We should treat .esproj projects the same as any other project that is not PackageReference based.

@jeffkl jeffkl added Priority:3 Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog. Pipeline:Icebox labels Aug 17, 2023
@cremor
Copy link
Author

cremor commented Aug 18, 2023

I found a related issue: #12520

@josundt
Copy link

josundt commented Jul 31, 2024

I also created a related issue in the .NET respository: #41415
The .NET team requested that I raise the issue in the NuGet repository instead.

FYI: I can confirm that the problem is still the same with both .NET SDK 8.0.303 and 9.0.100-preview.6.24328.19.
Please fix.

@beppemarazzi
Copy link

beppemarazzi commented Dec 10, 2024

EDIT: do not use this because there are unexpected side effects in visual studio / build system (i.e. error NU1012: Platform version is not present for one or more target frameworks, even though they have specified a platform: net6.0-none)

found a workaround for this:
just add

  <PropertyGroup>
    <RestoreProjectStyle>PackageReference</RestoreProjectStyle>
  </PropertyGroup>

to your .esproj file and then do a dotnet restore

@josundt
Copy link

josundt commented Dec 16, 2024

@beppemarazzi
When adding the property group above and then running dotnet restore for my solution, I get the following error:

error NU1012: Platform version is not present for one or more target frameworks, even though they have specified a platform: net6.0-none.

The RestoreProjectStyle property relates to a project's NuGet package restore behavior.
.esproj files has no relation to NuGet packages/ecosystem whatsoever, so this property is thereby not applicable to this type of project.

I therefore consider this an insufficient solution to this issue; it's a too "hacky" workaround where the unwanted side-effects are to be expected.

I think we need something better than the proposed workaround to resolve this issue.

@beppemarazzi
Copy link

@josundt
you are right: just edited my previous comment to point this. After some digging into details, I found my workaround works for older versions of Microsoft.VisualStudio.JavaScript.Sdk bot not for the latest...
Actually i found a wired undocumented combination of properties to set that solve the issue but i agree with you: it's an insufficient risky poor solution!!!!

So while we wait for a real solution the only valid workaround is to put the .esproj projects at the end of the "projects section" of the .sln file...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area:ErrorHandling warnings and errors/log messages & related error codes. Functionality:ListPackage dotnet.exe list package Priority:3 Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog. Product:dotnet.exe Type:Bug
Projects
None yet
Development

No branches or pull requests

5 participants