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

Package file is always updated on a build even when there are no changes #434

Open
davidhunter22 opened this issue Sep 13, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@davidhunter22
Copy link

davidhunter22 commented Sep 13, 2023

I have a project that creates a NuGet package and it all works as expected.

However I did just notice that the .nupkg file gets overwritten every time I do a build even if it has not changed. Is there some way, perhaps using CopyToOutputDirectory that will only overwrite the file if it has changed.

I am tempted to build into a temporary location and then do the copy manually in the MSBuild project but I am wondering if this is already build in and I don't understand how to get it to work.

Back this issue
Back this issue

@davidhunter22 davidhunter22 added the bug Something isn't working label Sep 13, 2023
@kzu
Copy link
Member

kzu commented Sep 15, 2023

Typically, you should not be building the package on build. NuGet API itself (for package creation, which is what we use) doesn't provide incrementality checks of any kind.

Perhaps this could be added as an inputs/outputs on the final package contents to be packed. But even that might not be precise, since many manifest properties come from the project properties, and not files, so the MSBuild incrementality wouldn't work in that case.

May I ask why you pack on build?

@kzu kzu added documentation Improvements or additions to documentation question Further information is requested and removed bug Something isn't working labels Oct 11, 2023
@kzu
Copy link
Member

kzu commented Oct 11, 2023

On second thought: so you're not trying to avoid the overhead of packing the .nupkg, just that the final file is not overwritten if it hasn't changed? Perhaps this could be added 🤔

@kzu kzu added enhancement New feature or request and removed documentation Improvements or additions to documentation question Further information is requested labels Oct 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants