简体   繁体   English

如何实现TFS InvokeProcess以在其他凭据下运行

[英]How to Implement TFS InvokeProcess to run under other credentials

I'm using TFS (VS 2010) Build Definitions and XAMLs to build apps to different environments. 我正在使用TFS(VS 2010)生成定义和XAML来将应用程序生成到不同的环境。 Now, we need to push these builds to Production servers which require different credentials than what the Build Controller has. 现在,我们需要将这些构建推送到生产服务器,这些服务器所需的凭据与构建控制器所需的凭据不同。

I have been working on implementing the steps found at " Customize Team Build 2010 – Part 9: Impersonate activities (run under other credentials) " from http://www.ewaldhofman.nl/post/2010/05/28/Customize-Team-Build-2010-e28093-Part-9-Impersonate-activities-(run-under-other-credentials).aspx but I cannot figure out how to use the credentials within the XAML file. 我一直在努力执行http://www.ewaldhofman.nl/post/2010/05/28/Customize-Team的自定义团队构建2010 –第9部分:模拟活动(在其他凭据下运行) ”中的步骤。 -Build-2010-e28093-Part-9-模拟活动((在其他凭据下运行).aspx),但我无法弄清楚如何在XAML文件中使用凭据。

So, I have implemented the provided solution, and have made build definitions require the credentials, but how do I implement the credentials code (which appears to be in C#) into the XAML (which is XML)? 因此,我已经实现了所提供的解决方案,并已使构建定义要求凭据,但是如何将凭据代码(似乎在C#中)实现到XAML(XML)中呢?

Thanks, Stephanie 谢谢斯蒂芬妮

I have solved my issue here. 我已经在这里解决了我的问题。 I wasn't aware that the activities were coded in C#, although organized through the XML. 我不知道这些活动是用C#编码的,尽管是通过XML进行组织的。

You can use a TryCatch activity to wrap the impersonation object and dispose it in the Finally. 您可以使用TryCatch活动包装模拟对象并将其放置在Final中。

The XAML should look like: XAML应该看起来像:

            <TryCatch>
              <TryCatch.Variables>
                <Variable x:TypeArguments="bl:Impersonation" Name="Impersonation" />
              </TryCatch.Variables>
              <TryCatch.Try>
                <Sequence>
                  <mtbwa:WriteBuildMessage Message="Impersonating..." />
                  <ba:CreateImpersonationContext Credentials="[Credentials]" Result="[Impersonation]" />
                  <!-- Your activities go here -->
                </Sequence>
              </TryCatch.Try>
              <TryCatch.Finally>
                <Sequence>
                  <ba:DisposeImpersonationContext Impersonation="[Impersonation]" />
                  <mtbwa:WriteBuildMessage Message="Done with impersonation!" />
                </Sequence>
              </TryCatch.Finally>
            </TryCatch>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 TFS2010 工作流活动“InvokeProcess”:如何在代理上显示流程而不是在后台运行? - TFS2010 workflow activity "InvokeProcess": How to display the process on the agent instead of running it in background? TFS 2010构建-使用invokeprocess引用构建路径 - TFS 2010 build - Reference build path using invokeprocess 如何在TFS控制下从项目中删除空文件夹? - How to remove a empty folder from a project under TFS control? 如何在TFS下的Release模式下禁用单元测试 - How to disable unit tests in Release mode under TFS 在Visual Studio 2010下运行DefaultTarget以外的项目配置 - Run other than the DefaultTarget for a project configuration under Visual Studio 2010 ToolBox中缺少InvokeProcess? - InvokeProcess missing from the ToolBox? 如何从其他TFS 2010构建脚本执行一个TFS 2010构建脚本 - How to execute one TFS 2010 build script from other TFS 2010 build script 如何使用TFS2010与其他开发人员共享引用的程序集 - How to share referenced assemblies with other developers using TFS2010 如何从VS2010中的后生成脚本覆盖TFS下的签入文件? - How to overwrite checked in files under TFS from a post-build script in VS2010? 如何在TFS团队项目中的新文件夹下移动文件夹? - How do I move a folder under a new folder in a TFS Team Project?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM