简体   繁体   English

visual Studio团队服务构建-如何为Sql Server测试项目指定不同的连接字符串

[英]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.

相关问题 通过Visual Studio Team Services将SQL Project部署到VM上的SQL Server - SQL Project Deploy to SQL Server on VM through Visual Studio Team Services Visual Studio - SQL Server 数据库项目的连接字符串 - Visual Studio - Connection String for SQL Server Database Project 如何在Visual Studio 2012 SQL Project中更改与服务器的默认连接? - How to change the default connection to a server in Visual studio 2012 SQL Project? 建立连接到SQL Server的Visual Studio项目? - Build Visual Studio Project that connects to SQL Server? Visual Studio团队在线服务 - 运行sql脚本 - Visual studio team services online - running a sql script Visual Studio 2013 SQL Server数据库项目构建失败 - Visual Studio 2013 SQL Server database project build failure 如何使用VSTS(Visual Studio团队服务)发布管理将DACPAC文件部署到sql azure - How to deploy DACPAC file to sql azure using VSTS (Visual studio team services) Release Management 如何在 Visual Studio 中设置 SQL 数据库项目中的数据库连接字符串? - How to have database connection string in the SQL Database Project set up in the Visual Studio? 在不使用visual studio的情况下获取MS SQL Server连接字符串? - Getting MS SQL Server connection string without using visual studio? 如何在Visual Studio 2015中使用C#创建到SQL Server数据库的连接字符串 - How to create a connection string using C# to SQL Server database in Visual Studio 2015
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM