Reputation: 3091
I have a Visual Studio 2015 Solution which contains multiple projects. Some of these projects reference each other. Example
Solution
Project A
Project B - references Project A
On teamcity, I want to create nuget packages for each of these projects, such that when Nuget is generating a package from Project B, I want it to be aware that Project A has a Nuget package and reference that Nuget package instead of having to use the -IncludeReferencedProjects flag.
Is this possible? If yes, how?
Upvotes: 0
Views: 2200
Reputation: 100581
Using VS 2017 (or the dotnet
cli tooling - labelled ".net core SDK") you can build libraries using the new sdk-based csproj tooling that have exactly that behaviour: Each project will produce a separate NuGet package and project references will be replaced with NuGet dependencies.
To do that, use the .NET Standard Library project template (or dotnet new lib
on the commandline) - if you want to build your libraries for the .NET Framework, change the content of the <TargetFramework>
element in the csproj
file from netstandard1.4
to e.g. net461
(there just isn't a .NET Framework library template (yet?) that uses the new project system / tooling).
To build nuget packages you then use dotnet pack
or msbuild /t:Pack
in your CI build (there is a TeamCity plugin for building with the .net core tools as well. See https://blog.jetbrains.com/teamcity/2016/11/teamcity-dotnet-core/).
Upvotes: 2