Using Visual Studio 2017/2019 to run VS 2008 C++ project - c++

I wonder if anybody has experience converting VS 2008 C++ solution to VS 2017/19 without switching to newer SDK and toolset. The solution is quite old, very large, uses 3-rd party libraries, so full conversion is out of the question. The goal is only to switch to better user interface.
Theoretically it is probably possible, although I successfully converted only very basic C++ MFC project.
Project settings in VS 2017 show only latest toolset. To make other toolsets to appear, I had to install VS 2010, and also add SDK 8.1 from VS installer (without VS 2010, this option is not available). Then select toolset v.90 and SDK 8.1 for each project in solution.
At this point, simple converted project works fine. A large legacy solution has a lots of issues. I resolved generic ones, but it looks like uphill battle. For example, C++ directories are physically different and some of the files are missing. It may be possible to eventually assign original VS 2008 directories to each project and/or copy missing files, but I have the impression of doing something illegal.
The question is, is it a valid procedure and still possible after latest updates.
Thanks==

Related

Using legacy toolset from VS2005 in VS2019

I ran into the rare situation that I have to use static libraries in a project which were compiled with Visual Studio 2005.
As I do not want to get into trouble at runtime as mentioned in this post or here,
I think it's reasonable to use the original toolset.
As far as I have seen, using toolsets down to VS2008 is straightforward. For VS2005 this seems to be more challenging, only Daffodil might be an option.
Is there any chance to get the toolset v80 (VS2005) into the dropdown menu of VS2019 ?
After playing around, I don't know exactly understand how daffodil works or how a feasible approach looks like.
Maybe one could create wrapper-DLLs with a plain C-API and the help of VS2005. Using one IDE with various toolsets feels advantageously to me.
Daffodil works only in earlier versions of Visual Studio 2012/2013/2015.
For using daffodils, check out the related thread: How to move old VC6 project to VS2010 using Daffodil.
To build your project in VS 2010:
Make sure the VC 6 build tools are installed and working. Make sure VS
2010 and Daffodil are installed and working. Open your VS 6 workspace
in VS 2010. A. In Explorer, right-click on your VS 6 workspace (*.dsw)
file. B. Choose Open With -> Microsoft Visual Studio 2010. C. Perform
the migration when prompted. Change the Platform Toolset to v60. A.
Right click on the project(s) and select Properties. B. On the General
page, set Platform Toolset to v60. Build.

visual studio 2015. c++ console application converted in setup project with all dll

So i'm fairly new to VS and coding and I've recently made a small snake game in a C++ console application project, which works fine but i would like to get it to work on another PC without VS. The closest i have found to answering my question were these other StackOverflow questions here and here. i have installed the vs installer projects extension to try make it a setup project and include the required dependencies but i cant work out how to do this. Does anyone have any info to guide me through my last step of this problem or am i completely on the wrong track?
If the application uses dynamic runtime (which is the default), it uses the VS DLL files. To provide them, the Visual Studio Runtime Redistributable for that particular VS version needs to be installed on the target machine (as mentioned in your second link).
So that means you need to setup the installer that way. I didn't use it, but there might be some options that the resulting setup can either contain or download and install the VS redistributable automatically.
See also here: How to install redistributable with visual studio setup? (but it is for VS 2013, there might be some changes in 2015)
Well, you don't tell us what kind of project your C++ console app is...
Using only C++, your app can be built with different versions of the CRT, like for instance:
V120 (VS-2013)
V120_XP (VS-2013 w/ XP support)
V140 (VS-2015)
V140_XP (VS-2015 w/ XP support)
Even on VS 2015, you can choose the version of the CRT you want, and use an older version, if needed.
Anyway, the target computer will need the DLLs for the correct CRT version.
Microsoft provides them. You can either ship them with your product, if you have a custom installer, or use the installer provided by Microsoft.
MSDN - Determining Which DLLs to Redistribute
For instance, using V120:
msvcp120.dll
msvcr120.dll
Your project might also use .NET.
In such a case, you also need to install the correct version in the host machine.

How to move old VC6 project to VS2010 using Daffodil

I've been interested in this project lately.
I have an old legacy project made in VC6, which I hear is a great IDE but doesn't run smoothly on my machine. I also don't know how to work with it. A full blown move to a 2010/12 project is a big time spent so I wonder:
Can someone share some basic information on how to use this tool? I've been searching a lot and couldn't find anything more comprehensive than the site.
Which specific old VC6 tools do I need to make sure to have working for Daffodil? (compiler, linker, etc) where are they located on the installed machine?
To build your project in VS 2010:
Make sure the VC 6 build tools are installed and working.
Make sure VS 2010 and Daffodil are installed and working.
Open your VS 6 workspace in VS 2010.
A. In Explorer, right-click on your VS 6 workspace (*.dsw) file.
B. Choose Open With -> Microsoft Visual Studio 2010.
C. Perform the migration when prompted.
Change the Platform Toolset to v60.
A. Right click on the project(s) and select Properties.
B. On the General page, set Platform Toolset to v60.
Build.
A quick read tells me that the concept of "Daffodil" is to use the VC6 compiler with the VS2010 IDE. Therefore, you wouldn't run VS6 on your machine. You just need the VC6 compiler and linker.
Start by letting Vs2012 migrate the project and see what doesn't work properly. The newer compilers are much better -once you've gone through the pain of the conversion.

How to downgrade solution from Visual Studio 2010 to Visual Studio 2005?

