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

Suppress the <dependencies> element when packing a project #5132

Closed
jnm2 opened this issue Apr 27, 2017 · 11 comments
Closed

Suppress the <dependencies> element when packing a project #5132

jnm2 opened this issue Apr 27, 2017 · 11 comments

Comments

@jnm2
Copy link

jnm2 commented Apr 27, 2017

Via #4059 (comment)

When I pack my project using msbuild /t:pack, the generated nuspec contains an empty dependencies section. I'd like to be able to entirely remove the <dependencies> element:

    <dependencies>
      <group targetFramework=".NETFramework4.6.2" />
    </dependencies>

To me it makes sense to remove it by default if there are no dependencies, but if removing it can't be the default behavior for some reason, could I have some way to suppress it? In order of preference:

  1. Remove it by default if there are no dependencies
  2. A project-level <SuppressDependencies> property
  3. A command line switch I could use when calling msbuild

Edit: the new property to use is <SuppressDependenciesWhenPacking>.

@jnm2
Copy link
Author

jnm2 commented May 4, 2017

The only case where it makes sense to insert this is when there are no net462 or lower folders, to allow the package to install.

@dazinator
Copy link

dazinator commented Mar 3, 2018

It seems I have logged a similar issue here: dotnet/msbuild#3044

What is the outcome of this?

@chuanboz
Copy link

I also want this to build source code only package, any update for this?

@bording
Copy link

bording commented Nov 1, 2018

@rohit21agrawal This something I'd like to see supported as well. Any thoughts on the feasibility of doing this?

@adamralph
Copy link

I really need this too.

@gitfool
Copy link

gitfool commented Jan 1, 2019

I had the same problem until now. Adding the following to the csproj file works for me:

<PropertyGroup>
  <SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
</PropertyGroup>

See NuGet/NuGet.Client#2237. (Note that the property was renamed along the way.)

@adamralph
Copy link

Thanks @gitfool, that works perfectly!

If only these things were documented... or at least if only someone from the NuGet team could have told us this earlier...

@adamralph
Copy link

FTR this is a dup of #6354 and I believe it can be closed.

@jnm2
Copy link
Author

jnm2 commented Jan 3, 2019

Yes, thanks for finding!

@mujdatdinc
Copy link

This is not working as expected. Looks like only one guy is using this.

@jnm2
Copy link
Author

jnm2 commented Feb 13, 2021

@mujdatdinc It's been working for me and several others. Can you clarify what you are doing and what you expect to see?

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

No branches or pull requests

9 participants