Click or drag to resize
Deploying extensions with references

If your extension has references to another file (e.g. a library with common functions), then you must deploy this file along with the extension DLL. You can edit support files to add dependent component in the CAB file.

To deploy an extension that has references to another file:

  1. Create a new file named CustomComponents.wxs (shown below) in the Visual Studio project folder with any text editor.
CustomComponents.wxs
<?xml version="1.0" encoding="utf-8" ?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">        
    <?include Confix.wxi ?>
    <Fragment>
      <DirectoryRef Id="INSTALLLOCATION">
      <!-- Define components to include into the installation package. -->
        <Component Id="FileName.dll" Guid="PUT-GUID-HERE">
          <File
            Id="FileName.dll"
            Source="FileName.dll"
            Assembly=".net"
            AssemblyApplication="FileName.dll"
            AssemblyManifest="FileName.dll"
            KeyPath="yes"/>
        </Component>
      </DirectoryRef>
      <ComponentGroup Id="CustomComponents">
        <ComponentRef Id="FileName.dll"/>
      </ComponentGroup>
    </Fragment>
</Wix>
  1. Replace the text PUT-GUID-HERE with a newly-generated GUID. Replace the text FileName.dll with the name of the dependent file.
  2. Create a new Windows batch file named BuildCab.bat (an example shown below) in the Visual Studio project folder with any text editor.
BuildCab.bat
@echo on

SET TARGETDIR=%1
rem *** Strip leading and trailing double quotes.
SET TARGETDIR=%TARGETDIR:"=%

SET SUPPORTDIR=%TARGETDIR%Package\Support\

pushd %~dp0

rem *** Prepare to build CAB: create support files to customize.
"%BCMNETSDK%\Deployment\Extension\PackageBuilder.exe" "%TARGETDIR%ExtensionFileName.dll" -nobuild
if not %ERRORLEVEL%==0 goto exit

rem *** Copy the customized WIX file.
xcopy /y "CustomComponents.wxs" "%SUPPORTDIR%"
if not %ERRORLEVEL%==0 goto exit

rem *** Copy dependencies.
xcopy /y "%TARGETDIR%*.dll" "%SUPPORTDIR%"
if not %ERRORLEVEL%==0 goto exit

popd

rem *** Build CAB.
call "%SUPPORTDIR%Build.bat"

:exit
if not %ERRORLEVEL%==0 EXIT %ERRORLEVEL%
  1. Replace the text ExtensionFileName.dll with the name of the extension file to be deployed.
  2. Edit the post-build event of the Visual Studio project to run the batch file. Following is an example expression.
Visual Studio post-build event expression
call "$(ProjectDir)BuildCab.bat" "$(TargetDir)"
See Also