To create Application and VDIRs under it in IIS7.5

Topics: IIS and Web Services, Server Deployment
Aug 14, 2013 at 10:27 AM
I have many VDIRs that are clubbed into a application under IIS 7.5. How can I achieve the same automatically using BDTF?
IIS
 DefaultWeb Site
                 ABC Application
                                    VDIR 1
                                    VDIR 2
                                    VDIR 3
                                    VDIR 4
Currently I manually need to create the application in IIS, which then shows the VDIRs created by BTDF under it.
I tried creating the ABC Application the same way as VDIR. It did get created but it was not visisble in IIS. How is it possible to see them without adding the application?


Here's the sample config in BTDF file
                             <VDirList Include="*">
        <Vdir>ABC</Vdir>
        <Physdir>..\ABC.Services</Physdir>
        <AppPool>ABCAppPool</AppPool>
        <AppPoolNetVersion>v4.0</AppPoolNetVersion>
    </VDirList>
    <VDirList Include="*">
        <Vdir>ABC\VDIR1</Vdir>
         <Physdir>..\ABC.Services\VDIR1</Physdir>
        <AppPool>ABCAppPool</AppPool>
        <AppPoolNetVersion>v4.0</AppPoolNetVersion>
    </VDirList>
Coordinator
Aug 17, 2013 at 5:59 AM
I'd suggest that you just bypass the BTDF behavior and do it yourself. I'm assuming you are on BizTalk 2009 or newer.

You can download the MSBuild Extension Pack and add the necessary DLL's to an "ExternalDependencies" folder within your solution. Then in your .btdfproj, you can add one or more <UsingTask> elements to import the task(s) that you need to set up your IIS artifacts, using a relative path from the Deployment project folder to the DLL(s) in the ExternalDependencies folder.

You need to get those DLL's into your MSI, so add something like this to your .btdfproj:
  <Target Name="CustomRedist">
    <MakeDir Directories="$(RedistDir)\ExternalDependencies" />

    <!-- Force MSBuild to expand the item spec into physical file specs -->
    <CreateItem Include="..\ExternalDependencies\**\*.*">
      <Output TaskParameter="Include" ItemName="EDSourceGroup" />
    </CreateItem>

    <Copy DestinationFolder="$(RedistDir)\ExternalDependencies\%(RecursiveDir)" SourceFiles="@(EDSourceGroup)"/>
  </Target>
The MSBuild Extension Pack tasks are now available for use within your .btdfproj. Check out their documentation to figure out how and what tasks to use.

Now add an override for the Deployment Framework's DeployVDirs target:
  <Target Name="DeployVDirs" Condition="'$(IncludeVirtualDirectories)' == 'true'">
      <!-- Use Extension Pack tasks here -->
  </Target>
Similarly you may want to override the UndeployVdirs target:
  <Target Name="UndeployVDirs" DependsOnTargets="SetWinVer;GetSoftwarePaths" Condition="'$(IncludeVirtualDirectories)' == 'true' and '$(SkipUndeploy)' == 'false' and '$(UndeployIISArtifacts)' == 'true'">
      <!-- Use Extension Pack tasks here -->
  </Target>
I haven't tested any of this but it should be close. Hopefully that's enough to get you on your way.

Thanks,
Tom