VDir AppPool value from Property

Mar 19, 2010 at 7:12 PM

Hi all,

I have a property coming in from the environment setting files called "IISAppPool" and I'm attempting to use that value for the virtual directory without avail.  My code look something like this...

<ItemGroup>
   <PropsFromEnvSettings Include="IISAppPool" />
</ItemGroup>

<ItemGroup>
   <VDirList Include="*">
      <Vdir>Test</Vdir>
      <Physdir>..\Websites\Test</Physdir>
      <AppPool>$(IISAppPool)</AppPool>
   </VDirList>
</ItemGroup>

$(IISAppPool) is functional elswhere in the msbuild file but is empty when assigned to AppPool.  What am I doing wrong?  

Thanks in advance!

Ed

 

Coordinator
Mar 19, 2010 at 8:03 PM

Hi Ed,

I am pretty certain that this is due to MSBuild's order of evaluation for properties and items.  IISAppPool is dynamically created during execution of the build targets, so it does not exist at the time that the .btdfproj file is parsed by MSBuild.  MSBuild first parses the .btdfproj, then the imported .targets file.  Only then does it begin execution of the build targets.  By that time the entire VDirList item has already been evaluated and loaded with an empty <AppPool> metadata item.

You would have to get IISAppPool defined before MSBuild parses and evaluates the .btdfproj file, which means either 1) declaring it as an explicit property in the .btdfproj, 2) passing it in at the MSBuild command line or 3) setting it as an environment variable.  All environment variables magically become MSBuild properties.  On a server install, when the wizard asks for the various inputs that you configure in InstallWizard.xml, those inputs are all saved as environment variables so that MSBuild can see the values when it starts up.

The problem is getting the value from the settings spreadsheet into one of those three options that I mentioned above.  There's no built-in way to do that.  You could write a small command line program that reads the value from the exported settings XML file and sets it into an environment variable called IISAppPool...  But then you have to get that tied into the process before MSBuild.

Tom

Mar 19, 2010 at 8:17 PM
Thanks Tom, I was afraid of that. :(