Reputation: 2733
I have a solution with 5 projects in it. Every project is deployed via a nuget-push. Some projects reference other projects via nuget. In order to work properly these nuget-packages have to be updated before they are pushed.
For this we use Cake-Build but the nuget update is not working on core/standard projects. Instead it is necessary to use remove --> add, which is not working for me?
How can I handle this?
Example:
Now the Build-Script would compile A and B, increment the version to v1.0.1, and push the nuget-package. Before C is build the nuget packages to A & B needs to be updated.
Example:
How I'm able to update the packages via Cake-Build?!?
Upvotes: 2
Views: 1361
Reputation: 5010
If you use project references and build as part of same solution, you should be able to get everything referenced correctly. That's how Cake itself is built.
When we i.e. build 0.30.0
we pass that version as common MSBuildSettings to Restore. Build and Pack. Rough example
string configuration = "Release",
version = "0.30.0",
semVersion = "0.30.0"; // for pre-release this is suffixed i.e. -alpha-001
DotNetCoreMSBuildSettings msBuildSettings = new DotNetCoreMSBuildSettings()
.WithProperty("Version", semVersion)
.WithProperty("AssemblyVersion", version)
.WithProperty("FileVersion", version);
DotNetCoreRestore("./src/Cake.sln", new DotNetCoreRestoreSettings
{
Verbosity = DotNetCoreVerbosity.Minimal,
Sources = new [] { "https://api.nuget.org/v3/index.json" },
MSBuildSettings = msBuildSettings
});
DotNetCoreBuild("./src/Cake.sln", new DotNetCoreBuildSettings()
{
Configuration = configuration,
NoRestore = true,
MSBuildSettings = msBuildSettings
});
var projects = GetFiles("./src/**/*.csproj");
foreach(var project in projects)
{
DotNetCorePack(project.FullPath, new DotNetCorePackSettings {
Configuration = configuration,
OutputDirectory = "./nuget,
NoBuild = true,
NoRestore = true,
IncludeSymbols = true,
MSBuildSettings = msBuildSettings
});
}
A project reference in .NET Core csproj looks like
<ProjectReference Include="..\Cake.Core\Cake.Core.csproj" />
Upvotes: 2