[英]How are some apps able to simply unzip and run on Windows PCs without SxS problems?
这是某些组织的普遍抱怨,即在Windows上安装会在整个文件系统和注册表中传播内容,并且某些应用程序提供了仅将文件解压缩的选项,因此您可以“卸载”即可删除。 但是他们如何避免Visual C ++ Redist,Side-by-Side(SxS)等的所有丑陋之处?
我有一个小工具,实际上我更喜欢分发一个运行的.EXE,因为它很小,所以根本没有安装程序,甚至没有解压缩。 这可行吗?
编辑:按照建议,我尝试对运行时(/ MT而不是/ MD)进行静态依赖的构建。 我得到以下内容(为了清楚起见,中间部分被截断了):
1>Linking...
1>MSVCRT.lib(MSVCR90.dll) : error LNK2005: _free already defined in LIBCMT.lib(free.obj)
1>MSVCRT.lib(MSVCR90.dll) : error LNK2005: _malloc already defined in LIBCMT.lib(malloc.obj)
1>MSVCRT.lib(MSVCR90.dll) : error LNK2005: __mbschr already defined in LIBCMT.lib(mbschr.obj)
1>MSVCRT.lib(MSVCR90.dll) : error LNK2005: _realloc already defined in LIBCMT.lib(realloc.obj)
1>MSVCRT.lib(MSVCR90.dll) : error LNK2005: __strdup already defined in LIBCMT.lib(strdup.obj)
1>MSVCRT.lib(MSVCR90.dll) : error LNK2005: _abort already defined in LIBCMT.lib(abort.obj)
1>MSVCRT.lib(MSVCR90.dll) : error LNK2005: __stricmp already defined in LIBCMT.lib(stricmp.obj)
1>MSVCRT.lib(MSVCR90.dll) : error LNK2005: _setlocale already defined in LIBCMT.lib(setlocal.obj)
1>MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info@@AAE@ABV0@@Z) already defined in LIBCMT.lib(typinfo.obj)
1>MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: class type_info & __thiscall type_info::operator=(class type_info const &)" (??4type_info@@AAEAAV0@ABV0@@Z) already defined in LIBCMT.lib(typinfo.obj)
1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
如果静态链接到VC运行时,则可以分发单个EXE-在项目的属性页->配置属性-> C / C ++->代码生成并将“运行时库”设置为“非dll”选项。
根据您的目标受众,由于.exe文件有时在公司环境中无法下载,因此,作为.exe分发可能会出现问题,因此也建议提供.zip文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.