Comment certaines applications sont-elles capables de simplement décompresser et exécuter sur Windows PCS sans problèmes SXS?

StackOverflow https://stackoverflow.com/questions/6031066

Question

C'est une plainte commune de certains groupes que l'installation de Windows diffuse des trucs sur tout le système de fichiers et du registre, et certaines applications fournissent la possibilité de simplement décompresser les fichiers afin que vous puissiez "désinstaller" simplement supprimer.Mais comment évitent-ils toute la laideur de Visual C ++ Redist, côte à côte (SXS), etc.

J'ai un peu d'utilité et je préférerais vraiment distribuer juste une seule .exe qui est exécuté - aucun programme d'installation du tout ou même décompressant car il est petit.Est-ce réalisable?

edit: Comme suggéré, j'ai essayé de bâtir avec une dépendance statique sur les temps de course (/ MT au lieu de / MD).J'ai eu ce qui suit (partie médiane tronquée pour la clarté):

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

Était-ce utile?

La solution

You can distribute a single EXE if you statically link to the VC runtime - on the project's Property Page -> Configuration Properties -> C/C++ -> Code Generation and set "Runtime Library" to a "non-dll" option.

Depending on your target audience, distributing as a .exe may be problematic as .exe files are sometimes blocked from downloading in corporate environments, so providing a .zip file as well is advisable.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top