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
OutputPath logic in Pack targets in a customized build doesn't work properly #9234
Comments
Supersedes #9231 |
In which project types is this an issue?
Can you give an actual example? In #9231, I simply wanted a default so that when you install the SDK, you don't get errors such as PackageOutputPath not being set! |
In SDK based projects the structure is and should remain: bin\Debug*.nupkg The outputs should mimic one another. So the non-sdk based project defaults should be: App |
In the SDK project, the structure becomes
If we just use the With |
That's why I offered two solutions without needing to modify common targets |
Please provide a repro. |
Sorry about the mistake! fixed the comment Only nupkg path is wrong. nuspec uses Here's the reproPack any project and look at the directory tree. Then change the properties in |
Ok, I finally understand your concern. A few points however:
Given that here are my recommendations.
|
In SDK projects, single-targeting will put the output nupkg to Package path should not change for any custom build except
Are you sure that's what we want? The We can do the There are proposals to unify build outputs. I think this change might play well with those. |
I screwed up something in my test for SDK based projects. |
It's practically done. Let me know if there are any issues with the tests. I have yet to add framework pack tests too but that depends on changes from MSBuild common targets. I have asked MSBuild team on |
I posted a comment on the PR to clean up a thing or two. Because the pack targets are installed and used with both newer and older VS versions, we can consider a different default for non-SDK based projects. Sorry it took us a while to fully understand to what you were proposing. |
I have updated the repro projects link: #9234 (comment)
VS team can update pack targets in the next revision, right? If we're back porting changes just to have the default, we can set |
Not sure what you by vs team, but NuGet owns these experiences.
I don't think there'll be any servicing...the need is not there. |
I suppose, we could wait for dotnet/msbuild#1664. PR to Add
If it's urgent, I'll open a separate PR for using |
If you want to keep the changes isolated, let's reopen #9231 and handle that in a different PR. |
This should free the SDK from having to manage NuGet Pack's `PackageOutputPath` property. This was possible because of the `BaseOutputPath` that'll be used instead of `OutputPath` in the Pack targets. It does depend on NuGet's Fix. Issue: NuGet/Home#9234 PR: NuGet/NuGet.Client#3270 Hopefully, this change won't break anything...
Me too. One PR is enough for this change. Still waiting on the MSBuild PR. |
This should free the SDK from having to manage NuGet Pack's `PackageOutputPath` property. This was possible because of the `BaseOutputPath` that'll be used instead of `OutputPath` in the Pack targets. It does depend on NuGet's Fix. Issue: NuGet/Home#9234 PR: NuGet/NuGet.Client#3270 Hopefully, this change won't break anything...
I am not quite sure what was agreed here. $(OutputPath) returns different paths when used with build, pack and nuget commands. An example for build output of Microsoft.NET.Sdk.Razor project type in Release mode and .NET 8: Build -> /bin/Release/net8.0 Now, I wanted to execute nuget add command after Pack command, so I used MSBuild Task for this purpose inisde .csproj:
Is this different behavior intentional? If yes, how can I achieve my task, without using hardcoded paths in nuget add command for nupkg file? I tried setting PackageOutputPath to |
The |
NuGet.Build.Tasks.Pack project in NuGet.Client repo
File: NuGet.Build.Tasks.Pack.targets(149-152)
I don't know why but when I try to customise a build relying on Pack targets, the output path logic hits me with so many issues that it doesn't work out of the box.
There are two main issues here,
OutputPath
should beBaseOutputPath
since, you are generating single package for many targets at once, which is similar toNuSpecOutputPath
(hasBaseIntermediateOutputPath
).Related issue: dotnet/sdk#10730
Fix/Solution: Move the logic out of the target and place it where
NuSpecOutputPath
property is.Breaks anything?: N/A
The text was updated successfully, but these errors were encountered: