现在让我们看一下MSBuild文件的某些方面,看看它们的含义.从持续集成周期中了解这些方面非常重要.
构建脚本用于构建解决方案,该解决方案将成为整个持续集成周期的一部分.让我们看一下构建脚本,它是作为Visual Studio的一部分在 .Net 中为我们的示例解决方案创建的.构建脚本是一个非常大的脚本,即使是一个简单的解决方案,因此我们将介绍它最重要的部分.默认情况下,构建脚本将存储在与Visual Studio中的主解决方案同名的文件中.因此,在我们的例子中,如果您打开文件 Simple.csproj ,您将看到将用于构建解决方案的所有设置.
使用和减去MSBuild版本的依赖关系;以下设置将使用CI服务器上安装的MSBuild文件.
<VisualStudioVersion Condition = "'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion> <VSToolsPath Condition = "'$(VSToolsPath)' == ''"> $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) </VSToolsPath> <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> <Import Project = "$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project = "$(VSToolsPath)\WebApplications\ Microsoft.WebApplication.targets" Condition = "'$(VSToolsPath)' ! = ''" /> <Import Project = "$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\ WebApplications\Microsoft.WebApplication.targets" Condition = "false" />
正确构建解决方案需要哪些文件 - ItemGroup tag将包含项目成功构建所需的所有必需.Net文件.这些文件需要相应地驻留在构建服务器上.
<ItemGroup> <Reference Include = "Microsoft.CSharp" /> <Reference Include = "System.Web.DynamicData" /> <Reference Include = "System.Web.Entity" /> <Reference Include = "System.Web.ApplicationServices" /> <Reference Include = "System.ComponentModel.DataAnnotations" /> <Reference Include = "System" /> <Reference Include = "System.Data" /> <Reference Include = "System.Core" /> <Reference Include = "System.Data.DataSetExtensions" /> <Reference Include = "System.Web.Extensions" /> <Reference Include = "System.Xml.Linq" /> <Reference Include = "System.Drawing" /> <Reference Include = "System.Web" /> <Reference Include = "System.Xml" /> <Reference Include = "System.Configuration" /> <Reference Include = "System.Web.Services" /> <Reference Include = "System.EnterpriseServices"/> </ItemGroup>
要使用和减去的Web服务器设置是什么;当我们访问持续部署主题时,您将看到如何使用MSBuild覆盖这些设置并将其部署到我们选择的服务器.
<UseIIS>True</UseIIS> <AutoAssignPort>True</AutoAssignPort> <DevelopmentServerPort>59495</DevelopmentServerPort> <DevelopmentServerVPath>/</DevelopmentServerVPath> <IISUrl></IISUrl> <NTLMAuthentication>False</NTLMAuthentication> <UseCustomServer>False</UseCustomServer>