-3

I have copied a C++ solution folder written with visual studio 2013 to my Pc and tried to run it (I mean VS Debugging) with VS 2022. the solution Contains 5 projects but I just target one of them so unloaded the rest and set the one as Startup project and this error happened. Error Image

Solution file is working well on first pc and project is not a win32 project its x64 (I don't know much from win32 or x64).

Unable to start program. [VALUE].dll is not a valid Win32 application error in Visual Studio 2017

According to this question I tried selecting project, setting as startup, repairing VS, installing vcredist_x64 but non helped.

After Running, VS make Debug folder in solution Directory not the project "LP_Dll\x64\Debug" (LP_Dll is the solution name) without any .exe file, and the error path is exactly this folder, can it be from that?

AmirHossein
  • 3
  • 1
  • 7
  • 2
    A library => DLL cannot be started. You need an executable => EXE. Is there any project in your solution with a `main()` function? – RoQuOTriX Jul 20 '22 at 08:42
  • @RoQuOTriX So what this error mean? ,yes the main project that we are speaking about. actually VS makes Debug folder in solution directory not in project directory, cant it be from that? – AmirHossein Jul 20 '22 at 10:11
  • Apparently whatever you set as startup project is configured to create a library, not an executable. We can't provide more help than that – UnholySheep Jul 20 '22 at 13:12
  • Please check if the properties are set to generate .exe instead .dll. – Minxin Yu - MSFT Jul 21 '22 at 02:11
  • Any undate? Can you share a minimal example through github? – Minxin Yu - MSFT Jul 22 '22 at 06:36
  • @MinxinYu-MSFT I found the problem and fixed it, in Project properties the "Configuration Type" was set as dynamic library .dll and changed it to .exe this problem is fixed and thank you but i have another problem in running it on another pc **the code execution cannot proceed because msvcr120d.dll was not found ** and after installing it [Error Link](https://stackoverflow.com/questions/10492037/the-application-was-unable-to-start-correctly-0xc000007b) this error happens. do you have any experience on moving projects? (msvcr100.dll is in project directory but the error wants msvcr120d.dll) – AmirHossein Jul 23 '22 at 07:30
  • @MinxinYu-MSFT I tried it on two different devices and the same happened. – AmirHossein Jul 23 '22 at 07:37
  • @MinxinYu-MSFT I also Tried Installing all VCredist versions installed on first Pc but the problem is still on. – AmirHossein Jul 23 '22 at 08:08
  • Try putting msvcr120d.dll in the same directory as the exe. – Minxin Yu - MSFT Jul 25 '22 at 01:25

1 Answers1

0

Project properties the "Configuration Type" was mistakenly changed to .dll.

Minxin Yu - MSFT
  • 2,234
  • 1
  • 3
  • 14
  • Since I was the first one to point out the mistake in the comments, I took the liberty of posting an answer. Missing dlls on other devices belong to the anohter problem. One post should focus on one question,please consider posting a new thread. – Minxin Yu - MSFT Jul 25 '22 at 02:25
  • Actually no need to do that with the help of **Dependency Walker** I realized that one .dll file on my system (System32 Folder) was for x86 CPU and I downloaded x64 one and the problem was fixed. – AmirHossein Jul 26 '22 at 05:34