views:

37

answers:

2

Need to write the script for deploying of web site to shared directory. But for access to this directory needs enter login/password. How can i do it?

The part of MSBuild config:

 <PropertyGroup Condition="'$(SERVER)'=='DEV'">
    <DeploymentFolder>\\server\dir$</DeploymentFolder>
      <CopyConfig>dev.web.config</CopyConfig>
      <ZipFile>webSite.zip</ZipFile>
  </PropertyGroup>

Where and how i can specify login and password which allow TeamCity deploy web site to selected directory?

P.S. i cant run TeamCity with same access rights that should used in deploying.

A: 

What about an additional Build-Agent that runs under the right Account?

Another idea could be to write a MSBuild Task that performs the actions on the specified Directory. And in this Task you could use the right credentials.

=== edit ===

Yet another idea: Write a tiny tool that executes msbuild with the correct credentials. Instead of using the MSBuild Runner from TeamCity use the Command Line runner and execute that wrapper tool

Noffls
+2  A: 

You could probably use the DOS "net use"-command to map the remote server directory to a drive letter as in this example:

<Exec Command="net use Q: \\server\dir your-password /USER:your-username"/>
<Copy SourceFiles="@(YourDeploymentFiles)" DestinationFolder="Q:\%(RecursiveDir)" />
<Exec Command="net use Q: /delete"/>
Petter Wigle