0

I am trying the steps on this page. I have installed the wix binaries in a folder on my local machine.

So I got a wix installer project created by wix VS 2010 plugin. I can use the VS 2010 IDE to build it and generate the msi file, but I cannot do the same thing with Msbuild in the VS command prompt. When Msbuild try to compile, there is an error complaining the candle.exe cannot be found:

Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'file:///C:\MyFolder\Wix\candle.exe' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515) ---> System.NotSupportedException: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.

I am pretty sure the exe is at the right place because VS IDE can find it. I would like to know what am I missing for Msbuild?

Thank you!

laishiekai
  • 841
  • 1
  • 13
  • 26

2 Answers2

6

I found answer from here: http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Error-in-candle-during-build-td7385947.html. Before unzip the binaries, right click on the zip file, select property and choose Unblock from the first tab. Then you unzip it as normal.

Thai Anh Duc
  • 524
  • 6
  • 12
1

As per the page provided by you, the path entered in the lines of code will help the MSBuild script to identify the WIX binaries.

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

The important quote here goes like:

WixTargetsPath property value must be relative to the .wixproj project file that uses it. The WixTasksPath property is used inside wix.targets to load WixTasks.dll

The paths should be specified properly according to the folders where you unzipped your files. Otherwise there is a chance for this error to happen. Then also the project will be running fine from VS2010 since that is reffering the WIX binaries from the installed location of WIX. But, MSBuild will refer the values you provide in the above lines of code.

So, can you please provide values you are giving for WixToolPath, WixTargetsPath and WixTasksPath. As well the path to where you are unzipping the wix36-binaries.zip or wix37-binaries.zip.

These information may help in solving this issue and accordingly I will correct this answer as well.

RinoTom
  • 2,278
  • 2
  • 26
  • 40
  • Thanks for the effort, but I am pretty sure it's the same path. Plus, I only have one version of Wix binaries installed. And from the output window of the VS 2010, I know those exe (heat, candle, and light) works. The same wixproj file works in VS 2010, but not with Msbuild. How weird! – laishiekai Feb 11 '13 at 21:33
  • Any news on this one? I had the same issue. The weird thing is that it worked and then suddenly i did not work any more. I got issue when clicking build from VS2010 – Thai Anh Duc Nov 15 '13 at 03:06