【发布时间】:2019-09-28 00:39:25
【问题描述】:
创建了一个 Xamarain 项目,并创建了一个 Devops (VSTS) 管道来构建项目并将其发布到私有 nuget 源。一切都很好,但是 Pack nuget 包的步骤失败了。
1) 我的第一次尝试是使用“Macos-latest”在解决方案上执行 msbuild@1。 Nuget 安装程序使用 nuspec 文件进行打包。打包步骤出现错误
2)然后我尝试做一个 VSBuild@1,然后是一个 DotNetCoreClI@2,但没有成功。
3) 我还尝试将 3 个项目(iOS、Android、UWP)拆分为 3 个独立的作业,但它们在打包步骤中也失败了。
4)我尝试了各种技术打包,nuspec文件,csproj文件都没有成功。
我的 YAML 文件如下所示:
'
- task: NuGetToolInstaller@1
displayName: 'Install nuget.exe 4.4.1'
inputs:
versionSpec: 4.4.1'
- task: NuGetCommand@2
displayName: "restore the ble solution"
inputs:
command: 'restore'
restoreSolution: '**/*.sln'
feedsToUse: 'select'
vstsFeed: '$(packageFeedName)'
- task: MSBuild@1
displayName: 'Build BLE solution'
inputs:
solution: "**/*.sln"
configuration: '$(buildConfiguration)'
msbuildArguments: '/p:OutputPath=$(outputDirectory) /p:JavaSdkDirectory="$(JAVA_HOME)/"'
- task: NuGetCommand@2
displayName: "pack nuget"
inputs:
command: pack
packagesToPack: './myproject.nuspec'
packDestination: '$(Build.ArtifactStagingDirectory)'
versioningScheme: byEnvVar
versionEnvVar: 'nugetVersion'
includeSymbols: true
'
我使用 nuspec 文件总是归结为相同的路径问题。
Attempting to build package from 'BLE.nuspec'.
[error]The nuget command failed with exit code(1) and error(Could not find a part of the path /Users/vsts/agent/2.155.1/work/1/s/Plugin.BLE/bin/Release/netstandard2.0.
System.IO.DirectoryNotFoundException: Could not find a part of the path /Users/vsts/agent/2.155.1/work/1/s/Plugin.BLE/bin/Release/netstandard2.0.
当我为包使用 **/*.csproj 时,我得到:
Build FAILED.
d:\a\1\s\Plugin.BLE.Android\Plugin.BLE.Android.csproj" (pack target) (1:2) ->d:\a\1\s\Plugin.BLE.Android\Plugin.BLE.Android.csproj(94,3): error MSB4019: The imported project "C:\Program Files\dotnet\sdk\2.2.105\Xamarin\Android\Xamarin.Android.CSharp.targets" was not found.
Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
【问题讨论】:
标签: xamarin azure-devops devops pack