none
Biztalk. Using variables with conditions in deployment.btdfproj

    Question

  • Hi colleagues,

    I'm trying to make my deployment configuration more flexible. For that target I want to have different deployment configurations for different deploy modes. For debug, I want to have configuration for my local machine, but for release I want to have configuration as for remote server.

    Before this changes, I had the Property group with custom variable:

     <PropertyGroup>
        <Var1>..\</Var1>
     </PropertyGroup>

    and that variable had been successfully used as physical path for my iis web services configuration for deploying.

    But then I changed that configuration to have ability to configure different web services paths on my local(for Debug mode) and remote(for Release mode) machines.

    I tried several ways:

    1. I appended the conditions for root of property group:

      <PropertyGroup Condition="'$(Configuration)' == 'Debug'">
        <Var1>..\..\..\</Var1>
      </PropertyGroup>
      <PropertyGroup Condition="'$(Configuration)' == 'Release'">
        <Var1>..\</Var1>
      </PropertyGroup>

    2. Also, I tried to append the conditions to inner nodes:

      <PropertyGroup >
        <Var1 Condition="'$(Configuration)' == 'Debug'">..\..\..\</Var1>
        <Var1 Condition="'$(Configuration)' == 'Release'">..\</Var1>
      </PropertyGroup>

    Both of that ways work strangely.
    For example, I saw the variable value in the end of msi.exe name when I added my $(Var1) variable as ending to msiname.

    But when I used that variable as part of iis services(code are below) configuration, I didn't get value of variable during deployment, because  I saw empty text in build log (there is only Service1.svc without ..\ for release mode) by unrecognized reason.

        <VDirList Include="*">
          <Vdir>Service1</Vdir>
          <Physdir>$(Var1)Service1</Physdir>
          <AppPool>$(WcfAppPoolName)</AppPool>
          <AppPoolNetVersion>$(WcfAppPoolVersion)</AppPoolNetVersion>
        </VDirList>

    Has anybody faced with it or have ideas?

    Thanks.





    • Edited by Denis99 Tuesday, July 11, 2017 12:10 PM
    Monday, July 10, 2017 4:54 PM

Answers

  • I found out solution.

    My problem was in the $(Configuration) variable. I tried to deploy my application on remote server side, and on that side that variable has "Server" value, despite the fact that I built solution with 'release' mode. Because I didn't define my variable for that platform, I didn't see value from her on remote server.

    I changed my project file like this:

      <Choose>
        <When Condition="'$(Configuration)' == 'Server'">
          <PropertyGroup>
            <Var1>..\</Var1>
          </PropertyGroup>
        </When>
    
        <Otherwise>
          <!-- Default -->
          <PropertyGroup>
            <Var1>..\..\</Var1>
          </PropertyGroup>
        </Otherwise>
      </Choose>
    Thanks.

    • Marked as answer by Denis99 Sunday, July 16, 2017 6:33 PM
    Sunday, July 16, 2017 6:33 PM