web deployment - MSBuild Web Deploy not updating connection strings -
i trying deployment process , running on production server. using web deploy , publish profiles accomplish this, , have working correctly, apart updating of connection strings suit production server.
i using:
msbuild myproj.csproj /p:deployonbuild=true;publishprofile=myprofile;configuration=release
to create publish package, , the:
call myproj.deploy.cmd /y /m:http://myserver/msdeployagentservice -allowuntrusted /u:user /:password
so working, packages , sends server fine, , configures iis correctly, points wrong database.
my publishing profile looks like:
<?xml version="1.0" encoding="utf-8"?> <project toolsversion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <propertygroup> <webpublishmethod>msdeploy</webpublishmethod> <siteurltolaunchafterpublish /> <msdeployserviceurl>http://myserver</msdeployserviceurl> <deployiisapppath>website</deployiisapppath> <remotesitephysicalpath /> <skipextrafilesonserver>true</skipextrafilesonserver> <msdeploypublishmethod>remoteagent</msdeploypublishmethod> <username>user</username> <_savepwd>true</_savepwd> <publishdatabasesettings> <objects xmlns=""> <objectgroup name="dbcontext" order="1" enabled="false"> <destination path="data source=server;initial catalog=productiondb;user id=user;password="password"" name="" /> <object type="dbcodefirst"> <source path="dbmigration" dbcontext="myproj.repositories.dbcontext, myproj.repositories" migrationconfiguration="myproj.repositories.migrations.configuration, myproj.repositories" origin="configuration" /> </object> </objectgroup> <objectgroup name="defaultconnection" order="2" enabled="false"> <destination path="data source=server;initial catalog=productiondb;user id=user;password="password"" name="" /> <object type="dbdacfx"> <presource path="data source=localhost;initial catalog=devdb;user id=user;password="password"" includedata="false" /> <source path="$(intermediateoutputpath)autoscripts\defaultconnection_incrementalschemaonly.dacpac" dacpacaction="deploy" /> </object> <updatefrom type="web.config"> <source matchvalue="data source=localhost;initial catalog=devdb;user id=user;password=password" matchattributes="$(updatefromconnectionstringattributes)" /> </updatefrom> </objectgroup> </objects> </publishdatabasesettings> </propertygroup> <itemgroup> <msdeployparametervalue include="$(deployparameterprefix)dbcontext-web.config connection string"> <parametervalue> info source=server;initial catalog=productiondb;user id=user;password="password"</parametervalue> </msdeployparametervalue> <msdeployparametervalue include="$(deployparameterprefix)defaultconnection-web.config connection string"> <parametervalue>data source=server;initial catalog=productiondb;user id=user;password="password"</parametervalue> </msdeployparametervalue> </itemgroup> </project>
annoyingly works fine when publishing straight vs2012, not via command line. there switch or alternative missing msbuild phone call maybe?
it not working correctly in myproj.setparameters.xml file, connection strings shown in there wrong. if manually alter these right connection strings, web.xml file right on production server 1 time deployed. how right string setparameters file? help appreciated.
in end around this, in visual studio created parameters.xml file in root of project holds values of connection strings used on production server. these picked , used instead of default values.
the parameters.xml file looks like:
<?xml version="1.0" encoding="utf-8" ?> <parameters> <parameter name="defaultconnection-web.config connection string" description="" defaultvalue=""tags="" />
just add together many require , populate attributes required
msbuild web-deployment publishing msdeploy webdeploy
No comments:
Post a Comment