使用NuGet包还原将PostSharp部署到源存储库

时间:2012-04-17 03:22:23

标签: nuget postsharp

是否可以将PostSharp与NuGet Package Restore一起部署到源存储库中? 我可以通过提交postharp软件包来实现这一点,但这有点否定了软件包还原功能的价值。

这就是我的所作所为。

我在csproj中看到了这个

<Import Project="..\packages\PostSharp.2.1.6.13\tools\PostSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />

(我重新命令他们无济于事)

我的构建服务器(CC.net)报告以下错误:

D:\wwwroot\www.snip.co.nz\http\www.snip.co.nz.csproj (714,3):

errorMSB4019: The imported project     "D:\wwwroot\www.snip.co.nz\packages\PostSharp.2.1.6.13\tools\PostSharp.targets" was not found. Confirm that the path in the &lt;Import&gt; declaration is correct, and that the file exists on disk.

CacheAttribute.cs (8,7):
errorCS0246: The type or namespace name 'PostSharp' could not be found (are you missing a using directive or an assembly reference?) 
…etc…

1 个答案:

答案 0 :(得分:1)

您目前(v2.1.6.13)必须修复csproj以支持Package Restore, 在导入目标元素中添加此处显示的条件:

<Import Project="..\packages\PostSharp.2.1.6.13\tools\PostSharp.targets"  
     Condition="Exists('..\packages\PostSharp.2.1.6.13\tools\PostSharp.targets')" />
相关问题