6

This may have already been asked before (if so provide links please).

I am working on a 'core' solution set for my company. We have several different projects in this solution set. Each project when built is turned into a NuGet Package to be used in our other solutions projects. What I am finding is I want to reference some of the projects in the 'core solution' with other projects in the 'core solution' via NuGet (verse using project references) so that when pushed to our NuGet, all packages are separate.

This way I have something like this:

|- Core
|- Core.Communication (this will also reference Core)
|- Core.CloudServices (this will also reference Core)
|- Core.BlobServices (this will reference Core and Core.CloudServices)

I have in the past create a script that after the build/package is complete, the package is copied to a shared location so that a NuGet Reference can be added to the location. This allowed for adding the NuGet Package and Restoring it (when updated) but this seems way complicated.

As we are using VSTS, I know I can commit to the branch each time and the build server will build/package for me and push it to our private NuGet source. This seems like the 'right way' to do it once the solution is established but initially this seems to slow down the development process.

The questions I pose to the community are:

  1. How do you handle this type of situation? (if you have been in it)
  2. Is there a way in .NET Core to make this automatically just work that I am unaware of?
  3. Are there VS Extensions or other 3rd party tools to help with this?
Jason H
  • 4,996
  • 6
  • 27
  • 49
  • You want to build a package and update the PackageReference in the same build, am I understanding you correctly? You can look into floating versions. There's no way to make this automatically work, since it's not exactly a mainline scenario. after pack steps are probably where most people end up. – imps Aug 06 '18 at 21:41
  • But even with floating versions this is difficult. Normally you'd have project references within the same context, and package references outside. Normally you'd run build on every project then run pack on every project. – imps Aug 06 '18 at 22:07
  • @imps - I do not really want to automatically update the package references but would like to avoid having to push them out to a NuGet Server or have a special script that moves the package files around and have to modify the nuget configuration so that it also looks into the special directory. I have never used floating versions, as this scares me that bad things could and probably will happen. – Jason H Aug 07 '18 at 09:17
  • I understand. I'm not sure there's a better way than what you are doing right now to be honest unfortunately. Rarely do I see consumers reference packages within the same solution over having project references. – imps Aug 07 '18 at 19:34
  • Possible duplicate of [A solution needed for referencing Nuget packages from projects in the same solution](https://stackoverflow.com/questions/52881585/a-solution-needed-for-referencing-nuget-packages-from-projects-in-the-same-solut) – S1r-Lanzelot Oct 23 '18 at 14:51

0 Answers0