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

The -IncludeReferencedProjects does not work in Nuget Version 4.1.0.2450 #5720

Closed
thejeff77 opened this issue Aug 8, 2017 · 17 comments
Closed
Labels

Comments

@thejeff77
Copy link

thejeff77 commented Aug 8, 2017

Details about Problem

The -IncludeReferencedProjects command doesn't work - it does not add the dependent DLLs into the nuget package. The detailed output lists the referenced projects under "dependencies" but doesn't pack them into the package. Any help or guidance is appreciated.

NuGet product used (NuGet.exe | VS UI | Package Manager Console | dotnet.exe):

NuGet version (4.1.0.2450):

dotnet.exe --version (1.0.4):

VS version (15.2):

OS version (Win 10 V1703, Build 12063.483):

Worked before? If so, with which NuGet version:
Hasn't worked before

Detailed repro steps so we can see the same problem

  1. Execute "nuget pack .\SDKs\FileSystem\FileSystemSDK\FileSystemSDK.csproj -IncludeReferencedProjects"
  2. Observe package (by renaming .nupkg to .zip), the dependent dlls from referenced projects are not included.

Other suggested things

Verbose Logs

PM> nuget pack .\SDKs\FileSystem\FileSystemSDK\FileSystemSDK.csproj -IncludeReferencedProjects -Verbosity detailed
NuGet Version: 4.1.0.2450
Attempting to build package from 'FileSystemSDK.csproj'.
MSBuild auto-detection: using msbuild version '15.1.1012.6693' from 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\bin'. Use option -MSBuildVersion to force nuget to use a specific version of MSBuild.
Packing files from 'C:\HSAClients<redacted>\SDKs\FileSystem\FileSystemSDK\bin\Debug'.
Add file 'C:\HSAClients<redacted>\SDKs\FileSystem\FileSystemSDK\bin\Debug\FileSystemSDK.dll' to package as 'lib\dotnet5.0\FileSystemSDK.dll'
WARNING: Description was not specified. Using 'Description'.

Id: FileSystemSDK
Version: 1.0.0.0
Authors:
Description: Description
Dependencies: Microsoft.NETCore [5.0.0, ), Microsoft.NETCore.Portable.Compatibility [1.0.0, ), Newtonsoft.Json [9.0.1, ), NuGet.Build [2.12.0, ), NuGet.CommandLine [4.1.0, ), <**Referenced Project #**1> [1.0.0, ), <Referenced Project #2> [1.0.0, )

Added file '[Content_Types].xml'.
Added file '_rels/.rels'.
Added file 'FileSystemSDK.nuspec'.
Added file 'lib/dotnet5.0/FileSystemSDK.dll'.
Added file 'package/services/metadata/core-properties/26725b99ca7d4d6a9c49eea446210529.psmdcp'.

Successfully created package 'C:\HSAClients<Redacted>\FileSystemSDK.1.0.0.nupkg'.
PM>

Sample Project

Very helpful if you can zip a project and paste into this issue!

Upon request, it is a straightforward issue, hopefully you can do this yourself because I can't put my project in here.

@nkolev92
Copy link
Member

nkolev92 commented Aug 8, 2017

//cc
Any ideas @rohit21agrawal

@nkolev92 nkolev92 added Functionality:Pack Triage:Investigate RegressionFromPreviousRTM A regression from the last RTM. Example: worked in 6.2, doesn't work in 6.3 Type:Bug and removed RegressionFromPreviousRTM A regression from the last RTM. Example: worked in 6.2, doesn't work in 6.3 labels Aug 8, 2017
@nkolev92
Copy link
Member

@thejeff77
From https://docs.microsoft.com/en-us/nuget/tools/nuget-exe-cli-reference#pack

Indicates that the built package should include referenced projects either as dependencies or as part of the package. If a referenced project has a corresponding .nuspec file that has the same name as the project, then that referenced project is added as a dependency. Otherwise, the referenced project is added as part of the package.

Does your dependent project have a nuspec file that has the same name as the project?

Thanks!

@thejeff77
Copy link
Author

No. Since I'm building with Nuget 4, I'm making the assumption that building with .csproj files is the recommended approach. I'm also witnessing that the referenced project is in fact not being added as part of the package. Thanks for any additional help or fixes.

@rohit21agrawal
Copy link
Contributor

@thejeff77 is this a NETCore project that you are trying to pack?

@thejeff77
Copy link
Author

Not entirely sure, but I can check tomorrow. Does that change things?

@rohit21agrawal
Copy link
Contributor

yes. NuGet.exe doesn't really have support for packing NETCore projects. you should use dotnet.exe pack or msbuild /t:pack to pack a NETCore project.

Also, for NETCore projects, any referenced projects are added as a package reference by design. We are, however, considering working on implementing support for adding referenced project's dll into the parent nupkg.

@thejeff77
Copy link
Author

Hmm, I'll give some of those a try. I'll try to add more context tomorrow for what I was trying to do, and let you know if its a NETCore project.

PLEASE do that! If the nuget pack command could somehow put all of the files that end up in bin/<Debug|Release> into the package automatically that would be awesome. I think that is what this command is supposed to do... It has a sort of recursive nature to it..

@ghost
Copy link

ghost commented Aug 31, 2017

I'm currently experiencing the same problem with a regular NET.4.5.2 project. So it appears this problem is NOT NETCore related. Any progress on this issue would be much appreciated.

@rohit21agrawal
Copy link
Contributor

@basbossinkdivverence could you please attach a repro project for us to investigate?

@ghost
Copy link

ghost commented Sep 1, 2017

An example reproduction can be found here.

@EckyZero
Copy link

EckyZero commented Oct 9, 2017

Bump. Any update on this?

@ghost
Copy link

ghost commented Oct 10, 2017

I don't know if your question is directed to me but I've posted a link to a repository that reproduces this problem quite some time ago. The reproduction repository can be found here: https://github.com/basbossinkdivverence/nuget-5720-repro .

@rohit21agrawal
Copy link
Contributor

rohit21agrawal commented Oct 10, 2017

@basbossinkdivverence this is because you have a project.json in your project. the presence of project.json/nuspec is seen as an indication that the project will be packed and shipepd as a nupkg.

The -IncludeReferencedProject flag only really makes sense when your project is managing dependencies via packages.config file.

Also note that project.json is now deprecated and i strongly urge you to make a move to PackageReference based csproj files.

@rohit21agrawal rohit21agrawal added Resolution:ByDesign This issue appears to be ByDesign and removed Triage:Investigate labels Oct 10, 2017
@thejeff77
Copy link
Author

As you can see in the original post, nuget is creating the package from the csproj file which is the recommended approach for this version of nuget, and isn't related to project.json or packages.config per the reason you closed this post.

Can you relate the reason for the original post to the reason you decided to close this defect?

"Attempting to build package from 'FileSystemSDK.csproj'."

@txwizard
Copy link

So if we go the advocated route of PackageRef, we sacrifice automated package reference chaining? If so, that's a load of crap!

@DavidStrickland0
Copy link

Still waiting on this one. @rohit21agrawal you closed this as works as expected saying
"i strongly urge you to make a move to PackageReference based csproj files".
Of course thats exactly what the OP said he was doing
Execute "nuget pack .\SDKs\FileSystem\FileSystemSDK\FileSystemSDK.csproj -IncludeReferencedProjects"

@DavidStrickland0
Copy link

DavidStrickland0 commented Sep 30, 2019

Looks like there are multiple reports. Guess this should have been closed as duplicate versus Works as expected.
Duplicate of 4054#

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

No branches or pull requests

6 participants