I just using Wix 3.5 with Visual Studio 2010, Windows 7. I unable to make a custom Preprocessor Extension
run. I create the extension project in .NET 3.5. and copy the compiled dll into Wix 3.5 program files, plus set the Reference Path in the extension project properties but the Wix project build still failed with "undefined preprocessor function" on my extension.
Example: Extension project: WixFileVersionExtension (from wixfileversionext.codeplex.com) Wix program files: "C:\Program Files\Windows Installer XML v3.5\bin"
Am I missing something? Google can't answer me.
Update: This is a bug and has been reported here http://sourceforge.net/tracker/?func=detail&atid=642714&aid=3212304&group_id=105970
Update: Do not use Reference Path in the VS project property as stated here http://wix.sourceforge.net/manual-wix3/votive_property_pages.htm The Reference Paths section allows you to define paths you want to use when locating references (WiX extensions and WiX libraries)
or copy the extension dll into Wix folder as stated here http://wix.sourceforge.net/manual-wix3/extension_development_intro.htm Placed next to WiX EXEs along with all other WiX extension DLLs
The Solution is: Add Reference and Browse the extension dll file INSTEAD OF Add Reference by Project even if you have those projects in one solution. If you want to follow the Configuration, Debug or Release, unload the Wix project, edit the .wixproj file and change the ..\WixExtension\bin\Debug\WixExtension.dll
to ..\WixExtension\bin\$(Configuration)\WixExtension.dll
so it will become like this:
<ItemGroup>
<WixExtension Include="WixExtension">
<HintPath>..\WixExtension\bin\$(Configuration)\WixExtension.dll</HintPath>
<Name>WixExtension</Name>
</WixExtension>
</ItemGroup>
Note: Wix Visual Studio project will only assume it is Wix Extension whenever you Add Reference by dll file (Browse) and also only assume it is an application to be included in the installer whenever you Add Reference by Project.
You need to add a reference to the actual extension assembly (.dll) so that Candle.exe loads it. The command-line equivalent is -ext.
来源:https://stackoverflow.com/questions/5296179/wix-3-5-preprocessor-extension-undefined-preprocessor-function