msbuild,wix,installer , WiX error build target

WiX error build target


Tag: msbuild,wix,installer

I'm trying to create my MSI setup with WiX and MSBuild command which deploy my img.png into a repertory and i have this error :

"MSB4019: project imported "C:\Program Files\MSBuild\Microsoft\WiX\v[[Version.M ajor]].x\Wix.targets" was not found. " Make sure that path of declaration are correct

In this line :

<Import Project="$(WixTargetPath)" />

Here my 2 files (test.wixproj and test.wxs) :


<Project DefaultTargets="Build" xmlns="">
                <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
                <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
                <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v[[Version.Major]].x\Wix.targets</WixTargetsPath>
        <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
        <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
                <Compile Include="C:\testW2.wxs" />
        <Import Project="$(WixTargetsPath)" />


<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="">
    <Product Id="*" UpgradeCode="" Version="" Language="1033" Name="My Application Name" Manufacturer="My Manufacturer Name">
        <Package InstallerVersion="300" Compressed="yes"/>
        <Media Id="1" Cabinet="" EmbedCab="yes" />

        <Directory Id="TARGETDIR" Name="SourceDir">
            <Directory Id="ProgramFilesFolder">
                <Directory Id="APPLICATIONROOTDIRECTORY" Name="Application test"/>

            <Component Id="myimg" Guid="">
                <File Id="myimg" Source="C:\img.png" KeyPath="yes" Checksum="yes"/>


        <Feature Id="MainApplication" Title="Main Application" Level="1">
            <ComponentRef Id="myimg" />

I don't unstandand where is the problem and i don't find an easy tutorial on WiX without VisualStudio.

Can you help me ?


There are two problems with your project file:

  1. The <WixTargetPath ...> line [[MajorVersion]] should be replaced with '3',
  2. The <Compile...> line should to refer to the correct file 'Test.wxs'.

Try this project file:

<Project DefaultTargets="Build" xmlns="">
            <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
            <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
            <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
    <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
    <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
            <Compile Include="test.wxs" />
    <Import Project="$(WixTargetsPath)" />

You also need to make sure test.wxs has a GUID in the UpgradeCode attribute.


How to change $(var.Platform) from x86 to Win32 in Wix

I have a Visual C++ 2013 solution including many C++ projects and a WIX installer project. On x64 platform, everything is okay. But On x86 platform, $(OutDirectory)$(Platform)$(Configuration) of C++ projects is ...Win32..., but $(OutDirectory)$(Platform)$(Configuration) of WIX is ...x86... What can I do?

vstest.console.exe not generating trx file, TestResults empty

I am trying to run below command on my build server, c:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" "C:\UnitTest\MyTests.dll" /settings:"C:\UnitTest\output.runsettings" /UseVsixExtensions:"true" /InIsolation /Logger:"trx" <?xml version="1.0" encoding="UTF-8"?> <RunSettings> <RunConfiguration> <ResultsDirectory>.\TestResults</ResultsDirectory> </RunConfiguration> </RunSettings> It generates TestResults folder which...

Service dependencies are causing my wix msi to force a reboot on uninstall

I have spent the past 3 days running in-place while tracking down the cause of forced reboots on my system, but have finally narrowed it down to a very specific cause. I have a service suite that I am working on in Wix. There are 10 msi's that are all...

SHFileOperation cannot remove folder

