Create an installer for website with WIX, part 1

For a customer we created a new web application in MVC4 with an underlying SQL database. One of the requirements was to provide an installer to install this website at their customers local installations. The installer had to do a few tasks:

  • Install the .NET 4.5 framework if that isn’t installed already
  • Install the MVC 4 framework if that isn’t installed already.
  • Create a folder and copy all needed files to run the application
  • Create a new database on an existing SQL server and prefill the database with the correct tables and values. (the connection details and database name should be entered by the end user running the installer)
  • Create a new website in IIS 7.5 (create website and application pool running under .NET 4.5)
  • Alter the config file so the correct connection settings are used (entered by the end user)

From Visual Studio 2012 on there is no Windows Installer project available any more. You can use the InstallShield Express edition with limited capabilities or the Windows Installer XML (WiX) open source package created by Rob Mensching when he was working for Microsoft. (It’s actually the oldest open source project from Microsoft and now under the OuterCurve foundation)

The Installshield express version doesn’t support IIS installations and falls out of the boat. WiX does support all actions that we have to do but has a steep learning curve. I used WIX in a previous project and still had some hassle to put all of it together. This series of posts will walk us through the creation of the installer.

Start project

Start by downloading the WiX toolset from http://wixtoolset.org/releases/. For this demo I used the 3.8.826.0 version. This is not the latest stable published release but I haven’t got any problems with this version.

Next step is creating a MVC 4 web project and choose for an internet application so we have some default files (javascript, css, views, controllers, …).

Right click on the solution in the solution explorer and choose to add another project. In the ‘Add New Project’ dialog select Windows Installer XML on the left hand side. Choose for ‘Setup Project’ and click the OK button.

image

You should get a new project with only one file (Product.wxs).

WiX flow

WiX source files are written in XML and have the wxs or wxi (for variables) extensions. Those files have to be compiled to wixobj files. This can be done in Visual Studio or by command line by using the candle.exe tool in the WiX toolset. After compiling the wixobj files another tool is needed to create the msi (installer) file, the light.exe tool.

The most simple installer can be created by just using one wxs file. You will notice that it will make your project more clear to use different wxs files. One for every part of the installation.

You can use the default UI that is available in the WiX toolset but with bigger projects (and in this demo) you can create your own UI and flow. Even the UI is defined in XML and has the same wxs extension. Another reason to split up your installer code in different files to keep the overview.

Step 1: install all needed files

Open up the Product.wxs file in Visual Studio. You’ll see already a few standard values filled out.

At line 3 you get the product attributes that have to be set. Leave the asterix ( * ) at the Id tag. WiX will replace this with an unique Guid when compiling the source. Set the version, language and the name to the desired values.

IIS default location for websites is the c:\inetpub directory. We’ll alter the installer so this default location is used. In one of the next chapters we’ll be able to change this folder. Navigate to line 15 and alter the Directory tag.

You’ll see I’ve changed the default InstallFolder to Inetpub. (from c:\Program Files to c:\Inetpub). This is all we have to change for the install location.

On line 26 you’ll see the ComponentGroup where we’ll have to define all files that have to be installed in our installation folder. Let’s start with adding some files. In the example below I added 3 files in the root of out application (favicon.ico, web.config and global.asax). To add the bin folder I had to add a new ComponentGroup, a new Component, and a new Directory element before I could add the files (2 dll’s).

As you can see this is a tedious job to add every file you want to be installed. Luckily there is a faster way to create this.

Use the heat component from the WiX toolset

The WiX toolset has another tool heat.exe that can help us to harvest all files that we need to install. Although heat was incorporated in Votive (the Visual Studio environment for WiX) in earlier versions, in the 3.7 – 3.8 version this is not available in Visual Studio.

MSBuild to the rescue

If we want to make use of the heat component we’ll have to script it. We can create a bat file we can run every time before we build the installer or we can create an MS build script that we can run. The MS build script has the advantage that we can reuse this script for out build server (continuous integration).

Create a new text file in the Setup project and rename it to setup.build. First we’ll add some properties in a ‘PropertyGroup’: the source of our website and the name of the WiX file we want to build. We also include the path where we should publish all files. In the ‘itemgroups’ we define the temporary files witch is the content of the web site and the list of WiX input files.

Add build target

We first have to build our website so we are sure we have the latest build we are deploying. Therefor we add a target in the MS build file

Add Publish website target

