dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.61k stars 1.04k forks source link

Azure Dev ops msbuild failing for package of .net 6.0 Service fabric project with error in Microsoft.NET.Publish.targets #26459

Open guruvonline opened 2 years ago

guruvonline commented 2 years ago

We have an upgraded and existing Service Fabric(SF) project running on .NET framework 4.6.1 to .net 6.0 and the old build pipeline is not working and failing in packagestage for SF project

package stage is failing and from error looks like the target "_CopyResolvedFilesToPublishPreserveNewest" is not looking for binaries in correct path. from prior steps logs the binaries are generated under obj\x64\release\mybinary.dll But _CopyResolvedFilesToPublishPreserveNewest target is looking under ob\release\mybinary.dll.

how to make sure msbuild /t:package (which internally is calling dotnet publish target) is looking for binary in correct location (X64 folder)

below is error message

[error]C:\Program Files\dotnet\sdk\6.0.301\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(248,5): Error MSB3030: Could not copy the file ob\release\mybinary.dll. because it was not found.

Thanks

marcpopMSFT commented 2 years ago

You will want to try creating an https://aka.ms/binlog and digging into how the path to that item gets set. It looks like it computes the file list in target _ComputeResolvedFilesToPublishTypes which grabs from the Item ResolvedFileToPublish which gets updated a few different ways so hard to know exactly how a bad path is ending up in there for you.