Visual studio is marking the debug folder as read only - visual-studio-2017

I have a c++ visual studio 2017 project, and every time I compile in debug mode the debug folder is marked as read-only. This force me to manually delete the debug folder in order to be able to recompile the project.
The project itself has a copy command in the post-build events to copy the .dll dependencies. This fails because of the read only setting that is changed automatically.
At the visual studio I have at home this is not happening and I have no clue of what is going on.

Related

MyProject.dll is not a valid win32 application

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?
Project properties the "Configuration Type" was mistakenly changed to .dll.

Exe file from a console project in Visual Studio?

I want to execute a C++ program in a second machine without any IDE.
I tried to launch the .exe file which is located in the debug folder of the project and to generate a .exe file following this guide.
Both .exe gave me the same errors (launched manually and from a prompt):
The program can’t start because
- VCRUNTIME140D.dll
- MSVCP140D.dll
- VCRUNTIME140_1D.dll
- ucrtbased.dll
is missing from your computer. [...]
So i try to uninstall and reinstall Microsoft Visual C++ Redistributable per Visual Studio 2015, 2017 e 2019 from there, but still the same errors.
What am I missing? How can I run it without install the whole Visual Studio IDE? Thanks for your time.
You need to compile your program to a Release exe file. Compiling your program using Debug will never work on any device unless it has Visual Studio installed on it.
Why this happens?
If you select debugging, before the program runs it loads some DLL files for debugging in visual studio. Now, on other machines visual studio may not be installed, so it couldn't find the DLL files so it will just not start. But Release, it is like its name, when you want to send your program to a friend or use it on another computer or share it on the internet, use Release. But if you are testing bugs and still working on the program, use Debug.

My Qt5 executable does not run outside of Visual Studio 2010

I have done a big project with Qt5 and visual Studio 2010. Everything is well inside of visual studio using the run button.
But my goal is of course to release it to other persons, without visual studio.
My problem is: I can't get the .exe run outside of visual studio. I was asked for several dll's at first, I found them all in the Qt5 bin folder.
But know I got rid of those messages, when I wan't to open my exe, nothing happens.
Just nothing.....
I cannot even find my exe in the windows task manager.
Does someone here know an answer to that issue?
There are dll files that are loaded during runtime and don't give you any error, warning or whatsoever when not present (also totally transparent to dependency walker). Such is the platforms\qwindows.dll - note that it must be in a platforms\ subfolder relative to the executable. You might also be missing libEGL.dll and libGLESv2.dll.
Dependency Walker is not very useful in this case as it shows very strange dll files missing: API-MS-WIN-CORE-PRIVATEPROFILE-L1-1-1.DLL etc.
You can use Qt5.x cmd prompt ( 5.x is the version that you are using) and run windeployqt.exe from your build directory. It will automatically find and copy all necessary dll files to your output directory.

visual studio attaching to a process in debug mode

i have a strange problem.
the dll that i built (lets call it my.dll) in c++ visual studio 2010 uses a third party library (say tp.lib) which in turn calls a third party dll (say tp.dll).
for debugging prupose i have in configurationProperties->debugging->command: Excel.exe
and configurationProperties->debugging->commandArguments: "$(TargetPath)"
in my computer i also set PATH variable to the directory where tp.dll resides
now when i hit the F5 in visual studio excel opens up with my.dll and crashes giving me a "cannot open in dos mode" error. the reason this happens is tp.dll is not deployed when debug version of my.dll is deployed.
when i open an instance of excel seperately and manually drop the debug version of my.dll then everything works fine and i can see all my functions that i wrote in my.dll
the only issue is now i do not know how to debug becuase i do not know how to attach visual studio to the instance of excel i opened up seperately.
my question is:
1> how can i attach visual studio to an already opened instance of Excel
or
2> how can i hit F5 and still make Excel pick up the required tp.dll from the directory specified in the PATH variable before it starts to deploy my.dll.
any of these two will allow my to step through the code for the purpose of debugging.
thanks in advance.
okay i figured out a way to do it by trial and error
1>build the debug dll.
2> open instance of excel and drop my.dll from the debug folder to it.
3> in visual studio 2010 : properties->configurationproperties->debugging->command = excel.exe
4>properties->configurationproperties->debugging->Attach = yes
and now you hit F5 in visual studio. this will attach the visual studio editor to the running copy of my.dll which will allow to to step through the code.
Unless you are using the Express edition you can attach visual studio to a running process.
I would copy tp.dll into the folder containing my.dll.

visual c++ program issue

I am using Microsoft Visual Studio 2010. When I am building my application in Debug mode, it is producing an EXE file (like it is supposed to be doing). But then (which is very surprising for me), when I change the mode from Debug to the Release mode, the compiler builds the application as a .DLL file?
I have only very recently started to use Visual Studio 2010, so don't know my way around it yet. How do I fix this so that when it is compiling in Release mode, to build the application as an .exe file ?
Set your project type to Windows Application.
In the IDE, right click on your project, and select Properties.
Configuration Properties->General->Configuration Type set to 'Application (.exe)'
In project options you should be able to choose whether you're building a .DLL or .EXE. I thought these were the same for all configurations, but you can check to see for yourself.