2010-11-19 68 views
1

我想使用团队构建2010发布网站,但我没有看到任何简单的选项。所以我试着创建一个自定义活动,用我的参数调用代理中的进程(“aspnet_compiler.exe”)并发布我的网站。关于团队构建和构建网站,自定义代码活动问题

我可以删除文件夹,创建文件夹,编译和构建项目...

但这个过程只是不上时,我把它叫做代理开始... ...这是什么问题?

protected override void Execute(CodeActivityContext context) 
    { 
     // Obtain the runtime value of the Text input argument 
     // string text = context.GetValue(this.Text); 
     Process proc = new Process(); 
     proc.EnableRaisingEvents = true; 
     proc.StartInfo.WorkingDirectory = @"C:\Windows\Microsoft.NET\Framework\v2.0.50727"; 
     proc.StartInfo.FileName = "aspnet_compiler.exe"; 
     proc.StartInfo.Arguments = "-p "+context.GetValue(this.SourcesDirectory) + 
       " -v/" + PublishDirectory; 
     proc.Start(); 
     proc.WaitForExit(); 

     while (!proc.HasExited) 
     { 
     } 

     context.SetValue(Result,proc.StandardOutput.ReadToEnd()); 
    } 

有没有其他的方式来建立/发布网站?我的代码有什么问题?

+0

我有使用aspnet_compiler上的invokeprocess相同的问题。除了aspnet_compiler之外,我可以得到任何可以使用invokeprocess的东西。真奇怪。 – Flores 2013-02-06 12:03:59

回答

1

每当TFS构建项目/解决方案时,它都会自动发布Web项目/站点并将它们放置在名为_PublishedWebsites的文件夹中。您可以轻松使用它。

此外,如果你需要复制/将此文件夹移动到另一个地方,或者即使你需要与其他文件/文件夹要做到这一点,你可以用CopyDirectoryDeleteDirectory和其他团队基础共建活动。如果您仍然需要在构建过程中运行某些内容,则可以使用InvokeProcess构建活动,而不是创建自己的构建活动。

相关问题