English 中文(简体)
包括所有依赖项
原标题:
  • 时间:2008-11-19 16:01:55
  •  标签:

I m just starting out with WiX as I need to be able to automate building an MSI on our CI server. Is there anyway to automatically include all the dependencies of a project?

最佳回答

The "proj" extension to heat.exe is getting better. Heat isn t quite ready to be used for production in an automated fashion. It s a very reasonable way to get the initial structure put together but doesn t quite do the right thing with repeated runs (for example, Component/@Guids aren t stable, yet...).

When the above issues are solved in heat.exe then incorporating it into your build process will certainly save all the trouble that people mention above. It s on our list to do better after the most egregious bugs are fixed in the core toolset.

问题回答

我也刚刚开始使用WIX,并采用了一种简单粗暴的方法自动添加引用。其思路是扫描要打包的项目输出文件夹中的所有.dll文件。

In pre-build of your WIX project, add

call "$(ProjectDir)GenerateDependency.bat" "$(SolutionDir)" "$(ProjectDir)Dependencies.wxs"

在你的WIX项目中添加一个GenerateDependency.bat文件

@echo off
set SOLUTIONDIR=%1
set OUTPUTFILE=%2
echo Starting Dependency check...
echo ^<?xml version="1.0" encoding="UTF-8"?^> > %OUTPUTFILE%
echo ^<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"^> >> %OUTPUTFILE%
echo   ^<Fragment^> >> %OUTPUTFILE%
echo     ^<ComponentGroup Id="MesDependance" Directory="INSTALLFOLDER"^> >> %OUTPUTFILE%

for %%F in (%SOLUTIONDIR%WixServiceInstallerExampleinDebug*.dll) do (
   echo "-- Adding %%~nxF" 
    echo       ^<Component Id="%%~nF"^> >> %OUTPUTFILE%
    echo                     ^<File  Id="%%~nF" Name="%%~nxF" Source="%%~dpnxF" Vital="yes" KeyPath="yes" DiskId="1"/^> >> %OUTPUTFILE%
    echo       ^</Component^> >> %OUTPUTFILE%
)
echo     ^</ComponentGroup^> >> %OUTPUTFILE%
echo   ^</Fragment^> >> %OUTPUTFILE%
echo ^</Wix^> >> %OUTPUTFILE%
echo Dependency check done.

根据您的需求修改“WixServiceInstallerExampleinDebug”文件。这应该是您想要打包的项目的输出文件夹。

注意:请注意VisualStudio经常会混乱编码。最好使用Notepad ++编辑此文件并确保它是ANSI格式,而不是UTF8格式。

This will generate a Dependencies.wxs that you can include in your project. If you are under source control, exclude it from it.

Each build will rescan .dll and rebuild the Dependencies.wxs before actually making the package.

Have a look at paraffin, from Wintellect.

In my experience, Wix is a still a very manual process. You have to add each dependency singly - I think the idea was that you would build the Wix installer at the same time you are building your project and add each item in as you are adding it in the code. This way it seems less daunting than having to go back and do a retrospect on the project. It certainly would be a great suggestion for an enhancement though!

I haven t seen something in WIX that can do that, you are supposed to know all the dependencies that your solution/project requires. Read this blog, inside is a quote:

Keep your source close and your dependencies closer (apologies Sun-tzu.)

The best way I found to make sure nothing was forgotten in the MSI, was to test the Installer on a clean installed virtual PC.

The closest I ve seen, for something you want is this guy s blog.

For now, we are stuck to do it by hand.

I just started with WIX and think that WixEdit(http://wixedit.sourceforge.net/) rocks for adding multiple files/dlls, solved my frustration with Wix of getting the files in easily. Just keep your files organized and then use the import folder function. Of course it doesnt support the new 3.0 recommendations of having one component per file.

Heat is good also and supports one component per file. Next on my list is to get some automation so these files are updated automatically a la visual studio.





相关问题
热门标签