Monday, April 20, 2015

Getting Your Precompiled Web Site to the TFS Build Drop Location

I have been working on precompiling a .NET web application so that our security vulnerability company could scan it for issues.  The dev team said that the precompiled web app could also be deployed to production.  With that said I have been working on replacing the existing build process with one using the precompiled version.

After some searching this was the best solution I could find to get it to precompile on my build machine.  I created a new publish profile that looked pretty much like the example and setup the MSBuild parameters in my build definition.  This worked great however when I looked in my network share where the build output is copied to it was missing.

Looking in the src location on the build machine I found the PublishDirectory where the precompiled site lived.  Since we specified $(MSBuildProjectDirectory) that is exactly where it placed the output.

Upon further research I tried this property and  it worked.  It is TF_BUILD_DROPLOCATION.  Other environment variables for TFS can be found here

The final publish profile then looks like this:

<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit
http://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="
http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <WebPublishMethod>FileSystem</WebPublishMethod>
    <LastUsedBuildConfiguration>Debug</LastUsedBuildConfiguration>
    <LastUsedPlatform>Any CPU</LastUsedPlatform>
    <SiteUrlToLaunchAfterPublish />
    <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
    <ExcludeApp_Data>False</ExcludeApp_Data>
    <publishUrl>$(TF_BUILD_DROPLOCATION)\PublishDirectory</publishUrl>
    <DeleteExistingFiles>True</DeleteExistingFiles>
    <PrecompileBeforePublish>True</PrecompileBeforePublish>
    <EnableUpdateable>False</EnableUpdateable>
    <DebugSymbols>False</DebugSymbols>
    <WDPMergeOption>DonotMerge</WDPMergeOption>
  </PropertyGroup>
</Project>

 

My next step is to only have that in the drop location and not everything else.

del.icio.us Tags: ,

Monday, April 13, 2015

Release Build Failed in Release Management

vswhitelogoI had recently setup a new stage in my deploy process.  It had yet to be tested and a developer checked in some code which triggered a build.  My team (devops) was promptly contacted with a generic failure message (from the person and system).  What had happened?
The build error as seen within Visual Studio was:
ERROR: The deployment for release template 'Prospect Connect' has not been completed successfully. Check the releases history for more details.
Exit: 1

This doesn’t give anyone much to go on.  Furthermore the following message was also included which didn’t help:
Exception Stack Trace:    at System.Activities.Statements.Throw.Execute(CodeActivityContext context)
   at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
   at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

Unfortunately as of 2013 Update 4 you cannot drill into the Release Manager error within Visual Studio.  My developers don’t have access to RM yet so it was up to me to see what had happened.
As it turns out the new stage I added was failing because the environment is in a different domain and it could not access the drop location.  What I wanted to change though is a way to generate good builds and green lights back to the team.  They only care about deploys to the first (dev) environment and not the next stage.
To accomplish that I removed the automation from the second stage.  I had only put it in place until the team could decide what their process was going to be.  For now I will send notification to the devops team to approve and deploy builds to the next stage.
My goal was accomplished because the system stops at that point and send back to TFS Build a successful deploy message for the first stage.
What other things in RM have you seen that return an Exit 1 back to TFS Build?