devlooped / nugetizer

A simple to understand packing model for authoring NuGet packages
https://clarius.org/nugetizer/
MIT License
260 stars 7 forks source link

Issue with GetTargetFrameworksWithPlatformForSingleTargetFramework target not existing. #502

Closed belav closed 5 days ago

belav commented 5 months ago

Describe the Bug

Steps to Reproduce

I can't supply a reproduction repo at this point, but I am just running nugetize against our very large solution with ~100 projects. Looking at replacing dotnet pack with nugetize

That results in

C:\projects\insite-commerce\Src\Backend\Startup\Insite.WebApp\Insite.WebApp.csproj : error MSB4057: The target "GetTargetFrameworksWithPlatformForSingleTargetFramework" does not exist in the project.
C:\projects\insite-commerce\Src\Backend\Insite.SystemViews\Insite.SystemViews.csproj : error MSB4057: The target "GetTargetFrameworksWithPlatformForSingleTargetFramework" does not exist in the project.

I don't see the GetTargetFrameworksWithPlatformForSingleTargetFramework target anywhere in the nugetizer code. I did try adding an empty target <Target Name="GetTargetFrameworksWithPlatformForSingleTargetFramework" /> to the two projects in question. Which gets me further but results in these errors.

C:\projects\insite-commerce\Src\Backend\Startup\Insite.WebApp\Insite.WebApp.csproj : error MSB4057: The target "GetTargetPath" does not exist in the project.
C:\projects\insite-commerce\Src\Backend\Insite.SystemViews\Insite.SystemViews.csproj : error MSB4057: The target "GetTargetPath" does not exist in the project.
C:\projects\insite-commerce\Src\Backend\Startup\Insite.WebApp\Insite.WebApp.csproj : error MSB4057: The target "GetTargetPathWithTargetPlatformMoniker" does not exist in the project.

The projects in question - one is <Project Sdk="Microsoft.NET.Sdk.Web"> and the other is <Project Sdk="Microsoft.NET.Sdk.Razor"> both targeting just net8.0, although the nuget project targets net48 and net8.0.

I do have <IsPackable> set in the Web project and know that dotnet pack is packing it correctly (although not a lot of the dependencies which is why I started looking into nugetizer)

Is it possible that nugetizer doesn't work with these two types of projects? Or would you have any ideas about the original GetTargetFrameworksWithPlatformForSingleTargetFramework problem? From here it seems like that target should be skipped if it doesn't exist. And that target is only in a couple of places in the msbuild repo.

Back this issue Back this issue

kzu commented 5 months ago

Thanks for reporting the issue. Please consider sponsoring @devlooped so I can prioritize this issue 🙏

kzu commented 3 months ago

Please provide a minimal repro with the setup for those two projects that would be representative. I haven't been able to repro since the setup/config choices are unknown.

kzu commented 5 days ago

This issue has been closed automatically because it needs more information and has not had recent activity.

Happy Coding!