0

I have a solution which contains more than one Project. Project structure is as below.

/root
 A.sln
 A.nuspec
 /ProjectB
   projectB.csprj
   projectB.nuspec
 /ProjectC
   projectC.csprj
   projectC.nuspec

I have a few question.

1- What happens if I run nuget pack A.nuspec in root folder. Is there a way package all Project in a solution.

2- When I send the code TFS, with "NuGet Packager" I can use a regex to packege all sub Project as shown below. Is there a way to use such a regex in local environment.

enter image description here

3- Is it possible to create a nupkg contain both sub Project.

4- Is it possible to create a nupkg contain more than one dll. Can I put all dependency of the Project into nupkg.

clockworks
  • 3,755
  • 5
  • 37
  • 46

1 Answers1

0

1- What happens if I run nuget pack A.nuspec in root folder. Is there a way package all Project in a solution.

I don't believe there is a way to package all project in a solution by using .nupsec. That because the process of creating a package always begins with creating a .nuspec package manifest file that describes your package contents. This manifest drives the creation of the package as well as its usage when installed into a project not solution. And the ID and Version must be unique in the .nupsec, so we could not use the unique ID and Version to specify multiple projects.

2- When I send the code TFS, with "NuGet Packager" I can use a regex to packege all sub Project as shown below. Is there a way to use such a regex in local environment.

The answer is NO. I have test it on my local machine, the wildcard is treated as Illegal characters in the command line.

3- Is it possible to create a nupkg contain both sub Project.

If I understand you correctly, you mean the sub Project is reference project? If yes, the answer is yes. You can use the the option "IncludeReferencedProjects" to include referenced projects either as dependencies or as part of the package. please refer to this document for detail.

4- Is it possible to create a nupkg contain more than one dll. Can I put all dependency of the Project into nupkg.

Of course you can. You can refer to another thread which I have answered for more detail. If you want to put all dependencies of the Project into nupkg, you can use the <dependencies> to include all dependencies in the .nuspec.

    <dependencies>
       <dependency id="Newtonsoft.Json" version="9.0" />
    </dependencies>
Leo Liu
  • 71,098
  • 10
  • 114
  • 135