[英]visual studio team services build - How to specify different connection string for a Sql Server Test Project
I have a SQL Server unit testing project, the connection string for the database is located in the app.config file as follows 我有一个SQL Server单元测试项目,数据库的连接字符串位于app.config文件中,如下所示
<configuration>
<configSections>
<section name="SqlUnitTesting" type="Microsoft.Data.Tools.Schema.Sql.UnitTesting.Configuration.SqlUnitTestingSection, Microsoft.Data.Tools.Schema.Sql.UnitTesting, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</configSections>
<SqlUnitTesting>
<!--<DatabaseDeployment DatabaseProjectFileName="..\..\..\AklAlbait.Database\AklAlbait.Database.sqlproj"
Configuration="Debug" />-->
<DataGeneration ClearDatabase="true" />
<ExecutionContext Provider="System.Data.SqlClient" ConnectionString="Data Source=.;Initial Catalog=AklAlbait;Persist Security Info=True;User ID=sa;Pooling=False;Connect Timeout=30"
CommandTimeout="30" />
<PrivilegedContext Provider="System.Data.SqlClient" ConnectionString="Data Source=.;Initial Catalog=AklAlbait;Persist Security Info=True;User ID=sa;Pooling=False;Connect Timeout=30"
CommandTimeout="30" />
</SqlUnitTesting>
</configuration>
Now when i try to create a build definition to run on VS team services (VSO), i need away to specify a different connection string to be used, how can i do this?? 现在,当我尝试创建要在VS团队服务(VSO)上运行的构建定义时,我需要指定要使用的其他连接字符串,我该怎么做? in the case of Team Foundation Server we can add another config file named "BuildComputer.app.config", where BuildComputer is the name of the computer on which your build agent runs. 对于Team Foundation Server,我们可以添加另一个名为“ BuildComputer.app.config”的配置文件,其中BuildComputer是运行您的构建代理的计算机的名称。 ( https://msdn.microsoft.com/en-us/library/jj851202(v=vs.103).aspx ). ( https://msdn.microsoft.com/zh-cn/library/jj851202(v=vs.103).aspx )。 I need something that works on the online team foundation build. 我需要一些可以在在线团队基础上构建的东西。
You can add a configuration for VSTS build and use SlowCheetah to transform the app.config file base on the configuration during the build. 您可以为VSTS构建添加配置,并在构建期间使用SlowCheetah基于该配置转换app.config文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.