6
votes

I am trying to deploy a console application to a folder on a DMZ server using autodeploy with MSBuild and Team Foundation Server.

I am already deploying multiple sites to that same server and it works great. I have tried multiple ways but the files are not deployed.

First, I tried to deploy the console app in the same way as i do for my web site, ie:

<MSBuild
    Projects="$(SolutionRoot)\MySolution.sln"
    Properties="AllowUntrustedCertificate=True;AuthType=Basic;
    Configuration=DEBUG;CreatePackageOnPublish=True;                                
    DeployIisAppPath=Default Website/dummy.dev.myapp;
    DeployOnBuild=True;DeployTarget=MsDeployPublish;
    MSDeployPublishMethod=WMSvc;
    MsDeployServiceUrl=https://xxx.xxx.xxx.xxx:8172/MsDeploy.axd;
    UserName=userid;Password=password;UseMsdeployExe=True"
/>

Without success.

EDIT: No error message is returned. It all seems to go well.

Then, I also tried to deploy the console app as follows:

<Exec Command="&quot;C:\Program Files\IIS\Microsoft Web Deploy V2\MSDeploy.exe&quot; 
                -verb:sync 
                -source:contentpath=&quot;$(OutDir)\MyApp.Precompiled&quot; 
                -dest:contentpath=&quot;D:\dev.myapp&quot;,computername=xxx.xxx.xxx.xxx,username=userid,password=password" 
                ContinueOnError="false" />

I actually also tried with computername as https://xxx.xxx.xxx.xxx:8172/MsDeploy.axd.

EDIT: The following is what I got. EXEC: FileOrFolderNotFound EXEC: Object of type 'contentPath' and path 'E:\Builds\1...\dev.myapp' cannot be created. EXEC: The path '\?\E:\Builds\1...\dev.myapp' is not valid. EXEC: 1. E:\Builds\1...\BuildType\Targets\Deploy.targets (142): The command ""C:\Program Files\IIS\Microsoft Web Deploy V2\MSDeploy.exe" -verb:sync -source:contentpath="E:\Builds\1...\dev.myapp" -dest:contentpath="D:\dev.myapp",computername=https://xxx.xxx.xxx.xxx:8172/MsDeploy.axd,username=userid,password=password" exited with code -1. I realize I haven't read all of the error, Do I really need an UNC path?

Does anyone know how to do this?

3
please post what errors you had.James Woolfenden

3 Answers

8
votes

I finally found out how to make it work.

<Exec Command="&quot;C:\Program Files\IIS\Microsoft Web Deploy V2\MSDeploy.exe&quot; 
            -verb:sync 
            -source:contentpath=&quot;$(OutDir)\MyApp.Precompiled&quot; 
            -dest:contentpath=&quot;D:\dev.myapp&quot;,computername=https://xxx.xxx.xxx.xxx:8172/MsDeploy.axd,username=userid,password=password,authtype=Basic 
            -allowUntrusted=True" 
            ContinueOnError="false" />

I changed computername to computername=https://xxx.xxx.xxx.xxx:8172/MsDeploy.axd, added authtype=Basic and allowUntrusted=True and voila it worked.

It was quite frustrating not having any kind of feedback of what went wrong with the first option. But when I was using the second alternative I got feedback to work with.

If anyone know how to make this work using the MSBuild task, please feel free to enlighten me.

3
votes

Try dirPath provider instead of contentPath, it'll behave more like a folder sync rather than IIS web site deployment.

1
votes

Considering the sync worked using the EXEC task, did you make sure you have the Microsoft.WebApplication.targets in your csproj (or vbproj) file? I could see it just ignoring that msbuild task without the correct targets file included.

For example in my web service project files, I have this towards the bottom of my csproj file

<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />