Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
replace projectreferences with packagereferences #7779
Hello, im currently setting up a buildserver, which builds a application that provides interfaces for other applications to communicate with it. I want to pack the Interfaces as nuget packages. But im stuck on a problem.
There are 3 layers:
my goal is to have every layer as a nuget-package, which references the dependencies as packages.
since it runs on a buildserver, it has to run automated, and here im stuck.
so how would i tackle this problem?
NuGet v4.9.2, VS 2017, .Net-Framework 4.7
your goal is to have 2 or 3 layers generate nuget packages. that is fine.
you could do both. use project references, but build nuget packages.
the thing is, how would i automate this?
i hope i understood you correctly.
in case you meant i should just build nuget packages, thats already done, what i want is that the dependency is correctly set up.
core has no dependencies
i want to create nuget packages of these three projects, but so that projectreferences are included as packagedependency with the current assemblyversion as minimum package version requirements. version numbers can differ!(e.g. core 1.0.3, extras 1.0.1, full 1.0.6)
manually i would so it this ways:
btw im using jenkins for ci/cd
i think i found a way im kind of happy with.
before i only tried to use either the nuspec or csproj but not both at the same time.
that didnt solve my problem completely yet though. so the next step was to get the right versionnumber into the dependency. after reading more from the docs and some googling i found out that how to get the assemblyversion of a dll from commandline and pass it as a parameter to the pack command to be used inside the nuspec.
in combination with following batchscript:
to get my desired nugetpackage.
before i only knew of -version and other cli-options.
the full script to automate this could now look like this:
i rewrote that pretty quick for github, there might be some mistakes, but the way how i did it should be visible.
i hope this can help someone in the future
if you have tips to optimize this im happy to get feedback