I created an application in VS 2008 Express as an MFC app just to take advantage of the easy GUI creation. I might re-do this app in pure win32 since no other MFC classes are used (just a button and a text box, the button fires off the main program, all win32). My only question that determines whether I stay in MFC or port it over to pure win32 is this:
How difficult is it to deploy an MFC app? What do I need to do (in VS 2008) to make sure it works on another machine?
Statically link MFC and it's just another .exe.
You can just give that to the user or create an installer with either the microsoft .msi tool or a regular setup.exe with something like innosetup.
Edit - the error message in your comment is about another dll that is part of a 3rd party library. You can't (easily) take a DLL and incorporate it into your app. the licensing may also require you to ship their DLL as a separate lib.
You can use Visual Studio Merge modules. These can be added while building the installer.
Merge modules provide all the dlls, files required to run your application.
Related
I am debugging a Windows application on Visual Studio 2017 because my Azure Kinect application freezes after 20-30minutes of use. When I "pause" the debugger and check the call stack, I can see that the main thread is waiting for an operation happening on a separate thread. This second thread is executing a method defined by k4a.dll.
I have three versions of this dll on my operating system, and I am not sure which one my application is using. Is there any way I can extract the path to the library (dll) from Visual Studio?
(Notice: I am not looking for answers that tell me to use tools like PE-Explorer or Depends. I want that information coming from Visual Studio as it could be finding another library in its scan path)
Turns out you just need to right-click the Call Stack window over the library name and select Go To Module.
A new window will pop-up with a path to all the libraries your application is using...
Modules window with the path for each library:
I am trying to create windows store build using Visual studio 17 with Universal Windows App Development tool.
When I create a build from unity, it creates a visual studio solution but finishes with a lot of errors.
When I try to build the resulting visual studio solution, it fails to generate a build.
I am attaching related settings and build outputs screenshot in sequence that I encounter them.
My unity build settings
Unity console errors on Build complete
Vs error on opening/building VS solution output
Can anybody help with this UWA tool. I am trying this for the first time.
It is because Unity .Net version and UWP .NET are not the same. They have much in common and also some differences.
For instance, you can build and import in VS. Then you have async/await available which are not in Unity.
For your case, here's an excerpt from there : https://msdn.microsoft.com/en-us/library/mt185488.aspx
"This topic displays the types in the System.Security and
System.Security.Principal namespaces that are included in .NET for UWP
apps. Note that .NET for UWP apps does not include all the members of
each type. For information about individual types, see the linked
topics. The documentation for a type indicates which members are
included in .NET for UWP apps."
I'm using VS2010. I have an unmanaged EXE written in C++ that's using a .NET COM component which is also part of the same solution. I know that the COM object was created successfully because CoCreateInstance returned without an error. Yet, the component symbols aren't loaded (I can also notice that by not being able to create breakpoints in the .NET project source files), so I can't step into the code of the object's methods.
I tried to copy the .NET DLL's PDB into the same output directory of the EXE and it also didn't help. All projects in the solution are x64 and Debugging mode is set to Mixed.
If that matters, the DLL was registered using the command regasm /codebase
Any ideas? Thanks.
Yes, you have to enable managed debugging. One problem with Visual Studio (at least 2008 and 2010 -- don't know about later versions) is that you can only debug Native and Managed code at the same time with 32-bit processes. With 64-bit processes, you have to debug one type or the other, but not both at the same time. I suppose you might be able to spin up another instance of Visual Studio and debug the Native with one instance and Managed with the other.
Under your project settings, go to the "Configuration Properties" - "Debugging" page. On the right go over to Debugger Type and select Mixed.
I created a client server application in C++ using Visual Studio.
Now I want to run the client EXE file on another computer (which doesn't have Visual Studio installed),
but when I try run the EXE file, it gives the following error message:
This application has failed to start because the application
configuration is incorrect. Reinstalling the application may fix this
problem.
How can I run the EXE file without installing anything on the computer?
Applications built with Visual Studio depend on Visual C++ Redistibutable (VCRedist). When the program is being linked dynamically, then your binaries will need
MSVCR**.dll (Microsoft C Runtime Library).
On MSDN, there is a nice article called Redistributing Visual C++ Files (for Visual Studio 2008), that states that there are Potential run-time errors in case that required Visual C++ library is not installed:
you may get one of the following error messages depending on the version of Windows on which you try to run your application:
The application failed to initialize properly (0xc0000135).
This application has failed to start because the application configuration is incorrect. Reinstalling application may fix this problem.
The system cannot execute the specified program.
Basically you have two options:
The simplest possible solution is to change the dynamic linking of runtime libraries to static linking. Go to project properties and under C/C++ → Code Generation you will find Runtime Library option. You need to change it from Multi-threaded DLL (/MD) to Multi-threaded (/MT).
Another possible solution is to make sure that the right version of Microsoft VC++ Redistributable Package is installed on the target machine.
But your application might depend on other DLL files as well. In case you want to find out what are the dependencies of your program, there is a great utility called Dependency Walker that will help you in this and many other situations :)
Background:
C++ applications need run-time assemblies (DLL files) to run in any Windows computer.
Normally these run-time assemblies are located at C:\Windows\Winsxs directory.
All the Windows operating systems by default comes with several run time assemblies.
But if your application is developed in a newer version of the run-time assembly environment, the target computer also needs the same version of the run time to exist there.
When you're installing Visual Studio, most newer versions of the run-time assemblies comes to your computer.
Solution:
Finally by anyway the target computer should have the exact run time assemblies. There are a few ways to do this (for more details search each in Google).
Statically link run-time assemblies with your application (troublesome for large application).
Install the C++ redistribution environment on the target computer (the easiest way).
Creating a setup project to deploy the run-time on the target computer when installing the application (not bad).
For deploying run-time assemblies as private assemblies (professional), see here for more details
Conditions:
You must not use .NET framework in your application.
You must not use the common language run-time support for your application
I deployed my program in release instead of debug, and the EXE file now works on the other computer.
I haven't seen that specific error before. Usually it's an error around a missing DLL (Windows redistributable). Assuming there isn't actually a problem with the configuration, you have two choices:
Change the compile mode from Multithreaded DLL to Multithreaded. This can be done from the C++ section of project properties under code generation. In multithreaded mode your binary will be statically linked against the Windows redistributable. This is probably what you want.
Install the Windows redistributable on the target machine. This probably isn't OK, because you state that you don't want to install anything on the target machine.
A warning about option 1: Different versions of Windows have different versions of the redistributable. It's possible to encounter a highly specialized environment in which a statically linked program will not behave as expected.
It look like you're missing some DLL files. Be sure to copy appropriate DLL files along with EXE file.
I am running Visual Studio 2019 and I found a very helpful configuration property to address the problem of moving a simple application to another computer without an installation package.
Open the project Property Pages.
Choose which configurations this change should apply to, I used “All Configurations”.
In the left-hand window click to expand the top node called “Configuration Properties”.
Click on "Advanced". In the right-hand window look for the property called “Copy C++ Runtime to OutDir” and set that to “yes”.
Click OK to close the Properties window.
Rebuild your project. All the necessary dlls will be copied to the project’s output directory. Copy your exe and all dlls to another computer. The exe should find everything it needs to run.
we have once application build using MFC/C++. We want make the bit rich UI like VS 2010 or outlook etc... at last we want give new look to our app like Microsoft does on every release of their products.
Please suggest me to topic that i need to look into or suggest me the option for the same.
If you're using Visual Studio 2010 or higher, the MFC application wizard itself will generate UI like VS 2010 with tabs and docking windows. In fact you can create an application that looks like VS 2010 without writing a single line of code. There is also support for the ribbon control which has replaced the menus in the new office applications.
As I am assuming you are going to use C++/native code, MFC is still the way to go or you can choose the WTL also. If you are ready yo go to a totally different direction then QT is one of the most advanced and modern cross platform library. MFC feels old compared to QT. AFAIK you can not use ribbon control in QT without microsoft license.
Another option is to go to managed way, you can use WPF with C#.
As already mentioned, you can use the new classes in the MFC feature pack, which came with Visual Studio 2008 Service Pack 1.
MSDN provided a tutorial how to migrate an old MFC application to the new MFC feature pack classes here: http://msdn.microsoft.com/en-us/library/bb983935%28v=vs.90%29.aspx