CreateVirtualDirectory is not actually creating a virtual directory???

May 29, 2008 at 7:36 PM
Edited May 29, 2008 at 9:23 PM
Pardon my newb-ness, I'm just now entering the wonderful world of TFS and Team Build ;)

So I have a .NET 2008 ASP.NET solution that I'm trying to deploy into IIS after the compile.  The build completes cleanly, the build log says that the virtual directory was deleted and created, and the physical directory was successfully populated via the xcopy.  The problem is that when I go out to the build server and call up IIS Manager, I do not see the website listed.  I am at a complete loss as to why the Virtual Directory is not showing up in IIS Manager.  Any help would be much appreciated!  Version number on Microsoft.Sdc.Tasks.dll is 2.1.3041.0

Update 1:  The same behavior occurs with the latest 2.1.3071.0 build and even if I fully qualify CreateVirtualDirectory
Update 2:  Not sure what I did, but I do see the virtual directories showing up under "Default Web Site" which in our case is stopped.  The question now becomes "How do I make it a stand-alone site not running under the default site?"

Thanks!
Todd

=============================
The .proj file contains:

<

PropertyGroup>
<
WebBinariesLocationABC>$(SolutionRoot)\..\Binaries\Release\_PublishedWebSites\ABC</WebBinariesLocationABC>
</PropertyGroup>

 

 

 

 

 

<UsingTask TaskName="Microsoft.Sdc.Tasks.Web.WebSite.CreateVirtualDirectory" AssemblyFile="Microsoft.Sdc.Tasks.dll" />
<
UsingTask TaskName="Microsoft.Sdc.Tasks.Web.WebSite.DeleteVirtualDirectory" AssemblyFile="Microsoft.Sdc.Tasks.dll" />

 

<

Target Name="AfterCompile">
<
MakeDir Directories="C:\InetPub\wwwroot\ABC" />
<
DeleteVirtualDirectory VirtualDirectoryName="ABC" />
<
CreateVirtualDirectory VirtualDirectoryName="ABC" Path="C:\InetPub\wwwroot\ABC" />
<
Exec Command="xcopy /y /e &quot;$(WebBinariesLocationABC)&quot; C:\InetPub\wwwroot\ABC" />
</Target>
=============================

The build log contains:

Target AfterCompile:
Deleting virtual directory "ABC".
Creating virtual directory "ABC".
xcopy /y /e "E:\TeamBuild\builds\MyApp\MyBuildType\BuildType\..\Sources\..\Binaries\Release\_PublishedWebSites\ABC" C:\InetPub\wwwroot\ABC
....
35 File(s) copied
....
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:29.45

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Developer
May 29, 2008 at 11:39 PM
You are not specifying a website to attach the VD to and the task defaults to the Default Web Site. If you want to create a website, take a look at the Website.Create task in the help file.

Regards

Mike
Jun 3, 2008 at 7:19 PM
Edited Jun 3, 2008 at 7:29 PM

Thanks for the reply Mike.  Actually what is happening now is that it is trying to associate the virtual directory to the Default Web Site which doesn't exist in our case. 

The actual site definition for website ABC is there (and has some customizations in it) so we just want to attach the virtual directory to the existing site rather than creating it each time.  I thought that by adding the parameter   WebSiteName="ABC" to the CreateVirtual Directory task would do it.  But the task seems to be ignoring it all together.

TFSBuild.proj(165,5): error : A task error has occured.\r
TFSBuild.proj(165,5): error : Message              = Unable to load website Default Web Site\r
TFSBuild.proj(165,5): error : VirtualDirectoryName = ABC\r
TFSBuild.proj(165,5): error : MachineName          = localhost\r
TFSBuild.proj(165,5): error : WebSiteName          = Default Web Site\r
TFSBuild.proj(165,5): error : \r
TFSBuild.proj(165,5): error :    at Microsoft.Sdc.Tasks.Configuration.Web.WebSite.Load(String machineName, String description)\r
TFSBuild.proj(165,5): error :    at Microsoft.Sdc.Tasks.Web.WebSite.DeleteVirtualDirectory.InternalExecute()\r
TFSBuild.proj(165,5): error :    at Microsoft.Sdc.Tasks.TaskBase.Execute()



For reference, the new task is:
<CreateVirtualDirectory VirtualDirectoryName="ABC" Path="$(WebDeployFolder)\ABC" WebSiteName="ABC" />

 

 


mikeFourie wrote:
You are not specifying a website to attach the VD to and the task defaults to the Default Web Site. If you want to create a website, take a look at the Website.Create task in the help file.

Regards

Mike



Developer
Jun 3, 2008 at 10:22 PM
I just created a website called ABC and ran <CreateVirtualDirectory VirtualDirectoryName="ABC" Path="$(WebDeployFolder)\ABC" WebSiteName="ABC" />

It worked as expected. The odd thing is that your error log shows its failing in a call to DeleteVirtualDirectory:

                                at Microsoft.Sdc.Tasks.Web.WebSite.DeleteVirtualDirectory.InternalExecute()\r

Can you run your script with /v:diag and attach the full log. I have a feeling the create is working, but you may have left WebSiteName off the Delete.

Mike