nugetizer icon indicating copy to clipboard operation
nugetizer copied to clipboard

Issue with GetTargetFrameworksWithPlatformForSingleTargetFramework target not existing.

Open belav opened this issue 1 year ago • 2 comments

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

belav avatar Jun 11 '24 20:06 belav

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

kzu avatar Jun 12 '24 19:06 kzu

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 avatar Aug 07 '24 17:08 kzu

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

Happy Coding!

kzu avatar Nov 23 '24 01:11 kzu