我正在尝试为我的应用程序创建一个 msi。
我使用以下命令传递客户端和版本参数:
C:\我的客户\nant -D:client=abc -D:version=1.0
我收到以下错误消息:
**
[msi] Building Installer Database 'C:\irx-client\irxclient.msi'.
[msi] Adding Properties:
[msi] ProductName
[msi] ProductVersion
[msi] Manufacturer
[msi] ProductCode
[msi] UpgradeCode
[msi] ALLUSERS
[msi] TARGETDIR
[msi] Adding Directories:
[msi] client
[msi] bitmaps
[msi] icsrun552
[msi] nls
[msi] reports
[msi] Compressing Files...
[exec] Starting 'cabarc (-r N C:\my-client\target\myclient.cab *)' in 'C:\Documents and Settings\user123\Local Settings\Temp\tmp12AE.tmp' BUILD FAILED
**
但是,我可以成功手动运行以下命令:
C:\my-client\target\cabarc -r -p n myclient.cab *.*
我已经安装了 cabarc.exe、nantcontrib 和 microsoft platform sdk,并将它们包含在 PATH 变量中。
请告诉我在这里做错了什么。
nant 脚本总结:
- 将文件复制到 \target\appname-version\
- 创建包含 \target\appname-version\ 下所有文件和文件夹的 msi
<?xml version="1.0"?> <project name="my client" default="msi-package"> <!-- import the extra libraries --> <loadtasks assembly="${path::combine(environment::get-variable('NANT_HOME'),'contrib/bin/NAnt.Contrib.Tasks.dll')}"/> <!--******************************************************************** Initialize all the required variables ************************************************************************--> <property name="source-core" value="./src/core" /> <property name="client" value="client" overwrite="false"/> <property name="version" value="3.3.9.7.6" overwrite="false"/> <property name="client-target" value="./target/appname-version" /> <property name="source-bank" value="./src/${client}"/> <property name="ProductName" value="appname" /> <property name="ProductVersion" value="${version}"/> <property name="ProductManufacturer" value="manufacturer Inc"/> <echo message="${client}"/> <echo message="${version}"/> <!--******************************************************************** Delete 'target' folder if it exists and create a new empty target folder. ************************************************************************--> <target name="clean"> <delete dir="./target" /> </target> <target name="prepare" depends="clean"> <mkdir dir="target" /> <property name="target" value="./target" /> </target> <!--************************************************************************************** Copy files from /src/core and /src/client to target/appname-version ****************************************************************************************--> <target name="copy-core" depends="prepare"> <copy todir="${client-target}"> <fileset basedir="${source-core}"> <include name="**/*.*" /> </fileset> </copy> </target> <target name="copy-bank" depends="copy-core"> <copy todir="${client-target}" overwrite="true"> <fileset basedir="${source-bank}"> <include name="**/*.bmp"/> <include name="**/*.exe"/> <include name="**/*.icx"/> <include name="**/*.img"/> <include name="**/*.ini"/> <include name="**/*.txt"/> <include name="**/nls/*.*"/> <include name="**/Reports/*.*"/> </fileset> </copy> </target> <!--************************************************************************************** msi part should go in this section *****************************************************************************************--> <target name="msi-package" depends="copy-bank"> <!--this section calls the cabarc.exe which has been installed and the PATH environment variable has been edited to include the exe--> <setenv> <variable name="PATH" path="C:\Program Files\NAnt\bin\;%PATH%" /> </setenv> <msi sourcedir="C:\my-client\target" output="C:\my-client\myclient.msi" verbose="true" debug="true"> <properties> <property name="ProductName" value="appname" /> <property name="ProductVersion" value="${version}"/> <property name="Manufacturer" value="mamufacturer Inc."/> <property name="ProductCode" value="{}" /> <property name="UpgradeCode" value="{}" /> <property name="ALLUSERS" value="2" /> <property name="TARGETDIR" value="C:\appname-version" /> </properties> <directories> <directory name="C_CLIENT" foldername="client" root="TARGETDIR"/> <directory name="C_BITMAP" foldername="bitmaps" root="TARGETDIR"/> <directory name="C_ICSRUN" foldername="icsrun552" root="TARGETDIR" /> <directory name="C_NLS" foldername="nls" root="TARGETDIR" /> <directory name="C_RPTS" foldername="reports" root="TARGETDIR" /> </directories> </msi> </target> </project>