【发布时间】:2018-10-10 14:56:01
【问题描述】:
我正在 Jenkins 上为多个项目运行“使用 MSBuild 构建 Visual Studio 项目或解决方案”以生成 nuget 包。
使用的MSBuild是最新的Visual Studio Build Tools
项目中使用的.NET Core sdk版本是1.0.4
Company.Core.csproj:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp1.0</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>
</Project>
但是,在执行构建时,使用的 SDK 版本始终是机器上安装的最新 SDK (2.x)。
C:\Program Files\dotnet\sdk\2.1.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(198,5):
error NETSDK1064: Package Microsoft.CSharp, version 4.0.1 was not found.
It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions.
[C:\Workspaces\Company.Core\Company.Core.csproj]
卸载 2.1.400 SDK 版本后出现错误:
C:\ProgramFiles\dotnet\sdk\1.1.10\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependencyResolution.targets(308,5):
error : Assets file 'C:\Workspaces\Company.Core\obj\project.assets.json' not found. Run a NuGet package restore to generate this file. [C:\Workspaces\Company.Core\Company.Core.csproj]
用于支持 .net Core 1.0.4 的安装是 .NET Core 1.0.4 & 1.1.1 SDK 1.0.1 使用说明:
Windows 服务器托管
如果您希望在 Windows 服务器,可以安装 IIS 的 ASP.NET Core 模块 单独在服务器上,无需安装 .NET Core 运行时。你可以 下载 Windows (Server Hosting) 安装程序并运行以下命令 来自管理员命令提示符的命令:DotNetCore.1.0.4_1.1.1-WindowsHosting.exe OPT_INSTALL_LTS_REDIST=0 OPT_INSTALL_FTS_REDIST=0
我还在csproj中添加了RuntimeFrameworkVersion,没有效果。
<RuntimeFrameworkVersion>1.0.4</RuntimeFrameworkVersion>^
global.json 也会被忽略
{
"sdk": {
"version": "1.0.4"
}
}
【问题讨论】:
标签: jenkins asp.net-core msbuild .net-core continuous-integration