Visual Studio Application dependency - c++

I am making application in Visual Studio C++ 2010 Express Edition.
After I compile the program and then copy the .exe to my friend computer, but when I want to run it, the computer tell me that .NET Framework is needed.
Previously I work with MinGW and it's only console application, when I copy to another computer the program need "libgcc_s_dw2-1.dll" so I just copy that file and it's work.
But when I make the Windows Form Application or Console Application the program need the .NET Framework.
My question is, do my friend have to install the .NET Framework to run my application or I only need to copy one or several files to fulfill my application dependencies?

You need to install the .NET Framework and I suspect the C++ Runtime & Redistributable as well. For any recent system (Windows Vista or newer) you'll find that these are prerequisites of the operating system and that they're almost certainly installed (.NET Framework 3.0 or better). Windows XP shipped with an old version of .NET and would require you to install the newer version of the Framework (Windows Update pushes the framework by default, unless you suppress the installation).
Which version of the framework shipped with which version of Windows can be found here.
There are 3rd party commercial solutions available that can link the whole .NET framework dependency into your application. Salamander .NET Linker is one and the Spoon.NET platform (previously Xenocode) is another. There might be others, but these are the ones I've seen used in the past.

Related

Build UWP apps using Ninja?

Can we use ninja to build UWP apps and hence create the appx package for the same?
I don't feel there is an online article for the same. I know how to do it using VS and Make.
In theory: Yes
Notable one thing: Ninja just official support C++, I can't find any result Ninja support other programming languages
With C++ we have 2 options:
C++/CX: You should activate flag /ZW for Windows Metadata
C++/WinRT: With WinRT you just compile without any restrict, this doesn't need Windows Metadata anymore
C++/CX: we have long story behind Windows Runtime development before C++ 11/14 became official so Microsoft add their own implementation features to MSVC. So with C++/CX you can compile with very old SDK like 10240, 10586, ... and in theory it also work with Windows 8.0/8.1 SDK, Windows Phone 8.0/8.1 SDK. Another attemp try to compile UWP with C++/CX on FastBuild (system build like Ninja) is successful, you can read as a reference here: https://github.com/fastbuild/fastbuild/issues/623
C++/WinRT is reunion attempt make Windows Runtime back to standard C++ 17. C++/WinRT can also compile with Clang/GCC. Base on answer from Kenny Kerr (creator of C++/WinRT): C++/WinRT is not limit with old SDK, but he recommended to use newer SDK like 17134. Link his answer https://stackoverflow.com/a/53193711/8707331.
Some useful links for C++ UWP:
https://github.com/MicrosoftDocs/cpp-docs/blob/master/docs/porting/how-to-use-existing-cpp-code-in-a-universal-windows-platform-app.md
https://modernwindows.wordpress.com/2015/05/28/modern-c-and-clang/
you can create uwp apps in following ways:
c# and xaml
web technologies like html, css and js. and you can use any
third party js libraries with it. you can even use hosted web apps
as uwp apps or latest technologies like pwas can also be shipped as
uwp apps. more here : https://developer.microsoft.com/en-us/windows/pwa
c++ and xaml : with this approach you can use c++ libraries (if they comply by uwp platform) the reason you do not have much support online for this is because majority of uwp developers use c# and xaml approach.
There are some work around for that, and one of them is to create a Desktop app and then package that in MSIX packaging , which packages a windows Desktop app into a uwp app and you can even distribute it through Microsoft store.
CMake can't be used to generate UWP package. However, you could use make.exe or Visual Studio to generate UWP package. For more you could refer to Create an app package with the MakeAppx.exe tool and Package a UWP app with Visual Studio.

Does Windows SDK restrict eligible versions of Windows?

We're moving to Visual Studio 2017 and VS2017 prompts us to retarget the projects for 2 things: Windows SDK Version and Platform Toolset.
Currently our application can run on older Windows versions (at least to Server 2003, possibly older), and we need to retain the same (I know they're not supported anymore, but that's the customer's requirement).
Assuming that our code (which is all C++ in case it makes a difference) does not use any APIs which are only available on newer versions of Windows, will re-targeting to a newer version of the Windows SDK restrict or limit the versions of Windows that our app will run on?
And while on the subject, will re-targeting to a newer version of the Windows SDK have any pros or cons (ex. performance) (again, assuming we don't use any of the new APIs that are only available on newer Windows)?
No, using a newer SDK allows use of newer funcntionality but it does not require doing so. So long as you are careful to only use functionality that is present on the version of windows you are interested in your program will continue to work. You will, however, likely need to install the vs2017 runtime on the client systems.
You will need the VC++ runtime for the development kit that you are building from. Statically linking this library will remove this requirement, as the runtime is embedded in your binary.

Running .net based exe application without .NET Framework

I just created a clr c++ aplication that combine c++ code and windows form
as resoalt the exe prodused from visual studio cannot use /mt and its not standalone (it require the wright .net installed on the computer)
are there ANY way to make a fully standalone exe from clr c++ exe?
i tried to check out spoon studio and Cameyo but it's look like they work only on files that includes instalation ...
The point is what a standalone application would buy you here? There is no such thing as a "standalone application" anyway - depending on how hard you look at it. You'll always have dependencies at least on the Windows version you intent your application to run on.
In the end it boils down to deployment or distribution issues. If you don't want your users to install a (newer) version of the .NET framework just to run your application, then start by determining the lowest Windows version you want to support with your application. Then check here for the .NET version that comes preinstalled with that version of windows. Then target your application against that version of .NET.

Are Visual C++ dynamic runtime libraries part of the Windows OS nowadays?

Are the dynamic runtime libraries for Visual C++ (more specifically 2008) part of the Windows OS nowadays? I noticed that at least on Windows 8 you no longer need to ship these with your application or have the user install the redistributable package from Microsoft.
Is this true? If so, for what Windows versions and for what versions of Visual C++ does this apply to?
No, they've never been part of the Windows distribution. Deploying them yourself is a hard requirement.
It certainly may seem that they are. Starting with msvcrt.dll in the system32 directory, it has the same name as the C++ runtime dll in Visual Studio versions prior to VS2002 (VS6 and earlier). It is however a private copy of the CRT that is used by Windows executables. And protected by the File System Protection feature in Windows, preventing old installers from destroying the operating system.
It certainly often works by accident. There are many programs that need the Microsoft CRT so it isn't unlikely that the user has run an installer before that got the DLLs installed. Clearly you cannot depend on that common accident.
Similarly for Windows 8, the pre-installed Microsoft.VCLibs.110 package matches the package you need for a Store app written in C++. But that's for the same reason as above, Microsoft Store programs were also built with VS2012, just like yours. What's going to happen in the upcoming VS2013 is a bit muddy right now, we'll know soon.
In my opinion, the answer would be both: Yes and No.
Yes: More recent Windows OS are generally shipped with VC runtimes pre-installed (along with more recent versions of the .NET framework). It is because Microsoft uses the latest/newer Visual Studio before they release VS to the public (or even to MSDN subscribers). If not this way, whenever you install some application (legacy application or some downloaded application), the setup would anyway install the required VC++ runtime. Another way is through automatic updates.
No: In case where none of the above mentioned rules applies. Or, when the VC runtime shipped with a new service pack or a patch. You might have developed your application with newer patch/SP, and that must be installed (as Side-by-Side, of course).

Question regarding libraries and framework

Sorry i'm a beginner,from what i know there are number of varieties of libraries and framework out there provided for the C++ language.My question is,when we create an application using the framework and libraries,do the users of the application need to install the framework or so so call the libraries on his/her PC??Thank You
It depends whether the library you are using is statically or dynamically linked. In the former case, it is part of the executable file that you distribute. In the latter case, it is an extra file (or set of files) with extensions such as .so or .dll, which you should distribute with your app.
Yes, libraries must be bundled with your application/installed before hand, as they are the framework upon which your application relies. If you don't install the framework, your application will not work.
You need to install something, not necessarily the framework. Some frameworks, like DirectX for example have a client installation. Some components are simple dll files that you can deliver with your software, creating an installation package.
The end-user need to have the framework installed.
As you need to have .Net installed to run some Microsoft(and other companies) products. If your application is written in C++ using GTK or Qt. You need to have they installed, but if you're on Linux using KDE, Qt is natively installed for default, the same for Gnome and also the same of Cocoa on Mac and Cocoa-Touch on iPhone and iPod Touch.
I suggest you to have the installer of the framework used embedded on the installer of your application. As GIMP and Xchat do.
Generally when using a framework there will be a framework redistributable (.NET, DirectX, etc) which can be bootstrapped into your installation to install the framework (or run by the end user as the first part of "installing" your app).
Many libraries simply need to be included with your code to function correctly, they themselves might have dependencies which need to be installed but these should be called out.
If in doubt, before you distribute your package run it on a fresh install of your target system (Linux, Windows, etc) and see if it complains about missing dependencies. Include those in your package and try again.
You can also look at installation systems (RPM, Apt, Windows Installer, etc) which can handle all of these tasks for you directly (or provide scripting languages to help you automate the job).