Hi John,
Sorry for the misunderstanding. What my MSBuild files do is pull in
Microsoft.TeamFoundation.Build.ProcessComponents.dll, which has a bunch of
MSBuild tasks in it. The key task is GetBuildProperties where you can have it
set a few properties through OutProperty elements. Here's the relevant code:
<!-- Pull in the VS 2010 version of the TFS build components only if doing a
full
TFS Build.-->
<UsingTask TaskName="Microsoft.TeamFoundation.Build.Tasks.GetBuildProperties"
AssemblyFile="$(TeamBuildRefPath)\Microsoft.TeamFoundation.Build.ProcessComponents.dll"
Condition="'$(WintellectBuildType)'=='TFSBUILD'"/>
<!-- The one target needed from TFS Build to pull out the build information.
-->
<Target Name="WintellectInitializeBuildProperties"
Condition="'$(WintellectBuildType)'=='TFSBUILD'">
<GetBuildProperties TeamFoundationServerUrl="$(TeamFoundationServerUrl)"
BuildUri="$(BuildUri)"
Condition=" '$(IsDesktopBuild)' != 'true' ">
<!-- I only need these two values so that's all I'll ask about. -->
<Output TaskParameter="BuildDefinitionName"
PropertyName="BuildDefinitionName" />
<Output TaskParameter="BuildNumber" PropertyName="BuildNumber" />
</GetBuildProperties>
<Message Importance="high" Text="Hello : BuildUri=$(BuildUri)"/>
</Target>
You can see all of this in action with the Wintellect.TFSBuildNumber.targets
file in the samples I mentioned below.
Dallas isn't that far away from Austin. Anyway, you needed to get out of the
office for a few days anyway. :D
Hope it helps!
John
Wintellect
http://www.wintellect.com
+1-877-968-5528
-----Original Message-----
From: John Bergman [mailto:[email protected]]
Sent: Friday, September 23, 2011 9:58 PM
To: John Robbins; General discussion for Windows Installer XML toolset.
Subject: RE: [WiX-users] Best way to invoke Wix from a TFS build workflow?
No, what I was asking was how do you get the build number out of the TFS build
server into the files?
You guys need to bring Devscovery to Dallas/Ft. Worth...
-----Original Message-----
From: John Robbins [mailto:[email protected]]
Sent: Friday, September 23, 2011 4:46 PM
To: General discussion for Windows Installer XML toolset.; John Bergman
Subject: RE: [WiX-users] Best way to invoke Wix from a TFS build workflow?
Hi John (Bergman :) )
As I mentioned all my build number stuff is part of your normal C#/VB/C++
.CS/VB/VCXPROJ files. Once you've edited your project files to create the
version numbers targets (see the example I included), you'll just tell TFS
Build to build your solution and the build numbers are automatically created.
Is that what you were asking?
John
Wintellect
http://www.wintellect.com
+1-877-968-5528
-----Original Message-----
From: John Bergman [mailto:[email protected]]
Sent: Friday, September 23, 2011 10:16 AM
To: General discussion for Windows Installer XML toolset.;
[email protected]
Subject: Re: [WiX-users] Best way to invoke Wix from a TFS build workflow?
John (Robbins),
Hey John, I don't see how the MSBuild items get invoked from a TFS
Workflow-based build based on the information in your blog; How do you connect
the two together?
For others... John's blog has a link to Jim Lamb's article about how to
create a custom WorkFlow activity
(http://blogs.msdn.com/b/jimlamb/archive/2010/02/12/how-to-create-a-custom-workflow-activity-for-tfs-build-2010.aspx).
John
-----Original Message-----
From: John Robbins [mailto:[email protected]]
Sent: Thursday, September 22, 2011 9:01 PM
To: General discussion for Windows Installer XML toolset.;
[email protected]
Subject: Re: [WiX-users] Best way to invoke Wix from a TFS build workflow?
Hi,
Just to throw out an alternative way of getting the TFS build number into you
version data here's how I did it:
http://www.wintellect.com/cs/blogs/jrobbins/archive/2009/11/09/tfs-2010-build-number-and-assembly-file-versions-completely-in-sync-with-only-msbuild-4-0.aspx
http://www.wintellect.com/CS/blogs/jrobbins/archive/2011/09/05/tfs-2010-build-numbers-file-versions-from-inside-your-c-and-c-projects.aspx
http://www.wintellect.com/CS/blogs/jrobbins/archive/2011/09/11/more-on-tfs-2010-build-numbers-inside-your-projects.aspx
John Bergman's way is excellent but mine goes right into the project file so it
doesn't require a custom TFS Build action in the workflow.
John
Wintellect
http://www.wintellect.com
+1-877-968-5528
-----Original Message-----
From: John Bergman [mailto:[email protected]]
Sent: Thursday, September 22, 2011 5:34 PM
To: General discussion for Windows Installer XML toolset.;
[email protected]
Subject: Re: [WiX-users] Best way to invoke Wix from a TFS build workflow?
I created a custom Activity that created a Wix Include file. I had it just
write the file new each time. The contents of our file looks like this
<?xml version="1.0" encoding="utf-8"?>
<!-- Note that this file will be overridden by the build server. --> <Include>
<?define MajorVersion = "1" ?>
<?define MinorVersion = "62" ?>
<?define BuildNumber = "112" ?>
<?define Revision = "1083" ?>
<?define FullVersion = "1.62.112.1083" ?>
<!--WiX Installer Versions are Major.Minor.Revision --> </Include>
Then I just included it in all the wix markup to use it. Its pretty straight
forward. I probably wrote more to the file than I needed, but I didn't want to
have to revisit getting the custom activity to work.
Once you create the activity, you need to update your build agents to pull the
assembly from source control, I placed it into
$/root/BuildProcessTemplates/CustomActivities.
Using the code activity, you can update the build process template to hook up
the two properties (VersionInfoFileName and VersionNumber). I actually use the
same technique to write an assemblyinfo file that has the version information
in it as well. In my case, I don't check it in and out each time, because the
build regenerates it... you could easily do that by adding a invokeprocess
activity before/after the UpdateWixVersion activity (remember to use the
**NO_CI** Magic so you don't get caught in a continuous loop building...
The source for the code activity looks like this:
[BuildActivity(HostEnvironmentOption.All)]
public sealed class UpdateWixVersion : CodeActivity
{
/// <summary>
/// Defines the file mask of all of the files for which the build number of
the assembly version must be updated
/// </summary>
[RequiredArgument]
public InArgument<string> VersionInfoFileName { get; set; }
/// <summary>
/// Defines (uses) the VersionNumber as initialized in the build process
template.
/// </summary>
[RequiredArgument]
public InArgument<string> VersionNumber { get; set; }
/// <summary>
/// Execute the Update Version Number build step.
/// </summary>
/// <param name="context">Contains the workflow context</param>
protected override void Execute(CodeActivityContext context)
{
//-- Get the input parameters
string strVersionInfoFileName =
context.GetValue(this.VersionInfoFileName);
string strVersionNumber = context.GetValue(this.VersionNumber);
Version verCurrentVersionInfo = new Version(strVersionNumber);
//-- Generate the text...
StringBuilder sb = new StringBuilder();
sb.AppendLine("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
sb.AppendLine("<!-- Note that this file will be overridden by the build
server. -->");
sb.AppendLine("<Include>");
sb.AppendLine(string.Format(" <?define MajorVersion = \"{0}\" ?>",
verCurrentVersionInfo.Major));
sb.AppendLine(string.Format(" <?define MinorVersion = \"{0}\" ?>",
verCurrentVersionInfo.Minor));
sb.AppendLine(string.Format(" <?define BuildNumber = \"{0}\" ?>",
verCurrentVersionInfo.Build));
sb.AppendLine(string.Format(" <?define Revision = \"{0}\" ?>",
verCurrentVersionInfo.Revision));
sb.AppendLine(string.Format(" <?define FullVersion = \"{0}\" ?>",
strVersionNumber));
sb.AppendLine(" <!--WiX Installer Versions are Major.Minor.Revision
-->");
sb.AppendLine("</Include>");
//-- Save the file text...
if (File.Exists(strVersionInfoFileName))
{ //-- ensure that the file is writeable
FileAttributes fileAttributes =
File.GetAttributes(strVersionInfoFileName);
File.SetAttributes(strVersionInfoFileName, fileAttributes &
~FileAttributes.ReadOnly);
File.WriteAllText(strVersionInfoFileName, sb.ToString());
//-- restore the file's original attributes
File.SetAttributes(strVersionInfoFileName, fileAttributes);
}
else
{
throw new Exception(string.Format("UpdateWixVersion: {0} does not
exist.", VersionInfoFileName));
}
}
}
Hope it helps,
John
-----Original Message-----
From: David Rickard (USA) [mailto:[email protected]]
Sent: Thursday, September 22, 2011 4:54 PM
To: [email protected]; General discussion for Windows Installer
XML toolset.
Subject: Re: [WiX-users] Best way to invoke Wix from a TFS build workflow?
Again, thanks for all the tips.
I'm setting my .wixproj project up now and have gotten to the point where I
need to pass the version number from the TFS build in. You said it "takes a
little bit more work": how did you end up doing that?
-----Original Message-----
From: Christopher Painter [mailto:[email protected]]
Sent: Tuesday, September 20, 2011 4:09 PM
To: General discussion for Windows Installer XML toolset.;
[email protected]
Subject: Re: [WiX-users] Best way to invoke Wix from a TFS build workflow?
The simplest way is to use Votive to generate a .SLN / .WIXPROJ and then add
the sln configuration | platform to to the build parameters in the build
definition. You shouldn't have to do any customizations in workflow
as the Default Template will work out of the box. Passing a
ProductVersion property takes a little bit more work on the msbuild side (
build parameters and preprocessor definitions in the wixproj and wixs ) but it
doesn't require any workflow changes.
----------------------------------------
From: "David Rickard (USA)" <[email protected]>
Sent: Tuesday, September 20, 2011 5:11 PM
To: "[email protected]" <[email protected]>
Subject: [WiX-users] Best way to invoke Wix from a TFS build workflow?
I need to build some MSIs with Wix during our TFS build. Our current TFS build
is using the Windows Workflow XAML files to declare the build logic.
What's the best way to invoke Wix from there? Directly invoking the process
from an activity? Going down to a powershell script and calling it from there?
Are there any custom Wix activities to use?
----------------------------------------------------------------------------
--
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
WiX-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wix-users
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security threats,
fraudulent activity and more. Splunk takes this data and makes sense of it.
Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
WiX-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wix-users
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security threats,
fraudulent activity and more. Splunk takes this data and makes sense of it.
Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
WiX-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wix-users
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes sense
of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
_______________________________________________
WiX-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wix-users
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes sense
of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
_______________________________________________
WiX-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wix-users
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes sense
of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
_______________________________________________
WiX-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wix-users
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
_______________________________________________
WiX-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wix-users