【问题标题】:About Team Build and building Web Sites, custom code activity problem关于Team Build和建站、自定义代码活动问题
【发布时间】:2011-05-12 18:13:05
【问题描述】:

我正在尝试使用 Team Build 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());
    }

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

【问题讨论】:

  • 我在 aspnet_compiler 上使用 invokeprocess 时遇到了同样的问题。除了 aspnet_compiler 之外,我可以使用 invokeprocess 进行任何工作。这很奇怪。

标签: msbuild web build tfsbuild


【解决方案1】:

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

此外,如果您需要将此文件夹复制/移动到另一个地方,或者即使您需要对其他文件/文件夹执行此操作,您也可以使用CopyDirectoryDeleteDirectory 和其他 Team Foundation Build 活动。如果您在构建过程中仍然需要运行某些东西,您可以使用InvokeProcess 构建活动,而不是创建自己的构建活动。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-01-20
    • 2012-07-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多