【发布时间】:2020-07-23 16:10:18
【问题描述】:
我正在尝试为 C# 项目设置管道,该项目使用构建配置来决定要安装哪个包。我可以在 Visual Studio 中很好地构建,但是在 Azure Pipelines 上使用 NuGetCommand@2 无法恢复包。看起来在使用该命令时,我在 csproj 文件中创建的属性未设置,因此 NuGet 尝试查找无效版本的包。有没有办法解决这个问题?
csproj:
...
<PropertyGroup Condition="$(Configuration.Contains('2020'))">
<RevitVersion>2020</RevitVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Autodesk.Revit.SDK" Version="$(RevitVersion).*" IncludeAssets="build; compile" />
</ItemGroup>
管道:
...
variables:
solution: '**/*.sln'
projects: '**/*.csproj'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release 2020'
steps:
- task: NuGetToolInstaller@1
displayName: 'Install NuGet'
inputs:
versionSpec:
- task: NuGetCommand@2
displayName: 'Restore packages'
inputs:
command: 'restore'
restoreSolution: '$(solution)'
configuration: $(buildConfiguration)
feedsToUse: 'select'
vstsFeed: '<private feed id>'
错误:
error MSB4018: System.ArgumentException: '.*' is not a valid version string.
【问题讨论】:
标签: .net nuget azure-pipelines csproj