Thank you William.  With this, how do I call "SetupWebEncryption" X number
of times (or by however many items I have in my ItemGroup)?

Thanks,
Oscar

On Sun, May 9, 2010 at 11:36 PM, William Bartholomew <
[email protected]> wrote:

>  The problem is that MSBuild will only execute a specific target once so
> the SetupWebEncryption target will only execute once regardless of how many
> times it is called. You should use item groups and batching to achieve what
> you want. Using an item group something like this:
>
>
>
> <ItemGroup>
>
>                 <ConfigToEncrypt
> Include=”$(WebProject)\_PublishedWebsites\CredentialsManagerService”>
>
>
> <ProviderName>CredentialsManagerService2RSACustomProvider</ProviderName>
>
>
> <ContainerName>CredentialsManagerService2RSAWebServerKeyContainer</ContainerName>
>
>                 </ConfigToEncrypt>
>
> <ConfigToEncrypt
> Include=”$(WebProject)\_PublishedWebsites\FeesServiceHost”>
>
>
> <ProviderName>FeesServiceHost2RSACustomProvider</ProviderName>
>
>
> <ContainerName>FeesServiceHost2RSAWebServerKeyContainer</ContainerName>
>
> </ConfigToEncrypt>
>
> </ItemGroup>
>
>
>
> *From:* [email protected] [mailto:[email protected]] *On
> Behalf Of *Oscar Bautista
> *Sent:* Sunday, May 09, 2010 7:40 PM
> *To:* ozTFS
> *Subject:* Re: All Targets Not Being Called (nested Targets not being
> executed)
>
>
>
> Okay you asked for it.....Thanks for willing to help me.  I have also
> included the code in the attached text file.  It may be easier to follow in
> a flat file.
>
>
>
> Essentially, what I am trying to do is encrypt web.config files, create key
> container on TFS, and deploy the key container to the destination server
> (i.e. QA, PROD, etc.), and install them on the destination server.  I
> am using PSEXEC to run commands remotely from TFS.  All of this works as
> expected when the first TARGET CALL executes
> (EncryptCredentialsManagerService).  The problem I am having is that the
> other 5 are not being executed
> (EncryptFeesServiceHost, EncryptInstrumentationHost, EncryptLogbookService,
> EncryptMessageBrokerService, EncryptSecurityTokenServiceHost)
>
>
>
> Please let me know if you need clarification while attempting to understand
> my code.
>
>
>
> Thanks,
>
> Oscar
>
>
>
>
> ---------------------------------------------------------------------------------------------------------------------------------------------
>
>
>
> *<!-- THIS TARGET IS IN TEST1.TARGET -->*
> <Target Name="SetupVendorWebServer" Inputs="%(WebServers.Identity)"
> Outputs="TempVar5" DependsOnTargets="SetupVendorWebServerConfigs">
>     <CreateProperty Value="%(WebServers.Identity)">
>       <Output TaskParameter="Value" PropertyName="WebServerIdentity"/>
>     </CreateProperty>
>  <CreateItem
> Include="$(DropLocation)\$(BuildNumber)\%(ConfigurationToBuild.FlavorToBuild)\$(WebProject)\Runtime\**">
>   <Output TaskParameter="Include" ItemName="Runtime"/>
>  </CreateItem>
>  <Copy SourceFiles="@(Runtime)"
> DestinationFiles="@(Runtime->'\\$(WebServerIdentity)\$(WebServerShare)\FeesServiceHost\bin\Runtime\%(Filename)%(Extension)')"
> />
>     *<!-- THIS NEXT CALL IS CALLING A TARGET THAT RESIDES IN A DIFFERENT
> .TARGET FILE (i.e. TEST2.TARGET) -->**
> *    <CallTarget Targets="SetupWebEncryptionForDish"
> ContinueOnError="false" />
>  </Target>
>
> *<!-- TEST2.TARGET FILE -->**
> <!-- NOTE, THE 6 CALLS BASICALLY CALL TARGETS THE DO THE SAME THING. THE
> IMPORTANT PART IS THE CALL TO SetUpWebEncryption TARGET -->
> <!-- SetUpWebEncryption IS SHOWN AT THE BOTTOM -->
> *  <Target Name="SetupWebEncryptionForDish">
>     <CallTarget Targets="EncryptCredentialsManagerService"
> ContinueOnError="false" />
>     <CallTarget Targets="EncryptFeesServiceHost" ContinueOnError="false" />
>     <CallTarget Targets="EncryptInstrumentationHost"
> ContinueOnError="false" />
>     <CallTarget Targets="EncryptLogbookService" ContinueOnError="false" />
>     <CallTarget Targets="EncryptMessageBrokerService"
> ContinueOnError="false" />
>     <CallTarget Targets="EncryptSecurityTokenServiceHost"
> ContinueOnError="false" />
>   </Target>
>
>   <!-- Encrypt CredentialsManagerService -->
>   <Target Name="EncryptCredentialsManagerService">
>     <CallTarget Targets="CredentialsManagerServiceLocation"
> ContinueOnError="false" />
>     <CallTarget Targets="SetupWebEncryption"
> Condition="'$(EncryptConfigs)'=='true'" ContinueOnError="false" />
>   </Target>
>
>   <Target Name="CredentialsManagerServiceLocation">
>     <CreateProperty
> Value="$(WebProject)\_PublishedWebsites\CredentialsManagerService">
>       <Output TaskParameter="Value"
> PropertyName="AnythingPastFlavorToBuild"/>
>     </CreateProperty>
>     <CreateProperty Value="CredentialsManagerService2RSACustomProvider">
>       <Output TaskParameter="Value"
> PropertyName="WebSiteRSACustomProviderName"/>
>     </CreateProperty>
>     <CreateProperty
> Value="CredentialsManagerService2RSAWebServerKeyContainer">
>       <Output TaskParameter="Value"
> PropertyName="RSAWebServerKeyContainerName"/>
>     </CreateProperty>
>   </Target>
>
>   <!-- Encrypt FeesServiceHost -->
>   <Target Name="EncryptFeesServiceHost"
> DependsOnTargets="EncryptCredentialsManagerService">
>     <CallTarget Targets="FeesServiceHostLocation" ContinueOnError="false"
> />
>     <CallTarget Targets="SetupWebEncryption"
> Condition="'$(EncryptConfigs)'=='true'" ContinueOnError="false" />
>   </Target>
>
>   <Target Name="FeesServiceHostLocation">
>     <CreateProperty
> Value="$(WebProject)\_PublishedWebsites\FeesServiceHost">
>       <Output TaskParameter="Value"
> PropertyName="AnythingPastFlavorToBuild"/>
>     </CreateProperty>
>     <CreateProperty Value="FeesServiceHost2RSACustomProvider">
>       <Output TaskParameter="Value"
> PropertyName="WebSiteRSACustomProviderName"/>
>     </CreateProperty>
>     <CreateProperty Value="FeesServiceHost2RSAWebServerKeyContainer">
>       <Output TaskParameter="Value"
> PropertyName="RSAWebServerKeyContainerName"/>
>     </CreateProperty>
>   </Target>
>
>   <!-- Encrypt InstrumentationHost -->
>   <Target Name="EncryptInstrumentationHost"
> DependsOnTargets="EncryptFeesServiceHost">
>     <CallTarget Targets="InstrumentationHostLocation"
> ContinueOnError="false" />
>     <CallTarget Targets="SetupWebEncryption"
> Condition="'$(EncryptConfigs)'=='true'" ContinueOnError="false" />
>   </Target>
>
>   <Target Name="InstrumentationHostLocation">
>     <CreateProperty
> Value="$(WebProject)\_PublishedWebsites\InstrumentationHost">
>       <Output TaskParameter="Value"
> PropertyName="AnythingPastFlavorToBuild"/>
>     </CreateProperty>
>     <CreateProperty Value="InstrumentationHost2RSACustomProvider">
>       <Output TaskParameter="Value"
> PropertyName="WebSiteRSACustomProviderName"/>
>     </CreateProperty>
>     <CreateProperty Value="InstrumentationHost2RSAWebServerKeyContainer">
>       <Output TaskParameter="Value"
> PropertyName="RSAWebServerKeyContainerName"/>
>     </CreateProperty>
>   </Target>
>
>   <!-- Encrypt LogbookService -->
>   <Target Name="EncryptLogbookService"
> DependsOnTargets="EncryptInstrumentationHost">
>     <CallTarget Targets="LogbookServiceLocation" ContinueOnError="false" />
>     <CallTarget Targets="SetupWebEncryption"
> Condition="'$(EncryptConfigs)'=='true'" ContinueOnError="false" />
>   </Target>
>
>   <Target Name="LogbookServiceLocation">
>     <CreateProperty
> Value="$(WebProject)\_PublishedWebsites\LogbookService">
>       <Output TaskParameter="Value"
> PropertyName="AnythingPastFlavorToBuild"/>
>     </CreateProperty>
>     <CreateProperty Value="LogbookService2RSACustomProvider">
>       <Output TaskParameter="Value"
> PropertyName="WebSiteRSACustomProviderName"/>
>     </CreateProperty>
>     <CreateProperty Value="LogbookService2RSAWebServerKeyContainer">
>       <Output TaskParameter="Value"
> PropertyName="RSAWebServerKeyContainerName"/>
>     </CreateProperty>
>   </Target>
>
>   <!-- Encrypt MessageBrokerService -->
>   <Target Name="EncryptMessageBrokerService"
> DependsOnTargets="EncryptLogbookService">
>     <CallTarget Targets="MessageBrokerServiceLocation"
> ContinueOnError="false" />
>     <CallTarget Targets="SetupWebEncryption"
> Condition="'$(EncryptConfigs)'=='true'" ContinueOnError="false" />
>   </Target>
>
>   <Target Name="MessageBrokerServiceLocation">
>     <CreateProperty
> Value="$(WebProject)\_PublishedWebsites\MessageBrokerService">
>       <Output TaskParameter="Value"
> PropertyName="AnythingPastFlavorToBuild"/>
>     </CreateProperty>
>     <CreateProperty Value="MessageBrokerService2RSACustomProvider">
>       <Output TaskParameter="Value"
> PropertyName="WebSiteRSACustomProviderName"/>
>     </CreateProperty>
>     <CreateProperty Value="MessageBrokerService2RSAWebServerKeyContainer">
>       <Output TaskParameter="Value"
> PropertyName="RSAWebServerKeyContainerName"/>
>     </CreateProperty>
>   </Target>
>
>   <!-- Encrypt SecurityTokenServiceHost -->
>   <Target Name="EncryptSecurityTokenServiceHost"
> DependsOnTargets="EncryptMessageBrokerService">
>     <CallTarget Targets="SecurityTokenServiceHostLocation"
> ContinueOnError="false" />
>     <CallTarget Targets="SetupWebEncryption"
> Condition="'$(EncryptConfigs)'=='true'" ContinueOnError="false" />
>   </Target>
>
>   <Target Name="SecurityTokenServiceHostLocation">
>     <CreateProperty
> Value="$(WebProject)\_PublishedWebsites\SecurityTokenServiceHost">
>       <Output TaskParameter="Value"
> PropertyName="AnythingPastFlavorToBuild"/>
>     </CreateProperty>
>     <CreateProperty Value="SecurityTokenServiceHost2RSACustomProvider">
>       <Output TaskParameter="Value"
> PropertyName="WebSiteRSACustomProviderName"/>
>     </CreateProperty>
>     <CreateProperty
> Value="SecurityTokenServiceHost2RSAWebServerKeyContainer">
>       <Output TaskParameter="Value"
> PropertyName="RSAWebServerKeyContainerName"/>
>     </CreateProperty>
>   </Target>
>
> *<!-- THESE NEXT TARGETS BASICALLY DELETE A KEYCONTAINER ON TFS IF THE
> FLAG IN THE RSP FILE IS SET TO TRUE,  -->**
> <!-- CREATE A KEYCONTAINER ON TFS, ENCRYPT APPSETTINGS AND
> CONNECTIONSSTRING SECTIONS IN WEB.CONFIG, -->
> <!-- AND EXPORT THE KEY TO THE DESTINATION SERVERS (e.g. QA) -->
> <!-- ALL OF THIS WORKS PERFECTLY.  THE PROBLEMS IS THAT ONLY THE FIRST
> CALLTARGET (i.e. EncryptCredentialsManagerService) -->
> <!-- IN THE SetupWebEncryptionForDish IS BEING EXECUTED. THE REMAINING FIVE
> ARENT BEING EXECUTED. -->
> <!-- THE 6 TARGETS CALLS ARE FOR 6 DIFFERENT APPLICATIONS. -->*
> <Target Name="SetupWebEncryption">
>     <!-- Call Target to make Property globally available -->
>     <CallTarget Targets="CreateFlavorToBuildDirectoryName"
> ContinueOnError="false" />
>     <!-- Encrypt RSA WebServer Key Container on Web Server -->
>     <CallTarget Targets="EncryptWebServerConfigs" ContinueOnError="false"
> />
>     <!-- Delete RSA WebServer Key Container on Web Server -->
>     <CallTarget Targets="DeleteRSAWebServerKeyContainerOnWebServer"
> Condition="'$(DeleteKeyContainerOnTargetServer)'=='true'"
> ContinueOnError="false" />
>   </Target>
>
>   <Target Name="CreateFlavorToBuildDirectoryName">
>     <CreateProperty Value="%(ConfigurationToBuild.FlavorToBuild)">
>       <Output TaskParameter="Value"
> PropertyName="CreateFlavorToBuildDirectoryName" />
>     </CreateProperty>
>   </Target>
>
>   <!-- Encrypt WebServer Configs -->
>   <Target Name="EncryptWebServerConfigs">
>     <CallTarget Targets="DeleteRSAWebServerKeyContainerOnTFS"
> Condition="'$(DeleteKeyContainerOnTFS)'=='true'" ContinueOnError="false"
> />
>     <CallTarget Targets="CreateRSAWebServerKeyContainerOnTFS"
> Condition="'$(CreateKeyContainerOnTFS)'=='true'" ContinueOnError="false" />
>     <CallTarget Targets="EncryptWebServerWebConfigSections"
> ContinueOnError="false" />
>     <CallTarget Targets="ExportRSAWebServerKeyContainer"
> ContinueOnError="false" />
>   </Target>
>
>   <!-- Delete RSA WebServer Key Container on TFS -->
>   <Target Name="DeleteRSAWebServerKeyContainerOnTFS">
>     <Message Text="Deleting RSA WebServer Key Container on TFS :
> $(RSAWebServerKeyContainerName)" />
>     <Exec Command="$(AspNetRegIis) -pz
> &quot;$(RSAWebServerKeyContainerName)&quot;"/>
>   </Target>
>
>   <!-- Create RSA WebServer Key Container -->
>   <Target Name="CreateRSAWebServerKeyContainerOnTFS">
>     <Message Text="Creating RSA WebServer Key Container on TFS :
> $(RSAWebServerKeyContainerName)" />
>     <Exec Command="$(AspNetRegIis) -pc
> &quot;$(RSAWebServerKeyContainerName)&quot; -exp"/>
>   </Target>
>
>   <!-- Encrypt WebServer WebConfig Sections -->
>   <Target Name="EncryptWebServerWebConfigSections">
>     <Message Text="Encrypting WebServer %(SectionsToEncrypt.Section)" />
>
>     <Exec Command="$(AspNetRegIis) -pef
> &quot;%(SectionsToEncrypt.Section)&quot;
> &quot;$(DropLocation)\$(BuildNumber)\$(CreateFlavorToBuildDirectoryName)\$(AnythingPastFlavorToBuild)&quot;
> -prov &quot;$(WebSiteRSACustomProviderName)&quot;"/>
>   </Target>
>
>   <!-- Export RSA WebServer Key Container -->
>   <Target Name="ExportRSAWebServerKeyContainer">
>     <MakeDir
> Directories="$(DropLocation)\$(BuildNumber)\%(ConfigurationToBuild.FlavorToBuild)\$(AnythingPastFlavorToBuild)\KeyContainer\"
> />
>     <CreateProperty
> Value="$(DropLocation)\$(BuildNumber)\%(ConfigurationToBuild.FlavorToBuild)\$(AnythingPastFlavorToBuild)\KeyContainer\">
>       <Output TaskParameter="Value"
> PropertyName="RSAWebServerKeyContainerDir"/>
>     </CreateProperty>
>     <Message Text="Exporting RSA WebServer Key Container :
> $(RSAWebServerKeyContainerDir)keys.xml" />
>     <Exec Command="$(AspNetRegIis) -px
> &quot;$(RSAWebServerKeyContainerName)&quot;
> &quot;$(RSAWebServerKeyContainerDir)keys.xml&quot; -pri"/>
>   </Target>
>
> On Sun, May 9, 2010 at 9:09 PM, William Bartholomew <
> [email protected]> wrote:
>
> Hi Oscar,
>
>
>
> It might be easier to answer if we can see the projects, can you share
> them?
>
>
>
> Thanks,
>
> William
>
>
>
> *From:* [email protected] [mailto:[email protected]] *On
> Behalf Of *Oscar Bautista
> *Sent:* Sunday, May 09, 2010 11:50 AM
> *To:* [email protected]
> *Subject:* All Targets Not Being Called (nested Targets not being
> executed)
>
>
>
> I am using a two TARGET files.  On one TARGET file I call a TARGET that is
> inside the second TARGET file.  This second TARGET then calls another TARGET
> that has 6 other TARGET calls, which do a number of different things (in
> addition to calling other nested TARGETS (but inside the same TARGET
> file)).  The problem is that, on the TARGET where I call 6 TARGETS, only the
> first one is being executed.  The program doesnt find its way to call the
> 2nd, 3rd, 4th, 5th, and 6th TARGET.  Is there a limit to the number of
> nested TARGETS that can be called and run?  Nothing is failing.  The problem
> is the other TARGET calls are not running.  Thanks for any help you can
> provide.
>
> Oscar Bautista
>
>
> _______________________________________________
> oztfs mailing list
> [email protected]
> http://prdlxvm0001.codify.net/mailman/listinfo/oztfs
>
>
>
> _______________________________________________
> oztfs mailing list
> [email protected]
> http://prdlxvm0001.codify.net/mailman/listinfo/oztfs
>
>
_______________________________________________
oztfs mailing list
[email protected]
http://prdlxvm0001.codify.net/mailman/listinfo/oztfs

Reply via email to