您的位置:首页 > 其它

VC2005下如何发布自己的程序。

2007-06-18 10:19 429 查看
[align=left]VC2005下如何发布自己的程序。[/align]
[align=left] [/align]
[align=left]作者:workingroy[/align]
[align=left]2006-11-14[/align]
[align=left]workingroy@gmail.com[/align]
[align=left][/align]
[align=left]翻译自一篇文章:[/align]
[align=left] [/align]
[align=left]在MSDN的BLOG里看到一片文章,VC2005下讲的是如何发布自己的程序,使得没有安装VS2005的用户使用你开发的程序时不会因找不到必要的动态库而无法使用。[/align]
[align=left]原文:Running C++ application built by VC++ Express on another computer [/align]
[align=left]地址:http://blogs.msdn.com/nikolad/archive/2005/09/02/460368.aspx[/align]
[align=left] [/align]
[align=left]直接翻译重要的部分:[/align]
[align=left] 我将演示一个人怎么样使用MSMs在其他电脑上安装VC++ DLLs,我自己的电脑上已经安装了VC++ Express,并且我期望它能在其他没有安装VC++ Express的电脑上运行,我会这样做:[/align]
[align=left] 1。我从sourceforge.net下载WIX,这里是连接http://sourceforge.net/projects/wix。我会从这里下载我要使用的:http://prdownloads.sourceforge.net/wix/binaries-2.0.3220.0.zip?download。 但你可能会使用WiX的其他版本,可能是比我这个新的或者更老的版本。[/align]
[align=left] 2。我将会把这个包解压缩到 D:/WiX/ [/align]
[align=left] 3。现在我将要打开Visual Studio 2005的命令提示行(开始-程序-Visual C++ 2005 Express Edition>Visual Studio Tools>Visual Studio 2005 Command Prompt)[/align]
[align=left] 4。我输入uuidgen –n2 ,回车。这样就为我产生了2个UUIDs,在后面的第6步我将会用到。[/align]
[align=left] 5。现在我将要在D:/WiX创建2个XML文件,第一个是VCCRT.wxi, 第二个是VCCRT.wxs.[/align]
[align=left] 6。首先我用以下内容创建了D:/WIX/VCCRT.wxi :[/align]
[align=left] 我在第4步用uuidgen.exe为我产生了2个UUIDs来定义PRODUCT_ID 和 PACKAGE_ID。目的是为了让本人的读者避免和其他人使用相同的的UUID,因为我没有为我列出已经产生的UUID。[/align]


<Include>


<?define PRODUCT_ID=!!!! REPLACE WITH UUID1 FROM STEP 4 !!!! ?>


<?define PACKAGE_ID=!!!! REPLACE WITH UUID2 FROM STEP 4 !!!! ?>


</Include>

7。然后我用以下内容创建D:/WIX/VCCRT.wxs:


<?xml version='1.0'?>


<?include $(sys.SOURCEFILEDIR)VCCRT.wxi ?>


<Wix xmlns='http://schemas.microsoft.com/wix/2003/01/wi'>


<Product


Name='MSI to redistribute my app'


Language='1033' Version='1.0.0.0' Manufacturer='Me'>


<Package


Description='MSI to redistribute my app'


Comments='MSI to redistribute my app'


Manufacturer='Me'


InstallerVersion='300'


Compressed='yes' />


<Media Cabinet='VCCRT.cab' EmbedCab='yes' />


<Directory >


<Merge Language='0' src='D:Program FilesCommon FilesMerge Modulesmicrosoft_vc80_crt_x86.msm' DiskId='1' />


<Merge Policy' Language='0' src='d:Program FilesCommon FilesMerge Modulespolicy_8_0_Microsoft_VC80_CRT_x86.msm' DiskId='1' />


</Directory>


<Feature Title='CRT WinSXS' Level='1'>


<MergeRef />


<MergeRef Policy' />


</Feature>


<InstallExecuteSequence>


<RemoveRegistryValues/>


<RemoveFiles/>


<InstallFiles/>


<WriteRegistryValues/>


</InstallExecuteSequence>


</Product>


</Wix>

[align=left] 8。现在我将要回到命令行,改变当前路径,编译并链接MSI[/align]
[align=left]------------------------------------------------------------------------------------- [/align]
[align=left]a. >cd d:/WiX [/align]
[align=left]b. >candle.exe vccrt.wxs -out vccrt.wixobj [/align]
[align=left]c. >light.exe vccrt.wixobj -out vccrt.msi[/align]
[align=left]-------------------------------------------------------------------------------------[/align]
[align=left] 9。这样MSI就被创建了,它应该是这个文件D:/WiX/vccrt.msi.如果你遇见错误,关注后面的疑难解答章节。[/align]
[align=left] 10。现在我拷贝我的程序和vccrt.msi到其他我想这个程序能运行而又没有安装 VC++ Express 的电脑上,拷贝完后,我会先运行vccrt.msi再运行我的EXE程序。[/align]
[align=left] 11。好了,现在我的程序运行很正常。如果你的程序在MSI已经安装完成后不能启动,请关注后面的疑难解答章节。 [/align]
[align=left] [/align]
[align=left]==================================================================================================[/align]
[align=left] [/align]
[align=left]疑难解答(这个我就不翻译了,自己看吧[/align]
[align=left] [/align]

Error message CNDL0054 from candle.exe

[align=left]candle.exe : error CNDL0054 : The document element name 'Include' is invalid. A WiX source file must use 'Wix' as the document element name.[/align]
[align=left]Cause: you have tried executing >candle.exe vccrt.wxi -out vccrt.wixobj instead of >candle.exe vccrt.wxs -out vccrt.wixobj[/align]

Error message CNDL0009 from candle.exe

[align=left]D:/WiX/vccrt.wxs(6) : error CNDL0009 : The Product/@Id attribute's value, '!!!! REPLACE WITH UUID FROM STEP 4 !!!! ', is not a legal guid value.[/align]
[align=left]D:/WiX/vccrt.wxs(10) : error CNDL0009 : The Package/@Id attribute's value, '!!!! REPLACE WITH UUID FROM STEP 4 !!!!', is not a legal guid value.[/align]
[align=left]Cause: Edit vccrt.wxi and replace !!!! REPLACE WITH UUID FROM STEP 4 !!!! with UUID generated in Step 4[/align]
[align=left] [/align]

Error Message CNDLXXXX from candle.exe

[align=left]Cause: No idea, mistake happen when you copy/pasted XML from this post. See WiX documentation for troubleshooting.[/align]

Error on start of application either a message box that says "This application has failed to start because the application configuration is incorrect" or "The system cannot execute the specified program"

[align=left] [/align]
[align=left]Cause: First, check that your application is built in Release mode. If it was Debug application, you will see OS errors that let you know that either msvcm80d.dll or msvcr80d.dll is not loaded. Second, check if you have deployed all Dependencies of this application. Use depends.exe to see dependencies of an application[/align]

Error message box while starting your application that says "To run this application you first must install .Net Framework of version v.2.0.xxxx".

[align=left] [/align]
[align=left]Cause: You application contains managed code and depends on presence of .Net Framework. For C++ applications it means that it has been compiled as /clr, /clr:pure or /clr:safe. You have install .Net Framework. [/align]
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: