自动构建部署

--满足条件,替换为正式环境的dll

if not $(ConfigurationName) == Pro goto end
xcopy $(SolutionDir)release $(SolutionDir)debugin /E /I /Y
:end

--web.Pro.config

<connectionStrings>
<add name="MyDB"
connectionString="Data Source=ProSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True"
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>


<appSettings>
<add key="test" value="web.pro.config" xdt:Transform="SetAttributes(value)" xdt:Locator="Match(key)"/>

</appSettings>

--sql批处理

osql -S"127.0.0.1" -U"sa" -P"sa" -d"Northwind" -i"%CD%/1.sql"
osql -S"127.0.0.1" -U"sa" -P"sa" -d"Northwind" -i"%CD%/2.sql"

sqlcmd -S"127.0.0.1" -U"sa" -P"sa" -d"Northwind"  -i"%CD%/1.sql"
sqlcmd -S"127.0.0.1" -U"sa" -P"sa" -d"Northwind"  -i"%CD%/2.sql"

原文地址:https://www.cnblogs.com/zftylj/p/msbuilder.html