Xamarin NuGet包约束似乎不起作用

时间:2014-10-13 15:34:07

标签: nuget xamarin-studio

根据release notes,Xamarin Studio 5.5在packages.config文件中添加了对包版本约束的支持。按照他们的例子:

<package id="jQuery" version="1.4.1" targetframework="net40" allowedversions="[1.4.1,1.8)"></package>

...我将packages.config更改为以下内容:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  ...
  <package id="ServiceStack" version="3.9.71" allowedversions="[3.9.71,4)" targetFramework="net45"></package>
  <package id="ServiceStack.Common" version="3.9.71" allowedversions="[3.9.71,4)" targetFramework="net45"></package>
  <package id="ServiceStack.Logging.NLog" version="3.9.71" allowedversions="[3.9.71,4)" targetFramework="net45"></package>
  <package id="ServiceStack.OrmLite.MySql" version="3.9.71" allowedversions="[3.9.71,4)" targetFramework="net45"></package>
  <package id="ServiceStack.Redis" version="3.9.71" allowedversions="[3.9.71,4)" targetFramework="net45"></package>
  <package id="ServiceStack.Text" version="3.9.71" allowedversions="[3.9.71,4)" targetFramework="net45"></package>
</packages>

(ServiceStack v3在BSD许可下可用,而v4是商业版。)

不幸的是,Xamarin Studio仍然告诉我,我有6个可用的更新,并尝试将它们全部更新到版本4.0.32,如果我允许它尝试更新。

有没有人在Xamarin Studio 5.5中成功使用它?

1 个答案:

答案 0 :(得分:2)

不幸的是发行说明重新格式化了原始标记,因此显示的xml不正确。属性allowedVersions区分大小写。你可以用小写字母表示。

您的packages.config文件应如下所示:

<packages>
  <package id="ServiceStack" version="3.9.71" allowedVersions="[3.9.71,4)" targetFramework="net45" />
  <package id="ServiceStack.Common" version="3.9.11" allowedVersions="[3.9.71,4)" targetFramework="net45" />
  <package id="ServiceStack.Logging.NLog" version="3.9.71" allowedVersions="[3.9.71,4)" targetFramework="net45"/>
  <package id="ServiceStack.OrmLite.SqlServer" version="3.9.14" allowedVersions="[3.9.71,4)" targetFramework="net45" />
  <package id="ServiceStack.Redis" version="3.9.11" allowedVersions="[3.9.71,4)" targetFramework="net45" />
  <package id="ServiceStack.Text" version="4.0.32" allowedVersions="[3.9.71,4)" targetFramework="net45" />
</packages>