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

Add hook for excluding certain build output extensions from the nuget package #10690

Closed
Anipik opened this issue Mar 24, 2021 · 5 comments · Fixed by NuGet/NuGet.Client#3980
Closed

Comments

@Anipik
Copy link

Anipik commented Mar 24, 2021

Currently there is no way to exclude certain output extensions from the package.

https://github.com/NuGet/NuGet.Client/blob/dev/src/NuGet.Core/NuGet.Build.Tasks.Pack/NuGet.Build.Tasks.Pack.targets#L48

adding something like should do the trick

<AllowedOutputExtensionsInPackageBuildOutputFolder Condition="'$(AllowedOutputExtensionsInPackageBuildOutputFolder)' == ''">.dll; .exe; .winmd; .json; .pri; .xml; $(AllowedOutputExtensionsInPackageBuildOutputFolder)</AllowedOutputExtensionsInPackageBuildOutputFolder>

cc @safern @nkolev92 @ericstj @ViktorHofer

@ViktorHofer
Copy link

ViktorHofer commented Mar 24, 2021

Currently there is no way to exclude certain output extensions from the package.

Can't you override that property in a target before the PackTask is executed?

adding something like should do the trick

Makes sense to me. I don't think this change requires much discussion. cc @nkolev92

@ericstj
Copy link

ericstj commented Mar 24, 2021

What happens to an existing project that set AllowedOutputExtensionsInPackageBuildOutputFolder=.foo?

@ViktorHofer
Copy link

ViktorHofer commented Mar 24, 2021

Oh I did misread the proposal above.

I see 31 hits of that property being used in the dotnet org alone: https://github.com/search?q=org%3Adotnet+AllowedOutputExtensionsInPackageBuildOutputFolder&type=code.

And about 3k on GitHub overall: https://github.com/search?q=AllowedOutputExtensionsInPackageBuildOutputFolder&type=code.

@nkolev92
Copy link
Member

nkolev92 commented Mar 26, 2021

I don't have many concerns. If you add a default value that is set conditionally, you could avoid breaking people that are using this to include extra files.

    <DefaultAllowedOutputExtensionsInPackageBuildOutputFolderCondition="'$(DefaultAllowedOutputExtensionsInPackageBuildOutputFolderCondition)' == ''">dll; .exe; .winmd; .json; .pri; .xml</DefaultAllowedOutputExtensionsInPackageBuildOutputFolderCondition>
    <AllowedOutputExtensionsInPackageBuildOutputFolder>$(DefaultAllowedOutputExtensionsInPackageBuildOutputFolderCondition); $(AllowedOutputExtensionsInPackageBuildOutputFolder)</AllowedOutputExtensionsInPackageBuildOutputFolder>

Maybe something less wordy :D

@Anipik
Copy link
Author

Anipik commented Mar 29, 2021

Thanks @nkolev92, i will put up a pr for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants