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: ,

No comments:

Post a Comment