How To Auto Deploy Web Deployment Project in IIS

I have a web project, called MyWebSite,the project lives at "D:\Code\MyWebSite".

The solution (also called MyWebSite) lives at "D:\Code\Build Solutions".

I have added the web deployment project,called MyWebSite_deploy,the project lives at "D:\Code\Build Solutions\MyWebSite_deploy".

My workspace root folder is "D:\Code" and my projects and solution are checked into source control.

I have created new build type,called "MyWebSiteBuild".And my build directory is "D:\build" and drop location is "D:\Temp".

I have set the configuration platform to .NET.

I can build the Web Deployment project(MyWebSiteBuild) on my dev machine and all is well.

I am getting the dll file in "D:\Build\DemoTeamProject\MyWebSite\Binaries\.NET\Release\_PublishedWebsites\MyWebSite\bin" folder and

"D:\Temp\MyWebSite_20060826.1\.NET\Release\_PublishedWebsites\MyWebSite\bin" folder.

But it is not creating any virtual directory in IIS for the "MyWebSite_deploy".

i have checked the option "Create a IIS virtual directory for the output folder" in the MyWebSite_deploy deployment properties.

so i want that when i will run the "MyWebSiteBuild" it will automatically create a deployment virtual directory in IIS or

i have to explicitily create the virtual directory for deployment.

Any Body there!!!!!!!!!!

Please suggest me.

Regards,

Satya

[1559 byte] By [satya] at [2007-12-23]
# 1

Ok, I followed your steps and ran into a couple of snags.

1. When I specified the platform '.NET' for the PlatformToBuild element in the TFSBuild.proj file the deployment project did not even run. You need to ensure that the web deployment project is configured to build for the .NET platform and flavor combination that you are attempting to build. To detect this look through your BuildLog.txt file and search for a line similar to the following:

Target MyWebSite2_deploy:

The project "MyWebSite2_deploy" is not selected for building in solution configuration "Debug|.NET".

Typically when building web site/deployment project combinations you want to target the 'Mixed Platforms' platform. Also, be sure to have the correct 'Active Configuration' selected in visual studio when modifying the web deployment proj file. For example, if you are attempting to build and deploy the release build then ensure that is the active configuration when editing the deployment proj file through the gui in visual studio, otherwise you may be editing the debug flavor and will not see the desired results when building for the release flavor.

2. The other snag I ran into was once I got the deployment project attempting to deploy the web site I got the following error:

Target CreateVirtualDirectory:

Initializing IIS Web Server...

C:\Program Files\MSBuild\Microsoft\WebDeployment\v8.0\Microsoft.WebDeployment.targets(642,5): error : Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

Failed to create virtual directory 'MyWebSite2'.

I do not have a solution yet for the above problem, but the instructions should at least get you that far. Let me know if you run into any other issues and I'll try to get back to you about the permission issue.

Patrick

PatrickCarnahan-MSFT at 2007-8-31 > top of Msdn Tech,Visual Studio Team System,Team Foundation Server - Build Automation...
# 2
Have you looked at SDC for MSBUILD or the MSBUILD community tools? They have custom MSBUILD tasks that do just this.
RaviTerala at 2007-8-31 > top of Msdn Tech,Visual Studio Team System,Team Foundation Server - Build Automation...
# 3

Hi Ravi,

Now my deployment is working fine.

I just change the Configuration type to Mixed Platform.

After that i got the same error Access Denied. And Create virtual directory failed.

For that you have to set the SERVICE Acoount user permission in the build and drop directory.

Let, your service account user is TFS\ServiceAccount.

So you have to add the user In that two folder and set the full control permission.

Now In my case every thing is fine. It is creating the virtual directory in IIS.

Thanks...................

satya at 2007-8-31 > top of Msdn Tech,Visual Studio Team System,Team Foundation Server - Build Automation...
# 4

Hi everybody,

Now i am facing another problem.With the same approch.

i want to run the team build for remote machine.

for that i have created a build directory and drop directory in the remote machine.

When aspnet_compiler.exe is running it is taking the source file from my local workspace D:\Code\MyWebSite.

so i am getting the following error.

Solution: MyWebSite.sln, Project: MyWebSite, Compilation errors and warnings

ASPNETCOMPILER(0,0): error 1003: The directory 'D:\Code\MyWebSite\' doesn't exist.

so how i will auto deploy my web project in remote machine by running the team build.

Plz help me.

satya at 2007-8-31 > top of Msdn Tech,Visual Studio Team System,Team Foundation Server - Build Automation...
# 5

Satya

I am afraid I am getting the same error "ASPNETCOMPILER(0,0): error 1003: The directory 'D:\Code\MyWebSite\' doesn't exist". But in my case it is raising this error for only one web application out of seven web applications we have. All others are being compiled alright. The build is trying to look at root folder of the solution for the web application on the build machine.

I didn't understand what you mean by remote machine. You'll have one build machine which is configured while creating the build type isn't it?

Also can you please tell me a bit more about creating virtual directory which you blogged earlier. What do you mean by setting the SERVICE Acoount user permission in the build and drop directory.Do you mean the account which is running TeamBuildService should be an user with full control on these folder?

HK123 at 2007-8-31 > top of Msdn Tech,Visual Studio Team System,Team Foundation Server - Build Automation...
# 6

HK123

Yeah u are right.The service account is that account which is running TeambuildService shold be an user with full control on these folder.

And for that ASPNETCOMPILER error you have to

change the physical path to .\WebProjectName in the solution file and

changed <SourceWebPhysicalPath> to >..\WebDeployment in the webdeployment project file.

this will work fine.

Ok let me know.

satya at 2007-8-31 > top of Msdn Tech,Visual Studio Team System,Team Foundation Server - Build Automation...

Visual Studio Team System

Site Classified