We’ll use the build in publish feature of MS build to deploy the website to a new folder so we have only the files we need. (and not the .cs files etc)

Harvest the files in WiX

Now that we have all the files we need under a temporary folder we can use the heat.exe tool in the WiX tool belt to harvest the files and create a wxs file.

The parameters used in this command:

  • dir $(Publish) tells to harvest a directory (our published website)
  • -dr:  The directory where the files have to be installed to
  • -ke:  Keep the Empty directories
  • -srd:  Suppress harvesting the root directory as an element.
  • -cg: The ComponentGroup name that have to be used
  • -var var.publishDir: Will substitute the source directory with a wix variable so we can use $(var.publishDir)\myfile.txt in the wxs files
  • -out $(WebsiteContentCode)  the file we want to be created (see PropertyGroup settings)

Test the script

With the heat command inserted we can test our script. Open up a Developer Command Prompt for VS2012. Change the prompt to the DemoWebsite.Setup project folder and type the following command:

msbuild /t: Build;PublishWebsite;Harvest setup.build

and hit enter. If everything goes well you’ll see a lot of command coming by. The script will create a folder Setup\publish under the root and publish the website. At last a WebsiteContent.wxs file will be created in the setup project folder.

If you open up the WebsiteContent.wxs file you’ll see all files and folders are added with their own Id under a ComponentGroup MyWebComponents.

If you looked closely you’ll have seen a few WiX commands passing by when executing the build file. Because we are going to handle the WiX build process in our build file we can exclude the setup project from the build configuration. Right click on the solution in the Solution Explorer in Visual Studio and choose for Configuration manager.

image

Change the active solution configuration to ‘Release’ and uncheck the build flag next to the setup project.

image

Update the Product.wxs file

Now we have all our files we have to install we have to reference to the created MyWebComponents CompenentGroup and delete the entries we made before to add the files.

Build the installer

Now that we have all the components for the first fase (installing the files) we can use the candle.exe and light.exe tools from the WiX tool belt to built our installer.

Add properties in the build file

First we need some more properties in our build file. Add the WebSiteContentObject parameter that will hold the compiled WiX code (WebSiteContent.wixobj). And also add the MsiOut parameter that will hold the path and name of the installer (.msi) file.

Add candle.exe in the build file

Add a new target tag in the build file and add the candle.exe tool with the parameters where to find the publish directory and witch files he has to compile.

Add light.exe in the build file

In the same target (WIX) add the light.exe command with parameters where to put the generated msi and witch source files to include.

Final run

Open up your Developer Command Prompt and type the next command where we added the WIX target:

msbuild /t: Build;PublishWebsite;Harvest;WIX setup.build

Hit enter and keep your fingers crossed. If you had no error messages you should find a msi file in the bin/release folder of the setup project. Run that installer and you’ll see that under the C:\inetpub folder a DemoWebsite folder is added with all the published files from our webapplication.

If you had any errors you can find the complete files here:

Next parts

Enough for one blog post I would say. the next posts in this series will handle the next actions:

  • Install the .NET 4.5 framework if that isn’t installed already
  • Install the MVC 4 framework if that isn’t installed already.
  • Create a folder and copy all needed files to run the application (done)
  • Create a new database on an existing SQL server and prefill the database with the correct tables and values. (the connection details and database name should be entered by the end user running the installer)
  • Create a new website in IIS 7.5 (create website and application pool running under .NET 4.5)
  • Alter the config file so the correct connection settings are used (entered by the end user)

Complete source code

You can find the complete source code for this project on GitHub. Keep in mind that this project will be altered when the next parts are implemented. I will try to keep the commits together with the series.

Other posts in this series

71 thoughts on “Create an installer for website with WIX, part 1

  1. Pingback: Create an installer for website with WIX, part 2 | Bart De Meyer - Blog

  2. Pingback: Create an installer for website with WIX, part 3 | Bart De Meyer - Blog

  3. Pingback: Create an installer for website with WIX, part 4 | Bart De Meyer - Blog

  4. Stephen Dye

    Hi Bart,

    Thanks for publishing this article, it has been useful and informative. My only question is where do you define the $(WixPath) variable for the Heat/Candle/and Light commands? The only way I could get it to find those exe files is to do the following $(WIX)\bin\heat for example.

    I understand the rest of the article, but that is the bit I can’t quite figure out!!

    Reply
    1. Rafael

      alternatively, you can add the following to the setup.build file:

      ..\DemoWebsite\
      “C:\Program Files (x86)\WiX Toolset v3.9\bin\”

      Reply
  5. pawan

    Hi Bart, i found this article very simple to understand and easily integrated with my project. However i am facing issue with var.publishDir mentioned at the heat command.

    I am getting error : WebSiteContent.wxs(18: error CNDL0150: Undefined preprocessor variable ‘$(var.publishDir)’.

    i can see var.publishDir is defined while executing the candle command. But not sure why i am getting this error . Do I need to exclusivlly define this variable.

    Thanks,
    Pawan

    Reply
    1. pawan

      Hi Bart,

      I found solution of this issue. I was including the harvested “WebSiteContent.wxs” file into my setup project, which is throwing compile time error.

      Thanks,
      Pawan

      Reply
  6. Joe

    Great article that helped me out a tonne!

    It’s worth mentioning that the space after t: in the build command (msbuild /t: Build;PublishWebsite;Harvest setup.build) was causing a “MSBUILD : error MSB1004: Specify the name of the target.” error for me.

    After removing the space the build worked fine.

    Hopefully if anyone else comes across this then it will help them out!

    Reply
  7. onkar

    Hi Bart,

    Thanks for your article, its really helpful.
    I am doing as like you mentioned the steps in your article but I am getting the error at line
    ‘$(WixPath)heat dir $(Publish) -dr INSTALLFOLDER -ke -srd -cg MyWebWebComponents -var var.publishDir -gg -out $(WebSiteContentCode)’

    Error:
    D:\Data\Projects\VendorProjects\Application\311213\ProductAdminInstaller\setup.build(38,5): error MSB3073: The command “C:\Program Files
    (x86)\WiX Toolset v3.8\bin\heat dir ..\Setup\publish\ -dr INSTALLFOLDER -ke -s
    rd -cg ProductComponents -var var.publishDir -gg -out WebSiteContent.wxs” exite
    d with code 9009.

    can you please help. Help will be really appreciated.

    Reply
    1. onkar

      Hi Bart,

      I found the solution, there is enviroment veriable file path contains the spaces issue which I correct and its worked very smothly. Even I successfully execute the msbuild /t:Build;PublishWebsite;Harvest;WIX setup.build command and its showing me the message Install package has been created. after that I have searched everywhere but the “setup.msi ” file is nowhere present. Where this file will create “bin\Release\DemoWebsite_Setup.msi”, in the Wix setup project folder or Application Bin folder. Is I am missing something please guide.
      Thanks,
      Onkar

      Please help.

      Reply
      1. Troels

        Regarding the first issue (the heat error):
        The command should include double quotes around the path and heat part, as is seen in the candle and light commands, i.e.:

        Command=’$(WixPath)heat dir $(Publish) -dr INSTALLFOLDER -ke -srd -cg MyWebWebComponents -var var.publishDir -gg -out $(WebSiteContentCode)’

        And then to the second issue: In my case the missing output was caused by a missing ItemGroup. The WixObject is not defined in the tutorial above, but looking at the complete file the definition can be found (after the item group setting up the WixCode includes):

        Just insert this in the build script and it should generate the msi file.

        Finally thank you Bart for a great and very useful tutorial!

        Reply
      2. Benoit

        I have got the same problem!
        At the beginning of the setup.build make sure you have define WixObject 😉

        Reply
    2. Dhaval Somani

      Hi Onkar,

      Find out the path of heat.exe and then replace that path with $(wixpath).

      for example.

      ‘”C:\Program Files (x86)\WiX Toolset v3.7\bin\heat.exe” dir $(Publish) -dr INSTALLFOLDER -ke -srd -cg MyWebWebComponents -var var.publishDir -gg -out $(WebSiteContentCode)’

      Reply
  8. Pradeep V

    Hi,

    I am trying to follow the above article to create build scripts. I am encountering following error “E:\Workspaces\IntegraRESTService\Installer\Product.wxs(10): error LGHT0094: Unresolved reference to symbol ‘WixComponentGroup:MyWebWebComponents’ in section ‘Product:*’.” when I execute the script.

    I am novice when it comes .NET. Any help or hint is greatly appreciated.

    regards,
    Pradeep

    Reply
    1. Tyler Bishop

      Pradeep,

      I just had the same issue. Check the Feature Name property in the Product.wxs file. The name should equal the WIX project name.

      For example: If your WIX project is titled “DemoWebsite.Setup”, then

      If like me you changed the project name, it should go there.

      Regards,
      Tyler

      Reply
      1. Phuc

        Hi Tyler,

        I did what you said but unfortunately it doesn’t work, for example my project is MyCompany.MyProduct.WcfSetup.wixproj then

        Is that right?
        Phuc

        Reply
        1. steven

          You need to change the active solution configuration to ‘Release’ and uncheck the build flag next to the setup project as the article said.

          Reply
      1. Rory

        I had the same problem, it seems that they forgot to add the WixObject ItemGroup to the tutorial. If you look at the linked sample file you’ll see it near the top:


        Once I added this to my setup.build file I stopped getting the “unresolved reference” error

        Reply
        1. Rory

          oops, HTML ate my code!


          <!-- The list of WIX after candle files -->
          <ItemGroup>
          <WixObject Include="Product.wixobj" />
          <WixObject Include="$(WebSiteContentObject)" />
          </ItemGroup>

          Reply
  9. Mahesh P Mallia

    Thanks for such a detailed tutorial. I have been able to generate the MSI file but nothing happens on executing it. It just shows the installation progress bar and exits after a few seconds. The files are not copied to the IIS folder and no errors are reported either (checked in event log as well). So I don’t know what’s happening. Can you please help?

    Reply
    1. Mahesh P Mallia

      Turns out that the default drive is D and not C. I found the files under D:\inetpub\wwwroot. Also the default path shown in the UI is D:\inetpub. It does not show the full installation path.

      Reply
    2. Shamanth

      I am facing same kind of issue, in my case I checked the default drive and it is C:\ .
      Don’t know where to look now, help will be greatly appreciated.

      Thanks!!

      Reply
        1. Patil

          Hi Shamanth,

          Even I am facing the same issue. Can you please let us know what change you have done to make it work.

          I am trying to fix this issue since 2 days.

          Thanks,

          Reply
  10. Kevin

    This was a huge help! Thank you very much for the detail you put into this. One quick question… do you know if there is any way to modify the build process in Visual Studio so that I can do a Build there instead of running the “msbuild.exe /t:Build;PublishWebsite;Harvest;WIX setup.build” command each time I need to build?

    Reply
  11. RBS

    Hi Bart,

    Thanks for the nice blog. I am trying to use the Wix for packaging and seems getting some road block. This is my first attempt, so perhaps I may be missing something obvious, so pls excuse. Please see the issues as below:

    1- The ComponentGroupRef is giving same error as reported above. I did tried to keep the project name and property name same but no luck.

    Error 6 Unresolved reference to symbol ‘WixComponentGroup:XXXWebComponents’ in section ‘Product:{8B9EA261-5DF1-4E40-9A71-8EB3AD2E2660}’. …\Product.wxs 15 1 XXX

    2- The build is not working at all:
    a) First it was getting 9009 error, then I put in environment variable and also used \bin. But now it is giving me Error code 3.

    error MSB3073: The command “”\bin\heat dir ..\Setup\publish\ -dr INSTALLFOLDER -ke -srd -cg ProcessServerWebComponents -var var.publishDir -gg -out WebSiteContent.wxs” exited with code 3

    b) By referring this blog (http://social.msdn.microsoft.com/Forums/en-US/589ffae3-59ca-4d0a-a7b1-9f1120db3792/msb3073-the-command-exited-with-code-3?forum=msbuild), I removed ComponentGroup but no luck again same error:

    error MSB3073: The command “”\bin\heat” dir “..\Setup\publish\” -dr INSTALLFOLDER -ke -srd -var var.publishDir -gg -out WebSiteContent.wxs” exited with code 3.

    Any help will be appreciated.

    Thanks,
    RBS

    Reply
  12. Hugo

    Hi,

    I’m having a problem when I test the scrip. After executing:
    msbuild /t:Build;PublishWebsite;Harvest setup.build
    I’m getting this error:
    “E:\MRW2014\installer\MyWeb\SetupProject1\setup.build” (Build;PublishWebsite;Ha
    rvest target) (1) ->
    “E:\MRW2014\installer\MyWeb\WebApplication\WebApplication.csproj” (ResolveRefer
    ences;_CopyWebApplication target) (4:4) ->
    (_CopyWebApplicationLegacy target) ->
    C:\Archivos de programa\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications\
    Microsoft.WebApplication.targets(132,5): error MSB3021: Unable to copy file “ob
    j\Release\WebApplication.dll” to “..\Setup\publish\bin\WebApplication.dll”. Cou
    ld not find file ‘obj\Release\WebApplication.dll’. [E:\MRW2014\installer\MyWeb\
    WebApplication\WebApplication.csproj]

    Thanks,
    Hugo

    Reply
  13. Omair Imran

    Thank you Bart!

    One question that I have, is that shouldn’t we use specific Product Id (instead of Product Id=”*”) if we need to continue with upgradable MSIs?

    Thanks in advance.
    Omair

    Reply
  14. Ram

    Hi,
    I am getting the following error. I followed all steps and it is not generating a file MyWebComponent.wxs. i

    Product.wxs(9):
    error LGHT0094: Unresolved reference to symbol ‘WixComponentGroup:MyWebComponents’ in section ‘Product:*’.

    Can any one please help me how to fix it. if I remove then it is generating fine but it won’t put the files into MSI.

    Thank you for your help

    Reply
  15. Vishal

    HI Bart,

    Your article is very useful and informative but i am getting error like this.

    D:\Vishal Patel\WebApplicationWixDemo\MyAppSetup\setup.build(57,5): error MSB30
    73: The command “”candle” -ext WixUtilExtension -dpublishDir=..\Setup\publish\
    -dMyWebResourceDir=. Product.wxs WebSiteContent.wxs” exited with code 9009.

    please help me out to resolve this error.

    Reply
  16. Ferdinando

    I have the same problem Product.wxs(9):
    error LGHT0094: Unresolved reference to symbol ‘WixComponentGroup:MyWebComponents’ in section ‘Product:*’.

    with the wix 3.8.I have tried many solutions without success.

    Reply
  17. Bob Hodge

    Thanks for the informative guide, Bart. It’s really helped. I’m wondering, though, if you use TFS, and if so, how you make the TFS build process work best with this custom MSBuild file you create.

    Reply
  18. vignesh

    Hi,
    I have created a msi as described as above. when I try to installing it it’s doesn’t show anything(i.e. publish folder was not created) when I checked in msi log it shows 1603 error(fatal error). kindly help me on this.

    Reply
  19. Bongani

    Hi All,
    I have just come accross this informative article on Wix and have tried to get it to run but I am getting an error line most of you here “error LGHT0094: Unresolved reference to symbol ‘WixComponentGroup:MyWebComponents’ in section ‘Product:*’.” Some of your input above are suggesting that the article left out a Wix Component item but I am not sure where and how to add it on my solution. Any help will appreciated.

    Thanks.

    Reply
  20. Mark Brimble

    Hi,
    I was getting Product.wxs(9):
    error LGHT0094: Unresolved reference to symbol ‘WixComponentGroup:MyWebComponents’ in section ‘Product:*’.
    I found this problem went away after building the web site project from Visual studio.

    This is a great blog. Very useful to me.

    Reply
    1. Carlos Liu

      For the error LGHT0094: Unresolved reference to symbol ‘WixComponentGroup:MyWebComponents’ in section ‘Product:*’.

      Please try below command

      msbuild setup.build /t:PublishWebSite;Harvest;WIX;DeleteTmpFiles

      Reply
  21. Patil

    Hi,

    I am getting below error.

    D:\E- Drive\Patil\Installshield\DemoWebsite\DemoWebsite.Setup\setup.build(54,5)
    : error MSB3073: The command ” dir..\Setup\publish\ -dr INSTALLFOLDER -ke -srd
    -cg MyWebWebComponents -var var.publishDir -gg -out WebSiteContent.wxs” exited
    with code 1.

    Done Building Project “D:\E- Drive\Patil\Installshield\DemoWebsite\DemoWebsite.
    Setup\setup.build” (PublishWebsite;Harvest;WIX target(s)) — FAILED.

    Please help me to resolve this issue.

    Reply
  22. Patil

    Hi,

    I am getting below error when I run the script

    error MSB3073: The command “”candle” -ext WixUtilExtension -dpublishDir=..\Setup\publish\
    -dMyWebResourceDir=. Product.wxs WebSiteContent.wxs” exited with code 9009.

    Please help us to resolve the issue

    Reply
  23. Pingback: ESB Portal Management Sample BizTalk 2013 R2 – WIX Installers | Connected Pawns

  24. Elvis

    Thank you for the tutorial, but, so far, I haven’t been able to get past MSBuild to the Rescue.

    Everything runs well up until PublishWebsite: “error MSB4057: The target “ResolveReferences” does not exist”. What are “ResolveReference” and “_CopyWebApplication”? Am I missing something?

    On my main web project; it errors. I created a simple website (just a Default.aspx with “Hello world!”) and, again, same problem at the same spot.

    Help, please.

    Thank you, in advance.

    Reply
  25. Jack

    I am new to wix and come to great resource here about wix.

    In your goal, to create a new database on an existing SQL server.

    Just wondering, is it possible to add installation of new sql server (not existing) into it, if it is not already installed?

    Reply
  26. Pingback: WiX Web Deploy IIS | Vincent

  27. Abrar

    I am stuck at “MSBuild to the rescue” , i am just wondering where do i need to put the msbuild code??

    Reply
  28. Dave

    Great tutorial. I’ve been able to get about 90% of my site in an MSI, which does deploy. I’m using VS 2015 community along with harvest and heat to create the WebSiteContent.wxs file.

    I have one major problem, using the normal build solution process in VS, the \bin folder contains a roslyn subdirectory. After running the msbulid, my WebSiteContent.wxs file lists the bin folder and all of it’s files, but the roslyn dir is missing.

    My app fails to launch without the contents of the roslyn subfolder with 12 files.

    Any help is appreciated.

    Thanks
    D

    Reply
  29. Rasal Shukla

    Hi ,
    Thanks fro the article , after following the complete step , I am getting below error , please give me suggest some solution for it.
    Done Building Project “C:\WixProject\DemoWebsite\DemoWebsite\DemoWebsite.csproj
    ” (ResolveReferences;_CopyWebApplication target(s)).

    Harvest:
    “heat” dir ..\Setup\publish\ -dr INSTALLFOLDER -ke -srd -cg MyWebWebComponent
    s -var var.publishDir -gg -out WebSiteContent.wxs
    ‘”heat”‘ is not recognized as an internal or external command,
    operable program or batch file.
    C:\WixProject\DemoWebsite\DemoWebsite.setup\setup.build(55,5): error MSB3073: T
    he command “”heat” dir ..\Setup\publish\ -dr INSTALLFOLDER -ke -srd -cg MyWebWe
    bComponents -var var.publishDir -gg -out WebSiteContent.wxs” exited with code 9
    009.
    Done Building Project “C:\WixProject\DemoWebsite\DemoWebsite.setup\setup.build”
    (Build;PublishWebsite;Harvest;WIX target(s)) — FAILED.

    Build FAILED.

    “C:\WixProject\DemoWebsite\DemoWebsite.setup\setup.build” (Build;PublishWebsite
    ;Harvest;WIX target) (1) ->
    (Harvest target) ->
    C:\WixProject\DemoWebsite\DemoWebsite.setup\setup.build(55,5): error MSB3073:
    The command “”heat” dir ..\Setup\publish\ -dr INSTALLFOLDER -ke -srd -cg MyWeb
    WebComponents -var var.publishDir -gg -out WebSiteContent.wxs” exited with code
    9009.

    0 Warning(s)
    1 Error(s)

    Time Elapsed 00:00:03.51

    Reply
  30. Juien

    Uninstalling the application does not remove the created virtual directory from IIS. Can you please post some script or anything that can able to remove the virtual directory from IIS.
    Thanks

    Reply
  31. Patrick

    i need to install .net framework 4.5.2 , c++ redistributable and SQL Server Native Client.
    In your code unfortunately i cannot found the section where you check if .net framework is installed if not -> installed
    Can you help me?
    Thanks

    Reply
  32. waleed

    Hi , amazing
    Thank you first

    I wonder where you added
    •Install the .NET 4.5 framework if that isn’t installed already
    •Install the MVC 4 framework if that isn’t installed already.

    Reply
  33. Wayne Cornish

    Thank you for the tutorial, but, so far, I haven’t been able to get past MSBuild.

    I keep getting the following error on the sln file –

    error MSB126: The specified solution configuration “Release|BNB” is invalid. Please specify a valid solution configuration using the configuration and Platform properties (e.g. MSBuild.exe Solution.sln /p:Configuration=Debug /p:Platform=”AnyCPU”) or leave those properties black to use the default solution configuration.

    I have tried on my own solution and downloaded your example and I am getting the same error on both?

    I’ve run the solution in release mode and unchecked the build setting without any luck.

    Any help with this, would be greatly appreciated.

    Regards
    Wayne

    Reply
  34. Alexander

    Thank you for your article, it’s very helpful!
    After I solved a few issues I really stuck with “MSB4057: The target “_CopyWebApplication” does not exist in the project” error.

    I would appreciate any help!
    Thank you

    Alexander Gryn

    Reply
  35. granadaCoder

    error LGHT0094: Unresolved reference to symbol ‘WixComponentGroup:MyWebWebComponents’ in section ‘Product:*’.

    I got this error because

    WebSiteContent.wixobj

    was missing from my msbuild (setup.build) file.

    The bigger lesson is that there are several things missing from the “how to” above……vs the code sample. Make sure you pull the code sample and do a file compare between your setup.build file vs the one on the code SAMPLE. There were other items missing ( already pointed out in these comments)

    Reply
  36. Francis Chung

    Here are the issues I’ve encountered. FYI I’m doing it for ASP.NET MVC Core, not ASP.NET as per the website.

    Setup.build :
    1) WixSetup not defined in PropertyGroup
    “C:\Program Files (x86)\WiX Toolset v3.11\bin\”

    2) WIX Target Command attribute is inconsistent with Harvest Target
    One has the intial command call wrapped in quotes and the other hasn’t. If you’re using the above WixPath, then remove the quotes.

    Reply
  37. Francis Chung

    I also had to have another Fragment element to get it working. Again mine is slightly modified for ASP.NET MVC Core.

    I noticed an odd behaviour here.

    If I leave the ComponentGroup Id as MyWebComponents2 it will not compile under VS Studio using the build command, but it works with the MSBuild command.
    If I change it to MyWebComponents (which is defined as a ComponentGroupRef under Feature) as per the compiler error message, the opposite happens.

    Since we’re using MSBuild to build the installer, leave it as MyWebComponents2


    <!–
    –>


    <!– –>

    Reply
  38. Pawan

    Thanks for the above code , I created the MSI for my project but when i install it , nothings changing. I cant find my published web contents in tnetpub/Demowebsite folder , there are no error messages during instalation also.

    Reply
  39. Jake

    We are working on the project WixPie (WixPie.com) that can make the WiX Toolset experience much better
    and the idea is to minimise the learning curve.

    At this point we have a preview that you can download for free.

    Any comments are welcome.

    Reply
  40. Joe Mierwa

    I know it’s been a while since you’ve done this, but when I try testing as described, I get the error message down below. I assume that the targets go into the wix project file? Any thoughts on why it is unable to find ‘Build’? I am doing this in VS2017.

    C:\_working\Iowa\dot-net-wix\Complaint\ComplaintInSetup>msbuild /t:Build;PublishWebsite;Harvest setup.build
    Microsoft (R) Build Engine version 15.1.1012.6693
    Copyright (C) Microsoft Corporation. All rights reserved.

    Build started 8/18/2017 12:04:49 PM.
    Project “C:\_working\Iowa\dot-net-wix\Complaint\ComplaintInSetup\setup.build” on node 1 (Build;PublishWebsite;Harvest t
    arget(s)).
    C:\_working\Iowa\dot-net-wix\Complaint\ComplaintInSetup\setup.build : error MSB4057: The target “Build” does not exist
    in the project.
    Done Building Project “C:\_working\Iowa\dot-net-wix\Complaint\ComplaintInSetup\setup.build” (Build;PublishWebsite;Harve
    st target(s)) — FAILED.

    Build FAILED.

    “C:\_working\Iowa\dot-net-wix\Complaint\ComplaintInSetup\setup.build” (Build;PublishWebsite;Harvest target) (1) ->
    C:\_working\Iowa\dot-net-wix\Complaint\ComplaintInSetup\setup.build : error MSB4057: The target “Build” does not exis
    t in the project.

    0 Warning(s)
    1 Error(s)

    Time Elapsed 00:00:00.04

    Reply
  41. Anthony Lopez

    Trying to figure out how to get my resource files under the bin directory to be included in the package. It’s getting compiled by msbuild, don’t know why its not making it into the package. for example bin\en\.resource.dll, bin\es\.resource.dll, etc. every other subdirectory in the web app is making it into the package (views, scripts, bin, etc).

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.