1

I'm trying to Publish a Web Site using Team Build 2010, but I didn't see any easy options out there. So I tried to create a custom activity which calls a process in the agent ("aspnet_compiler.exe") with my parameters and publish my site.

I can delete folders, create folders, compile and build projects...

But this process just doesn't start on the agent when I call it... what is the problem?

    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());
    }

Is there any other way to build/publish web sites? What's wrong with my code ?

Conrad Clark
  • 4,533
  • 5
  • 45
  • 70
  • I have the same problem using invokeprocess on aspnet_compiler. I can get anything to work with invokeprocess except the aspnet_compiler. It is weird. – Flores Feb 06 '13 at 12:03

1 Answers1

1

Every time TFS builds a project/solution, it automatically publishes web projects/sites and place them in a folder named _PublishedWebsites. You can easily use it.

Additionally if you need to copy/move this folder to another place or even if you need to do this with other file/folders, you can use CopyDirectory, DeleteDirectory and other Team Foundation Build Activities. If you still need to run something during build process, you can use InvokeProcess build activity instead of creating your own build activity.

Afshar Mohebi
  • 10,479
  • 17
  • 82
  • 126