I have a huge Visual Studio 2010 solution. I work with Visual Studio 2005, so I want to convert the solution to the desired version. Basically, it's a portable C++ code so it should compile on Visual Studio 2005 too. Changing the version in the *.sln file doesn't help because the *.vcxproj format is completely different from the old *.vcproj format.
Recreating the solution by hand is not an option because of its size. Also there may be some non-default compiler flags, dependencies, etc. that I don't know of (and I can't look through ALL this XML junk that I don't understand).
There is already a related question on How Do I Downgrade a C++ Visual Studio 2008 Project to 2005. However, the utility suggested there supports at most Visual Studio 2008.
Any suggestions?
It really totally sucks, that every proprietary IDE today thinks it needs to create its own project file format.
"Dear IDE developers, just use Makefiles and create a nice GUI for it so that also people without Makefile knowledge can use it!" In VS6 it was at least possible to import/export Makefiles, but not today anymore. And it was possible to use nmake for automated builds. No IDE needed to be installed, just the toolchain which could be grabbed by a simple checkout without installation.
I use CMake now. It's free, it's cross-platform, it is well supported in free IDEs like KDevelop, QtCreator, etc. It can generate Makefiles and Visual Studio projects.
So you maintain only one project source, the CMakeLists.txt file and can work with any IDE. No pain with different versions of Visual Studio or with other proprietary project file formats.
This way you can generate or VS projects for developing and you can generate Makefiles for commandline builds using nmake like in the good old days.
BTW, it's much easier to change settings in a CMakeLists.txt than clicking through various GUI dialogs. But this is a matter of personal preferences.
In my work made a utility which utilized the EnvDTE.dll and scanned a vcproj-file and optionally all vcproj-files within a sln-file. It compared all settings with a "template" and would issue a warning or optionally update the setting to correct values. We used this utility so that settings would be verified to be correct and consistent throughout all projects. I haven't updated the utility to 2010 yet due to other priorities.
EnvDTE hasn't changed much from Visual Studio 2008 to Visual Studio 2010. Perhaps it is possible to create a simple utility which opens the vcxproj-file using DTE100 and saves it using DTE90, or earlier.
Easiest way is probably to create a new project in VS 2005, and use the add existing item dialog to add the code to the project. I'd suggest using 'Empty Project' as the project type, so you don't have a lot of rubbish autogenerated for you that you'll just delete anyway.
I haven't tried it, but this looks promising:
http://www.emmet-gray.com/Articles/ProjectConverter.htm
edit: Nope, not promising, sorry :-(

Visual Studio 2008 Express MFC Support

As may be known by many, the Express versions of Visual Studio 2008 don't include support for MFC and a few other packages required to compile a lot of windows programs.
So, here's my problem:
I have the full version of Visual Studio 2005. I've been using this to compile a project that a friend of mine was working on, so that I could test it out for him and continue to track bugs and things. Recently, he upgraded that project to VS 2008, which I don't have. So, I downloaded the express version in the hopes that I could simply compile with that, but no luck, it complains about headers missing left and right.
It seems to me that since I already have the full version of VS 2005, I'm bound to have at least some (perhaps older) version of the files in question that his project needs to compile against.
Is there a way I can convince VS 2008 to also look in 2005's directories for include files and library files to compile against?
Furthermore, is this a bad idea? I would really prefer not to go out and purchase VS 2008 full, as I'll never use it myself. (2005 does the job fine for me at the moment, and I tend to prefer GCC anyway.)
Thanks
You can use the VC++ compiler directly from the command line, or just create a new project w/ the source in Visual Studio 2005. Unless he is using some functionality provided in the new versions of MFC/ATL in 2008/2008sp1, you should be able to compile the project just fine.
See ("Create Project from Existing Source") in Visual Studio 2005. It is unfortunate that they don't include these libraries with the Express Editions.
Use the vcvars*.bat script(s) from Visual Studio 2005. See this blogpost from VC++ Blog to see how. You will use the old compilers, but the build system from Visual Studio 2008.
You can go into Tools>Options>Projects and Solutions>VC++ Directories
and alter the Include, Library, and Source (and Reference maybe?) folders to use VC++ 2005's folders.
I'd guess you just replace $(VCInstallDir) with a hardcoded VS 2005 path. I'd record the original values before doing this.
However, have you just tried using the OLD 2005 sln and vcproj files? Keep using 2005 on your end and 2008 on his. Keep two sets of these files for each IDE. Any issues are going to be with the library mismatch - which you're not avoiding by using 2008's tools with 2005's libraries.
The simple way to deal with this would be to revert the solution and project files back to their visual studio 2005 state from source control(you are using source control right?). At this point you can compile the project as long as your friend does not use any of the mfc 9 only functions.
The first thing I would try is loading this up in VS 2005 by just modifying the version of the .sln and the .vcproj files. In the .vcproj change the version from 9.00 to 8.00 and in the .sln change the format version from 10.00 to 9.00.
If you don't have fancy stuff in the project you have a high chance of just being able to use it like this. Also this would avoid having to update 2 project and solution files.
On this website it is shown how MFC code can be compiled with the Visual Studio Express versions:
link
Just for the record, I've done that(by modifying the include directories and library directories from inside the IDE) and it's working pretty well, I have MFC, ATL, everything.
I've found this explanation. http://www.codeproject.com/Articles/30439/How-to-compile-MFC-code-in-Visual-C-Express