Cake 构建 DotNet Core 错误
Cake build DotNet Core error
我正在尝试使用 cake 使用 dotnet 核心构建我的解决方案,但我收到了它:
C:\Program Files\dotnet\sdk.0.1\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.Common.targets(73,5): error : Project 'xxx.csproj' targets '.NETCoreApp,Version=v1.1'. It cannot be referenced by a project that targets '.NETCoreApp,Version=v1.0'. [xxx.csproj]
有什么问题吗?
如果我 运行 dotnet.exe 在 cmd 上构建,构建工作正常
- dotnet 构建 xxx.csproj
Microsoft (R) Build Engine version 15.1.548.43366
Copyright (C) Microsoft Corporation. All rights reserved.
CouchDB.Driver.Core -> xxx.dll
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:01.50
环境机
xxx.csproj版本是:
netcoreapp1.1
蛋糕--版本
Version 0.19.1+Branch.main.Sha.4c5b4fd5b1c4d9d36066ec78714027e26b211af4
dotnet.exe --版本
1.0.1
dotnet.exe
Microsoft .NET Core Shared Framework Host
Version : 1.1.0
Build : 928f77c4bc3f49d892459992fb6e1d5542cb5e86
我忘记了两件事。解决方案是:
在build.cake中设置正确的框架:
var settings = new DotNetCoreBuildSettings
{
Framework = "netcoreapp1.1",
Configuration = "Release",
OutputDirectory = "./build/"
};
DotNetCoreBuild("./src/", settings);
使用 DotNetCoreRestore 恢复 NuGet 包 nuget.exe
Task("Restore-NuGet-Packages")
.IsDependentOn("Clean")
.Does(() => {
DotNetCoreRestore("src"); // use it instead of NuGetRestore("./folder");
});
结果是:
Build
Executing task: Build
Microsoft (R) Build Engine version 15.1.548.43366
Copyright (C) Microsoft Corporation. All rights reserved.
CouchDB.Driver.Core -> xxx.dll
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:11.10
Finished executing task: Build
我正在尝试使用 cake 使用 dotnet 核心构建我的解决方案,但我收到了它:
C:\Program Files\dotnet\sdk.0.1\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.Common.targets(73,5): error : Project 'xxx.csproj' targets '.NETCoreApp,Version=v1.1'. It cannot be referenced by a project that targets '.NETCoreApp,Version=v1.0'. [xxx.csproj]
有什么问题吗?
如果我 运行 dotnet.exe 在 cmd 上构建,构建工作正常
- dotnet 构建 xxx.csproj
Microsoft (R) Build Engine version 15.1.548.43366 Copyright (C) Microsoft Corporation. All rights reserved.
CouchDB.Driver.Core -> xxx.dll
Build succeeded. 0 Warning(s) 0 Error(s)
Time Elapsed 00:00:01.50
环境机
xxx.csproj版本是:
netcoreapp1.1
蛋糕--版本
Version 0.19.1+Branch.main.Sha.4c5b4fd5b1c4d9d36066ec78714027e26b211af4
dotnet.exe --版本
1.0.1
dotnet.exe
Microsoft .NET Core Shared Framework Host
Version : 1.1.0 Build : 928f77c4bc3f49d892459992fb6e1d5542cb5e86
我忘记了两件事。解决方案是:
在build.cake中设置正确的框架:
var settings = new DotNetCoreBuildSettings { Framework = "netcoreapp1.1", Configuration = "Release", OutputDirectory = "./build/" }; DotNetCoreBuild("./src/", settings);
使用 DotNetCoreRestore 恢复 NuGet 包 nuget.exe
Task("Restore-NuGet-Packages") .IsDependentOn("Clean") .Does(() => { DotNetCoreRestore("src"); // use it instead of NuGetRestore("./folder"); });
结果是:
Build
Executing task: Build
Microsoft (R) Build Engine version 15.1.548.43366
Copyright (C) Microsoft Corporation. All rights reserved.CouchDB.Driver.Core -> xxx.dll
Build succeeded.
0 Warning(s)
0 Error(s)Time Elapsed 00:00:11.10
Finished executing task: Build