none
Wix And TFS MSBuild

    Question

  •  

    Hi All,

     

    I have a team project which contains 1 windows application project 2. webapplication project 3. Class liberary preoject and have my TfsBuild.proj build type ready and working fine. it builds successfully.

     

    I want to include Wix project in my Team Project which can create a MSI Package after Above Build is Succesfull.

    when i add a simple wix project in my solution which includes other projects too. it gives me an error MSBuild does not support this type or project file to build. and fails after this error, This happenps if i run MY Build on my build server.

    But other wise if i Build a solution on my machine everything seems to build fine.  including Wix project.

    Any ideas why and wht i need to do in order to build this project on my build machine.?

     

    Second secondly i also want my wix project to include the files from other projects too. I dont know a way how can you mention a path to a source attribute in <file> element to it picks up the files from current project not hard coded like c:\test\file.extention this way it wont be dynamic.

     

    As i want make an MSI files including the all project files , If anybody knows any example available online or any guide how to make Wix project using MSbuild In TFS 2005 or 2008. please let me know

    Waiting for responce.

    Thanks

    Friday, August 01, 2008 5:44 PM

Answers

  • Bob,

     

    You need to make sure you have the WiX binaries installed on your build machine in order for this to work. I wrote a help topic on this very issue for the WiX documentation last week, that should be published sometime this weekend. In the mean time I've included it below for reference.

     

    With regards to the file references you can either use relative paths (..\..\file.extension), or you can add a reference to the application project to your WiX project then use variables to reference the file ($(var.MyProjectName.TargetDir)\FileName). For more information on how to use these variables see the "Project References" topic in the WiX documentation.

     

    Neil

     

    Integrating WiX Projects Into Daily Builds

     

    One of the most common reasons for using MSBuild with WiX project files is to integrate the build of an installer into an existing daily build process. This is often coupled with a need to build WiX projects without having to pre-install any WiX tools on the daily build machine. WiX projects and the WiX toolset to build them can be added to most daily build processes that support MSBuild using a few simple steps.

     

    Step 1: Check in the WiX Toolset

     

    To avoid having to install WiX on build machines you can check all the tools necessary to build WiX projects into your source code control system. Here's how:

    1. Install WiX on a developer machine using the standard WiX installer 
    2. Create a directory in your source code control system to hold the WiX tools 
    3. Copy the contents of c:\Program Files\Windows Installer XML v3\bin into the directory created in step 2 
    4. Copy the contents of c:\Program Files\MSBuild\Microsoft\WiX\v3.0 into the directory created in step 2 
    5. Add and check in the files from steps 3 and 4

    Step 2: Modify Your .wixproj File

     

    After checking the WiX tools into source code control the .wixproj file must be modified to point to the location of the checked in tools. Open the .wixproj file in any text editor, such as Visual Studio, and add the following to the file anywhere between the <Project> element before the <Import> element:

     

    <PropertyGroup>
            <WixToolPath>$(SourceCodeControlRoot)\wix\3.0.4311.0</WixToolPath>
            <WixTargetsPath>$(WixToolPath)\Wix.targets</WixTargetsPath>
            <WixTasksPath>$(WixToolPath)\wixtasks.dll</WixTasksPath>
    </PropertyGroup>

     

    The WixToolPath must be set to point to the location of the WiX tools directory created in Step 1. The method used to reference the location will vary depending on your build system, but it can either be a relative path to the directory (such as ..\..\tools), an MSBuild property that is set via an environment variable (such as $(BinariesRoot) in a Team Foundation Server build) or a custom property passed in on the command-line or via an environment variable.

     

    The WixTargetsPath and WixTasksPath properties direct MSBuild to use the WiX build process and WiX tasks from the tools directory.

     

    Saturday, August 02, 2008 2:44 PM

