我们正在使用 VSO 和 Azure 云服务(Web 角色)。
之前,我们使用以下 build.proj
文件作为 VSO 构建定义:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<OutDir>$(MSBuildThisFileDirectory)bin</OutDir>
<Configuration>Release</Configuration>
<ProjectProperties>OutDir=$(OutDir);Configuration=$(Configuration);</ProjectProperties>
</PropertyGroup>
<ItemGroup>
<Solution Include="$(MSBuildThisFileDirectory)*.sln" />
</ItemGroup>
<Target Name="RestorePackages">
<Exec Command=""$(MSBuildThisFileDirectory).nuget\NuGet.exe" restore "%(Solution.Identity)"" />
</Target>
<Target Name="Clean">
<MSBuild Targets="Clean" Projects="@(Solution)" Properties="$(ProjectProperties)" />
</Target>
<Target Name="Build" DependsOnTargets="RestorePackages">
<MSBuild Targets="Build" Projects="@(Solution)" Properties="$(ProjectProperties)" />
</Target>
<Target Name="Rebuild" DependsOnTargets="RestorePackages">
<MSBuild Targets="Rebuild" Projects="@(Solution)" Properties="$(ProjectProperties)" />
</Target>
</Project>
原因是在 MSBuild 开始运行之前执行 NuGet 恢复。这是suggested approach由 NuGet 提供。
现在,我们正在尝试设置与 Azure 云服务的持续集成,如 this MSDN article 中的说明。 .
这意味着我们现在必须使用 TfvcContinouslyDeploymentTemplate.12.xml
构建流程模板。
但是在设置模板构建build.proj
文件时,出现以下构建错误:
Exception Message: Deploying to Azure Cloud Service requires a Visual Studio Solution (.sln) that contains either a ccproj or a lsxproj. (type DeploymentException)
Exception Stack Trace: at System.Activities.Statements.Throw.Execute(CodeActivityContext context)
at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
使用.sln
时,一切正常。但我们显然还需要在构建之前进行 NuGet 恢复。
让持续集成和 NuGet 恢复同时工作的良好解决方案是什么?
最佳答案
我刚刚了解到这是多余的。没有理由手动执行 NuGet 恢复,因为它已内置于 VSO/TFS 中。
了解更多 here .
关于azure - VSO 和 Azure 中的持续集成和 NuGet 恢复,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29936135/