The same wixproj file only works in VS 2012 IDE, but not in VS command prompt

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!

visual-studio-2010
msbuild
wix
msbuild-4.0
wix3.7
asked on Stack Overflow Feb 9, 2013 by laishiekai • edited Feb 9, 2013 by laishiekai

2 Answers

4

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.

answered on Stack Overflow Nov 15, 2013 by Thai Anh Duc
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.

answered on Stack Overflow Feb 9, 2013 by RinoTom

User contributions licensed under CC BY-SA 3.0