All replies

  • Bob,

     

    You need to make sure you have the WiX binaries installed on your build machine in order for this to work. I wrote a help topic on this very issue for the WiX documentation last week, that should be published sometime this weekend. In the mean time I've included it below for reference.

     

    With regards to the file references you can either use relative paths (..\..\file.extension), or you can add a reference to the application project to your WiX project then use variables to reference the file ($(var.MyProjectName.TargetDir)\FileName). For more information on how to use these variables see the "Project References" topic in the WiX documentation.

     

    Neil

     

    Integrating WiX Projects Into Daily Builds

     

    One of the most common reasons for using MSBuild with WiX project files is to integrate the build of an installer into an existing daily build process. This is often coupled with a need to build WiX projects without having to pre-install any WiX tools on the daily build machine. WiX projects and the WiX toolset to build them can be added to most daily build processes that support MSBuild using a few simple steps.

     

    Step 1: Check in the WiX Toolset

     

    To avoid having to install WiX on build machines you can check all the tools necessary to build WiX projects into your source code control system. Here's how:

    1. Install WiX on a developer machine using the standard WiX installer 
    2. Create a directory in your source code control system to hold the WiX tools 
    3. Copy the contents of c:\Program Files\Windows Installer XML v3\bin into the directory created in step 2 
    4. Copy the contents of c:\Program Files\MSBuild\Microsoft\WiX\v3.0 into the directory created in step 2 
    5. Add and check in the files from steps 3 and 4

    Step 2: Modify Your .wixproj File

     

    After checking the WiX tools into source code control the .wixproj file must be modified to point to the location of the checked in tools. Open the .wixproj file in any text editor, such as Visual Studio, and add the following to the file anywhere between the <Project> element before the <Import> element:

     

    <PropertyGroup>
            <WixToolPath>$(SourceCodeControlRoot)\wix\3.0.4311.0</WixToolPath>
            <WixTargetsPath>$(WixToolPath)\Wix.targets</WixTargetsPath>
            <WixTasksPath>$(WixToolPath)\wixtasks.dll</WixTasksPath>
    </PropertyGroup>

     

    The WixToolPath must be set to point to the location of the WiX tools directory created in Step 1. The method used to reference the location will vary depending on your build system, but it can either be a relative path to the directory (such as ..\..\tools), an MSBuild property that is set via an environment variable (such as $(BinariesRoot) in a Team Foundation Server build) or a custom property passed in on the command-line or via an environment variable.

     

    The WixTargetsPath and WixTasksPath properties direct MSBuild to use the WiX build process and WiX tasks from the tools directory.

     

    Saturday, August 02, 2008 2:44 PM
  • Hi thanks for your responce, But my .wixproj file contains the following contents:-

     

    <?xml version="1.0" encoding="utf-8" ?>
    <VisualStudioProject>
        <WindowsInstallerXML ProductVersion="2.0.5805.0"  ProjectGuid="{63494FBA-38AD-400A-BB37-83DDD68231C3}"

            SchemaVersion="1.0" >
            <BuildSettings  OutputName="Project"  OutputType="MSI"  />
            <Configurations>
                <Configuration Name="Debug"  RelativeOutputDirectory="bin\Debug"

                 RelativeIntermediateDirectory="obj\Debug" />
                <Configuration Name="Release" RelativeOutputDirectory="bin\Release"
                    RelativeIntermediateDirectory="obj\Release" />
            </Configurations>
            <WixlibReferences />
            <Files>
                <File  RelativePath="Product.wxs" />
            </Files>
        </WindowsInstallerXML>
    </VisualStudioProject>

     

    I dont see no Project Element, Did you meant to say to include the above propertygroup in TfsBuild.proj file.?

     

    Monday, August 04, 2008 2:11 AM
  • I have tried this out now I am getting the following error(below) when building on the dev machine.

    Error 3767 The "ReadRegistry" task could not be loaded from the assembly C:\WIP\VS2008\ActiveProjects\QSStudio\tools\wix\..\..\..\tools\wix\wixtasks.dll. Could not load file or assembly 'file:///C:\WIP\VS2008\ActiveProjects\tools\wix\wixtasks.dll' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, and that the assembly and all its dependencies are available. C:\WIP\VS2008\ActiveProjects\QSStudio\tools\wix\Wix.targets 348 6 QSPSInstaller
    Tuesday, October 14, 2008 5:01 PM
  • When defining the wixtool path, don't define it like this 

    <WixToolPath>..\..\..\tools\Wix</WixToolPath>

    Use a fixed location to start from, such as this 

    <WixToolPath>$(MSBuildProjectDirectory)\..\..\..\tools\Wix</WixToolPath>

    I'm guess this path is used in multiple locations and the relative path in the first case translates to a different folder when used from different locations.
    Friday, February 20, 2009 9:33 PM
  • Hi.

    I have followed your steps and it works alright :) Atleast the part where all paths are ok and the tfsbuild machine is able to build the solution and spits out an installer.

    But... In my solution where the wix project resides I have added banner and dialog bitmaps to the wixproj and a new eula, my own Wix variables that is.  It builds alright locally. But when the solutions gets built on the build server the extras (banner, eula aso) doesn't follow into light. Light consequently gets called with no variables except the default ones. It knows it should use the UI dll because the GUI is the same as when built locally, but the bitmaps and the eula aren't used.

    I'm using wix 3 and have a simple C# project and a simple wix project in the solution.

    We have also tried to install visual studio and wix on the build machine but still no luck.

    The main issue here as I see it is that tfsbuild doesnot call light with the correct variables. All the stuff is where it should be on disk.

    Could this be the result of that wix isn't inegrated enough with tfsbuild yet, or am I missing something else?

    I know this is a longshot in a almost year old discussion, but atleast it's not completely irrelevant.

    Best Regards/Torkel.
    Thursday, June 04, 2009 3:07 PM
  • This works when compiling from the command line using MSBuild but there is still an error when attempting to load the project up in the IDE when Wix is not installed. Is there also a IDE (Devenv?) friendly version of this variable that could be used? Thanks in advance.
    Thursday, June 03, 2010 8:41 PM
  • Hi,

    Although its a easy job to get Wix enabled in the VS IDE , by adding the XSD which would give you the luxury of itellisense for Wix an also.

    Alternatively , there is a tool , which i found very use full for WIX, can get here http://wixedit.sourceforge.net/.

     

     

     


    Thanks, Ranjith S
    • Proposed as answer by Ranjith S Saturday, June 12, 2010 5:59 PM
    Saturday, June 12, 2010 5:59 PM
  • Hi,

    I am trying to build the open source version of Trident 1.2 from Microsoft to generate an msi.

    According to the instruction for building the code, it required creation of public/ext folders in the Project's main folder and copying of contents  for wix versions 2 and 3 from Program files to public/ext/wix2 and public/ext/wix3 .

    After building the project files, I run the script to build from command line using this command (.\tools\build\smoke.cmd <product> <buildkind> <buildtype>).

     

    However this build fails with the following lines:

    VS100COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools
    \
    VS90COMNTOOLS=c:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\Tools\
    VSSDK90Install=C:\Program Files (x86)\Microsoft Visual Studio 2008 SDK\
    windir=C:\Windows
    WIX=C:\Program Files (x86)\Windows Installer XML v3\
    Invalid switch - "f".
    The system cannot find the path specified.
    *** BUILD FAILED ***

    Any help with the above error is appreciated.

     

    Thanks,

    Kavitha

     

    Thursday, July 29, 2010 6:23 PM
  • Hi Neil,

    I have a basic question. I have been doing builds with TFS team build. and i am aware of build definition which is an msbuild file. I am also aware of the variables that are used within the msbuild. My concern is i will be using wix as a deployment tool and i need to integrate wix into the build definition. From last 2 days i have been reading a lot of articles, but getting mad as to where to start.

    How would i get an installer built with a tfs build definition. I am pretty sure it does, but i am not able to make a start. Can you please provide me with an example or pointer of a wix project that would be deploying a binary which was build from the same build definition. I want to see how the skeleton looks like othwise looks like i am stuck.

    Thanks for the help.

    SSK

    Friday, October 22, 2010 7:46 AM
  • This is great! However, I am trying a little different approach.

    I have 150 projects in one TFS collection and want to only add the tool once, not on a per profect basis. How can I create a static reference to teh WiX toolset? And can be referenced by any .wixproj file no matter where it's location in the collection? 

    Something Like this

    <PropertyGroup>
            <WixToolPath>$([TFS SERVER])\WixToolsetProject\wix\3.5/WixToolPath>
            <WixTargetsPath>$(WixToolPath)\Wix.targets</WixTargetsPath>
            <WixTasksPath>$(WixToolPath)\wixtasks.dll</WixTasksPath>
    </PropertyGroup>

    Or

    <PropertyGroup>
            <WixToolPath>$([TFS Project])\wix\3.5/WixToolPath>
            <WixTargetsPath>$(WixToolPath)\Wix.targets</WixTargetsPath>
            <WixTasksPath>$(WixToolPath)\wixtasks.dll</WixTasksPath>
    </PropertyGroup>

    Thursday, June 09, 2011 12:25 PM
  • Hello All,

    I want WIX project to be get build & generate setup file(msi) with latest changes for every check-in perform on TFS build. I have already tried many online help, topics & references, still there is no luck.

    What changes should I make in TFSBuild.proj File &  .wixproj file

    my Current configuration of .wixproj file is

    <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
      <PropertyGroup>
        <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
        <Platform Condition=" '$(Platform)' == '' ">Any CPU</Platform>
        <ProductVersion>3.5</ProductVersion>
        <ProjectGuid>{8ae555a0-3f47-43dc-bd77-0202f7113deb}</ProjectGuid>
        <SchemaVersion>2.0</SchemaVersion>
        <OutputName Condition=" '$(OutputName)' =='' ">$(Configuration)MLM Client Installer</OutputName>
        <OutputType Condition=" '$(OutputType)' =='' ">Package</OutputType>
        <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' AND '$(MSBuildExtensionsPath32)' != '' ">$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
        <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
        <SccProjectName>SAK</SccProjectName>
        <SccProvider>SAK</SccProvider>
        <SccAuxPath>SAK</SccAuxPath>
        <SccLocalPath>SAK</SccLocalPath>
        <Name>Client Installer</Name>
        </PropertyGroup>

      <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|Any CPU' ">
        <OutputPath>bin\$(Configuration)\</OutputPath>
        <IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
        <DefineConstants>Debug</DefineConstants>
      </PropertyGroup>
     
      <ItemGroup>
          <Compile Include="Product.wxs" />
      </ItemGroup>
      <ItemGroup>
        <WixExtension Include="WixUIExtension">
          <HintPath>$(WixExtDir)\WixUIExtension.dll</HintPath>
          <Name>WixUIExtension</Name>
        </WixExtension>
      </ItemGroup>
      <ItemGroup>
        <Content Include="Lic.rtf" />
      </ItemGroup>
      <Import Project="$(WixTargetsPath)" />
      <!--
     To modify your build process, add your task inside one of the targets below and uncomment it.
     Other similar extension points exist, see Wix.targets.
     <Target Name="BeforeBuild">
     </Target>
     <Target Name="AfterBuild">
     </Target>
     -->
    </Project>

    -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

    What changes should I make in TFSBuild.proj File

     Thank You in Advance !!!

    Friday, August 12, 2011 12:05 PM
  • Amit,

    Would you please let me know if you had a solution for the issue you had reported of compiling Wix Projects throught Team Build's in TFS 2008 

    Regards,

    Abishek

    Thursday, August 23, 2012 12:05 PM