Visual Studio 2015 required executable runtime libraries

Once finished to develop your software final step is start to release the installation package. Executable generated by Visual Studio compiler require some additional libraries called runtimes allowing to software to run correctly. You have to provide these libraries in your installation package for allow your software to run in each machine without problems.



Easiest solution is to use the official package provided by Microsoft for install the full set of runtime libraries (you can download here version for 32 and 64 bit systems). You have to include in your installation package these installers and run it during your software installation process. This solution, however, have also some disadvantages. At first these runtime packages are quite big and will increase your total installation package size. For avoid this problem some installation tool download at runtime the required package (32 or 64 bit) and install it, but in this case you need a computer connected to Internet.

An alternative solution is to "manually" find each single runtime library required by your software and include them into installation package. This solution will have as advantage to decrease the total installation package size and simplify the installation process. The size will be minor since the official Microsoft installer install the complete set of runtime libraries but is very probably your software will not use all runtime functionalities as a result a lot of libraries will never be called. Method for check which runtime are used by your generated executable is to simply copy it in a Windows system just installed (you can use a virtual machine and install a newer system on it) and try to execute it. Windows will show an error message reporting the missing required dll library, just copy from the PC where you have Visual Studio installed this library (in the same folder where you copied the executable) and try to execute again the software. Usually this process is very short and once your software will execute correctly mean you'll have provided all the required runtime libraries in the same folder as explained before. With Visual Studio compiler before version 2015 the required runtime libraries are really few but from version 2015 and above a new way to manage runtimes has been introduced and can cause some little difficulties. In the beginning the process will work as expected. Once executed the software the first missing required library will be msvcp140.dll (remember this example is based to Visual Studio 2015, for next versions library file name will change), just copy it and go ahead. Problem will arrive when you just copied the api-ms-win-crt-runtime-l1-1-0.dll library file. This time Windows will show an error that is quite misleading as follow:

The procedure entry point ucrtbase.terminate could not be located in the dynamic link library api-ms-win-crt-runtime-l1-1-0.dll

From this message it seem the executable is not able to find some function exported by the api-ms-win-crt-runtime-l1-1-0.dll library. Usually, in similar case, this mean the version of the library is not correct and miss some specific functions required by the executable but since you copied this library from your original system, where the executable run without problem, can be quite strange. The true is that the executable is not looking for a function exported by the library but need an additional runtime library called ucrtbase.dll. Once copied it the error disappear and you can proceed in the same way. Just to save your time this is the basic list of runtime required by an executable generated by Visual Studio 2015 in x86 mode. If your software make use of some additional feature the list can be more long but the concept is the same:

api-ms-win-core-file-l1-2-0.dll
api-ms-win-core-file-l2-1-0.dll
api-ms-win-core-localization-l1-2-0.dll
api-ms-win-core-processthreads-l1-1-1.dll
api-ms-win-core-synch-l1-2-0.dll
api-ms-win-core-timezone-l1-1-0.dll
api-ms-win-crt-convert-l1-1-0.dll
api-ms-win-crt-environment-l1-1-0.dll
api-ms-win-crt-filesystem-l1-1-0.dll
api-ms-win-crt-heap-l1-1-0.dll
api-ms-win-crt-locale-l1-1-0.dll
api-ms-win-crt-math-l1-1-0.dll
api-ms-win-crt-multibyte-l1-1-0.dll
api-ms-win-crt-runtime-l1-1-0.dll
api-ms-win-crt-stdio-l1-1-0.dll
api-ms-win-crt-string-l1-1-0.dll
api-ms-win-crt-time-l1-1-0.dll
api-ms-win-crt-utility-l1-1-0.dll
msvcp140.dll
ucrtbase.dll
vcruntime140.dll

Hope this will help.

Comments

Popular posts from this blog

Access GPIO from Linux user space

Android: adb push and read-only file system error

Tree in SQL database: The Nested Set Model