I am writing a C++ Custom action for WiX that will be called during installation to remove any leftovers installed by the installer. Consider the following code: UINT __stdcall DeleteResidue(MSIHANDLE hInstall) { HRESULT hr = S_OK; UINT er = ERROR_SUCCESS; LPWSTR lpFolderPath = NULL; std::wstring temp; SHFILEOPSTRUCT shFile; hr =...

command line Start.Info.Argument error

I would like run this command with C# : "%WIX%/bin/heat.exe" dir "C:\Documents and Settings\APP" -gg -sfrag -cg Appli -out wixappli.wxs I have this code (Program.cs) : System.Diagnostics.Process process1 = new System.Diagnostics.Process(); process1.StartInfo = new System.Diagnostics.ProcessStartInfo("cmd.exe"); process1.StartInfo.Arguments = String.Format("/k \"%WIX%/bin/heat.exe\" dir \"{0}\" -gg -sfrag -cg Appli -out wixappli.wxs ", @"C:\Documents and...

Relationship between SonarQube Runner and SonarQube.MSBuild.Runner

Regarding the announcement of SonarQube integration with MSBuild and Team Build, can anyone advise on the relationship between SonarQube Runner and SonarQube.MSBuild.Runner? I'm unclear whether SonarQube.MSBuild.Runner replaces SonarQube Runner or whether it sits on top of it.

msbuild set path to CL

I'm trying to take a couple of projects normally compiled on Windows with Microsoft C++ and compile them with clang instead. On the upside, there exists clang-cl.exe which is designed to be a drop-in replacement for cl.exe. However, even when I copy clang-cl.exe into the current directory as cl.exe, msbuild...

executing an vb script from another project bud in the same solution in C#

i am trying to call a VB script that i made that in the same solution bud in another project, it is a C# project with windows forms and WIX. i am building an .MSI installer and when i arrive at a certain form i want it to execute a...

How to launch executable after installation (exe is delivered by .msm)

I did everything as explained in tutorial, but my executable wasn't launched after product installation completed. There is a nuance that my executable is delivered with .msm module, so in .wxs file for .msi I do the following to launch application: <Wix xmlns=""> <Product> <!-- I omit here features and...

Unused results from Entity Framework database call

Any decent compiler should eliminate dead code, at least to a certain extent. However, I am curious how a compiler (specifically MSBuild) handles a situation like the following: // let's assume LazyLoadingEnabled = false; var users = db.Users.ToList(); // more code that never touches 'users' Since LazyLoadingEnabled = false, will...

Include file in solution explorer without it being a build dependency

How can I include a file in the list of files in solution explorer without including it as a dependency for compilation? I have a .targets file that generates .cs files, similar to the examples in this answer. <Project xmlns=""> <PropertyGroup> <CoreCompileDependsOn>$(CoreCompileDependsOn);GenerateCode</CoreCompileDependsOn> </PropertyGroup> <ItemGroup> <Sources Include="..\sources\*.txt" /> </ItemGroup> <Target Name="GenerateCode"...

How to change Install button display text conditionally

Is it possible to change the "Install" button display text based on some condition i.e if fresh install then "Install" if upgrade then "Update"? Basically, on major upgrade i am skipping some of my custom dialogs (which are shown on fresh installation) so on InstallReady dialog i want to show...

Release Management for Visual Studio 2013 - Release Exception

Getting the following error after a successful MsBuild on a TFS Build Server: ERROR: Value cannot be null. Parameter name: The attribute 'BuildNumber' is not part of this XElement at Microsoft.TeamFoundation.Release.Common.ExtensionMethods.XmlExtensionMethods.GetAttributeValue(XElement element, XName attributeName) at Microsoft.TeamFoundation.Release.Data.Model.ReleaseComponent.SetBuildToLatest() at Microsoft.TeamFoundation.Release.Workflow.Services.ReleaseWorkflowService.InitiateFromBuild(Uri teamFoundationServerUrl, String...

How to define WIX agent requirment in TeamCity?

I have add a WIX installer project to solution in Visual Studio 2013. The project is built with every commit on TeamCity. There are several build agents connected to TeamCity cloud, but only some have WIX installed. Usually I would add the build agent requirement, so only the computer with...

error MSB4062: The “MSBuild.ExtensionPack.Web.Iis7Application” task could not be loaded from the assembly MSBuild.ExtensionPack.Iis7.dll

Receiving this error when trying to build my application using msbuild: error MSB4062: The "MSBuild.ExtensionPack.Web.Iis7Application" task could not be loaded from the assembly MSBuild.ExtensionPack.Iis7.dll. Could not load file or assembly 'Microsoft.Web.Administration, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask>...

Migrate ClickOnce certificate from Sha1 to SHA256 and run on .NET 4.0 client machines

After discovering the signing issue with .NET 4.5 vs .NET 4.0 when upgrading from an SHA1 to an SHA256 signed certificated, I decided to re-implement our ClickOnce build process to follow a more standard approach so I could make use of VS2013 Update 3. However it didn't seem to have...

Binary files copied to a wrong folder on build

Recent libgit2sharp Nuget uses a new Nuget feature that allows you to include a piece of a build script in your NuGet. The purpose it to copy a native dll to a subfolder of the bin folder, like that: <ItemGroup> <None Include="$(MSBuildThisFileDirectory)\..\..\lib\net40\NativeBinaries\amd64\git2-e0902fb.dll"> <Link>NativeBinaries\amd64\git2-e0902fb.dll</Link> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None>... Now, it was all nice...

Single Package Authoring

I am trying to create Single Package Authoring installation using following tutorial - Main wix file is following: <?xml version='1.0' encoding='windows-1252'?> <Wix xmlns=''> <Product Name='Foobar 1.0' Id='GUID' UpgradeCode='GUID' Language='1033' Codepage='1252' Version='1.0.0' Manufacturer='Acme Ltd.'> <Package Id='*' Keywords='Installer' Description="Acme's Foobar 1.0 Installer" Comments='Foobar is a registered trademark of Acme Ltd.'...

How do ASP.NET Web APIs work once built with MSBUILD?

I'm new to coding and spend most of my time in mobile application development with Phonegap, I've been learning how to code ASP.NET Web APIs and I know how it generally all works while having the code open in front of me but --- I was asked a question today...

MSBuild Error: “The solution file has two projects named …”

I'm trying to figure out how to make MSBuild work so I can set up automated builds and would appreciate some help with this weird error. I'm using Visual Studio 2013, and a Web Application project. The solution has 8 different class libraries. I've got several Publish Profiles set up...

Is Component/@Guid attribute is a MUST in case of producing MergeModule

In my .wxs file for components, there are only components with single file, and this is the case for generatable GUIDs. But it seems to me that for .msm (merge module), component's GUID should be explicitly specified. Or I'm free to use Guid="*" and that would be OK? I tried...

New Automatic NuGet package resotore and NuGet.Config

I'm migrating to new version of Automatic package restore as described in docs This documents says, that .nuget folder should be removed completely. Including NuGet.Config, that contained a property, we need: <config> <add key="repositoryPath" value="..\..\..\commonNugetPackages" /> </config> So how one should specify path where packages should be restored? Update: Updating...

Error allocating file install folder in WIX 3.9

I am setting up the installation locations for my installer. However, it throws an error when I try to set the locations. Source code: <?xml version="1.0" encoding="UTF-8"?> <Wix xmlns=""> <Product Id="*" Name="Wix_setup" Language="1033" Version="" Manufacturer="Frank Jansen" UpgradeCode="37a42e55-dea8-47da-8f4f-fb065dd38a9e"> <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" /> <MajorUpgrade DowngradeErrorMessage="A newer version of...

CodeContracts fails the build for seemingly no reason

I have a C# PCL project that uses code contracts. However on TeamCity the project fails to build, but it looked like the build was successful locally. However the build log does claim that the build did fail, but it gives no reason at all. 'Fail build on warnings' is...

Elastic Bamboo CI Windows Server - MSBuild 12 not publishing

I have a custom image with Node.js, Microsoft Build Tools 2013, Windows SDK for Windows 8.1, .Net Framework 4.5.1 SDK, Microsoft Test Controller for Visual Studio 2013, Microsoft Agents for Visual Studio 2013 and Microsoft Web Deploy 3.5 installed. Most things are working but I am struggling to get the...

WIX XMLConfig Different Root Element Names

I'm running into an odd issue with a "config" msi I'm writing in WIX that uses XMLConfig to check for, delete and then create the new values in a single xml file. Since I Discovered WIX I've been packaging a lot of our manual configuration processes so this is my...

WiX error build target

I'm trying to create my MSI setup with WiX and MSBuild command which deploy my img.png into a repertory and i have this error : "MSB4019: project imported "C:\Program Files\MSBuild\Microsoft\WiX\v[[Version.M ajor]].x\Wix.targets" was not found. " Make sure that path of declaration are correct In this line : <Import Project="$(WixTargetPath)" />...

Creating a silent installer for a MSI

What is the best way to make a silent installer (or unattended) for a program that was already created and has a msi installer? At work I'm told to create an installer that is automated and does all the interaction with the user automatically so that the user essentially just...

TFS Build - Get Assembly Version Info

Is there a simple way to set the TFS Build Number to be an Assembly Version during build? I've seen many examples of the other way around (i.e. a build number updates the assembly version). We already use the SharedAssemblyInfo implementation from here, so we would like to leverage this...

How do I install the Wix extension on after a Visual Studio 2013 Update?

I have installed Wix 3.9 on VS 2012. Recently, I just got VS 2013 and I am not sure how to install just the extension on there? How do I do without uninstalling wix 3.9 and reinstalling it back again?...

Msbuild now to conditionally use one of two targets with same name

I've seen some answers to a similar question but not exactly the same and not with positive luck trying to use suggested solutions... so I'm trying something like this: <project> <target name="foo" Condition="'$(Configuration)' == 'Debug' "> <Message Text="=== RUNNING FOO DEBUG TARGET ===" /> </target> <target name="foo" Condition="'$(Configuration)' == 'Release'...

Should a WiX web installer and stand-alone installer both show up in Add/Remove programs?

We have two WiX installers that use our own BA. One installer gets all the packages from the web, while the other gets all the packages from the exe. We call them "Web" and "Full" installers. We have a case where a user might install one package from the web...

Change Wix Product version number using NANT XmlPoke

I ran into this issue recently - when I try to replace the Wix Product version number using NANT XMLPOKE task, it returns the following error message "No matching nodes found". <xmlpoke file="..\Setup\abc.wxs" xpath="//Wix/Product[@Version]" value="${version.label}" > Initially I thought that this was an issue with XPATH statement that I wrote....

Namespace prefix 'bal' is not defined

I've got this error. Since I put below code in the Bundle.wxs. <BootstrapperApplicationRef Id="WixExtendedBootstrapperApplication.Hyperlink2License"> <bal:WixExtendedBootstrapperApplication ThemeFile="Resources\COTheme.xml" LicenseUrl="http://xxxxxx /> </BootstrapperApplicationRef> Could please anyone help me?...

Reading msbuild syntax

I've run across msbuild syntax that I don't understand. The following snippet is from another question about making a custom msbuild task <GenerateDesignerDC InputFiles="@(dbml)" OutputFiles="@(dbml->'$(IntermediateOutputPath)%(FileName).designer.cs')"> ... What does @(dbml->'$(IntermediateOutputPath)%(FileName).designer.cs') mean? The @ sign usually references the files in an ItemGroup; what does the -> arrow inside an @(...) mean? What...

How do i have a .csproj build a .proj file before building itself?

I have a .csproj file and a .proj file. As part of my .proj file I am generating a file to include in the .csproj, so the .proj needs to run first. How can this be done. I originally tried to add a project reference as follows: <ProjectReference Include="..\FileGenerator\FileGenerator.proj"> <ReferenceOutputAssembly>false</ReferenceOutputAssembly>...

How to add assemblies to WiX toolset setup, which comes from a nuget package?

I use the Votive-project type to create a setup with the WiX toolset. I know, that I can add an assembly like this to the setup: <File Id="FILE_myproject.dll" Source="$(var.myproject.TargetPath)" KeyPath="yes" /> What I don't know is, how can I add referenced assemblies to the setup, which comes in a nuget...

Trigger uninstall and Repair of previously installed product

i am new to Wix toolsets. i have successfully made my first installer in Wix but now i am confused about my software updates which usually are minor. in my installer i want to check if user have any older version installed then i want to show him three options...

Octopack for .Net 2.0 and msbuild 2.0

I was setting up number of projects to build NuGet packages and push onto NuGet server, so it could be later used by Octopus Deploy. All was fine until I needed to apply the same process to legacy projects. The error was: error MSB4062: The "OctoPack.Tasks.CreateOctoPackPackage" task could not be...

Can't build a project with Postsharp 4.1.14

I have a project which references a postsharp 4.1.14. When I build a project the error occurred. Postsharp is installed by nuget package. There is .net version 4.0 installed on computer, but Microsoft.Build.Utilities.ToolLocationHelper.GetPlatformSDKLocation method is from .net 4.5. Can I use different version of postsharp? Is there another way to...

Deploy Any CPU build with WiX to x86 using MSBuild

I have a set of solutions that build a complete .NET Any CPU application. I have a WiX project that will deploy that application as x86 and I can run this all manually in Visual Studio 2013 without any issues. Now I'm trying to get this to work in MSBuild...

WIX-Installer ServiceControl “sufficient privileges” error

Visual Studio 2015 RC Wix v3.10.0.1726 I am creating a installer for a windows services. I've tested the service with InstallUtil and it runs fine. Unfortunately I'm having a bit of troubles with wix, here is the exact error - "Service 'Service Name' failed to start. Verify that you have...

WiX – copy arbitrary files

The folder where my setup.exe is located contains a subfolder CALhaving files named something like – their names vary from customer to customer. These files have to be copied into a folder CAL in the target directory. So I created a CustomAction and a C# dll which uses the...

How to change text style of the Title & Description text controls of a WiX dialog?

Where can I find information of the Style values for a text control of a WiX dialog? For example, the default text style used for the WiX dialog Title control is {\WixUI_Font_Title} & I would want to use the same style but to change the color to White. For the...

Emulate Devenv/Runexit under MSBuild

I am new to MSBuild and busy automating tests of Visual Studio solutions. I previously worked with the command line of Devenv, which provides a convenient /Runexit mode of operation. From the manual: /Runexit (devenv.exe) Compiles and runs the specified solution, minimizes the IDE when the solution is run, and...

Cant find File System, Registry icon in WIX setup project in Visual Studio

I installed WIX in my machine. I followed the video of link description here I can not find any way to add File Systems, no icon for it, no context menu entry on project. I am using Visual Studio 2012....

Is it possible to write build message from powershellscript?

If i have a build template for TFS, and in this template in post-build script row i make a call to a powershell script, are there any way to transfer output from this PS script to build log?