我有一个包含5个项目的解决方案。每个项目都是通过nuget-push部署的。一些项目通过nuget引用其他项目。为了正常工作,必须先更新这些nuget程序包。
为此,我们使用Cake-Build,但nuget更新不适用于核心/标准项目。相反,必须使用remove-> add,这对我不起作用?
我该如何处理?
示例:
现在,构建脚本将编译A和B,将版本增加到v1.0.1,然后推送nuget-package。在构建C之前,需要更新A和B的nuget程序包。
示例:
如何通过Cake-Build更新软件包?!?
答案 0 :(得分:1)
如果使用项目引用并将其作为同一解决方案的一部分进行构建,则应该能够正确引用所有内容。这就是Cake本身的构建方式。
在构建0
时,我们将该版本作为常见的MSBuildSettings传递给还原。构建并打包。粗略的例子
0.30.0
}
.NET Core csproj中的项目引用看起来像
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
});