Issue getting WixSharp working.

Apr 29, 2016 at 4:27 AM
Hi,

I am having trouble getting this simple WixSharp example to work.
  1. Here is what I did created a new console app.
  2. Then did a Install-Package WixSharp
So the errors I get when I build I get the error:

Error The command ""d:\Data\Ward\Documents\Visual Studio 2015\Projects\Wix3\Wix3\bin\Debug\Wix3.exe" "/MSBUILD:Wix3"" exited with code -532462766. Wix3

When I run it I get the error:

System.ApplicationException was unhandled
HResult=-2146232832
Message=Wix compiler/linker cannot be found
Source=WixSharp
StackTrace:
   at WixSharp.Compiler.Build(Project project, String path, OutputType type)
   at WixSharp.Compiler.Build(Project project, OutputType type)
   at WixSharp.Compiler.BuildMsi(Project project)
   at Wix3.Program.Main(String[] args) in d:\Data\Ward\Documents\Visual Studio 2015\Projects\Wix3\Wix3\Program.cs:line 50
   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()
InnerException:


This is strange if I look in the debug directory I see the files:

BootstrapperCore.dll
BootstrapperCore.xml
Microsoft.Deployment.WindowsInstaller.dll
Microsoft.Deployment.WindowsInstaller.xml
Wix3.exe
Wix3.exe.config
Wix3.pdb
Wix3.vshost.exe
Wix3.vshost.exe.config
Wix3.vshost.exe.manifest
WixSharp.dll
WixSharp.Msi.dll
WixSharp.Msi.xml
WixSharp.UI.dll
WixSharp.UI.xml
WixSharp.xml

So WixSharp is there - so any suggestions on how to make this work without any of the errors.

Here is all my code below.

Thanks,

Ward.
 using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

// Install-Package WixSharp

/*
Attempting to gather dependency information for package 'WixSharp.1.0.35.3' with respect to project 'Wix3', targeting '.NETFramework,Version=v4.5.2'
Attempting to resolve dependencies for package 'WixSharp.1.0.35.3' with DependencyBehavior 'Lowest'
Resolving actions to install package 'WixSharp.1.0.35.3'
Resolved actions to install package 'WixSharp.1.0.35.3'
Adding package 'WixSharp.bin.1.0.35.3' to folder 'd:\Data\Ward\documents\visual studio 2015\Projects\Wix3\packages'
Added package 'WixSharp.bin.1.0.35.3' to folder 'd:\Data\Ward\documents\visual studio 2015\Projects\Wix3\packages'
Added package 'WixSharp.bin.1.0.35.3' to 'packages.config'
Successfully installed 'WixSharp.bin 1.0.35.3' to Wix3
Adding package 'WixSharp.1.0.35.3' to folder 'd:\Data\Ward\documents\visual studio 2015\Projects\Wix3\packages'
Added package 'WixSharp.1.0.35.3' to folder 'd:\Data\Ward\documents\visual studio 2015\Projects\Wix3\packages'
Added package 'WixSharp.1.0.35.3' to 'packages.config'
Executing script file 'd:\Data\Ward\documents\visual studio 2015\Projects\Wix3\packages\WixSharp.1.0.35.3\tools\Install.ps1'
Successfully installed 'WixSharp 1.0.35.3' to Wix3
PM> 
*/

// Build Error:
// Severity Code    Description Project File    Line    Suppression State
//Error The command ""d:\Data\Ward\Documents\Visual Studio 2015\Projects\Wix3\Wix3\bin\Debug\Wix3.exe" "/MSBUILD:Wix3"" exited with code -532462766.    Wix3            


// D:\Data\Ward\Documents\Visual Studio 2015\Projects\Wix3\packages\WixSharp.bin.1.0.35.3\lib

using WixSharp;

namespace Wix3
{
    class Program
    {
        static void Main(string[] args)
        {
            WixSharp.Compiler.WixLocation = @"D:\Data\Ward\Documents\Visual Studio 2015\Projects\Wix3\Wix3\bin\Debug\";
            WixSharp.Compiler.WixSdkLocation = @"D:\Data\Ward\Documents\Visual Studio 2015\Projects\Wix3\Wix3\bin\Debug\";

            var project = new Project("MyProduct",
                  new Dir(@"%ProgramFiles%\My Company\My Product",
                      new File(@"test.txt")));

            project.GUID = new Guid("6f330b47-2577-43ad-9095-1861ba25889b");

            Compiler.BuildMsi(project); // <--- Exception here.
        }
    }
}
Coordinator
Apr 29, 2016 at 5:34 AM
It's not Wix# who is missing it is WiX:
Message=Wix compiler/linker cannot be found 
Most likely you don't have WiX present on your system or it is in unusual location.
After you bring WiX binaries Wix# will find them automatically (if they are in a well known location). Otherwise you can always set it explicitly from code:
WixSharp.Compiler.WixLocation = @"<local path>\Windows Installer XML v<your version>\bin";
Read more here this tutorial section:
Nov 22, 2016 at 7:29 AM
I am getting various Wix# errors even with the simplest example. About this method of setting the value of WixLocation..

I placed the files from WixSharp.1.0.44.0.7z on my box thusly:

C:\Program Files (x86)\WixSharp.1.0.44.0\ <- This contains cscs.exe, WixSharp.dll and other files as originally arranged in your download
C:\Program Files (x86)\WixSharp.1.0.44.0\Wix_bin <- This contains the bin, and SDK folders
C:\Program Files (x86)\WixSharp.1.0.44.0\Wix_bin\bin <- This contains the x86 folder and a 70 other files

I tried setting environment-var WIXSHARP_WIXDIR to "C:\Program Files (x86)\WixSharp.1.0.44.0\Wix_bin\bin"

And ran cscs.exe against the Setup.cs file, but it gives "ArgumentException: Illegal characters in path.."

I tried adding this line to Main within Setup.cs :
        WixSharp.Compiler.WixLocation = @"C:\Program Files (x86)\WixSharp.1.0.44.0\Wix_bin\bin";
But now I get: Error: Specified file could not be executed.
FileNotFoundException: .. assembly 'Microsoft.Deployment.WindowsInstaller, Version=3.0.0.0..
(although this file does exist in that Wix_bin\bin folder)

What is wrong? I am not able to get anything to build at all !