views:

6785

answers:

3

We have some old C code here that's built with nmake.

Is there an automated way to pull the Makefile into Visual Studio 2005 and create a project? Some searching on MSDN indicates VS6 could do this, but it looks like VS7/8 dropped the feature.

If necessary I can build the project from scratch using the project.mak file as a reference, but for more complex projects this may not be viable.

A: 

This ought to be possible using Visual Studio's COM-interface, but I can't help you with any details.

JesperE
What on earth does COM have to do with this?
Zathrus
Visual Studio has a COM interface which you can use to automate a lot of stuff which you otherwise can only do by point-and-click. I assumed that "automated way" excluded anything requiring mouse/keyboard.
JesperE
+1  A: 

Here is a link to the VS 2005 docs on the subject. It also has links to VS 2003 & 2008, which are probably the same.

Edit: I would only want to do this with old code that would not change much, especially in the way of compile and link parameters, as hand editing the make file is the only way to change how the code compiles.

crashmstr
That's info on creating a NEW project that will be built via nmake. It will not open an existing project that has an nmake makefile. I already tried.
Zathrus
Then I guess I don't understand what your question is. If you have an existing project file from an older VS, it should convert when opened.
crashmstr
There is no project file, just a .mak file and source code.
Zathrus
Then you either need to make a new project file with the make file (and all references to the code are in the make file, it just compiles in the VS IDE), or you need to re-create the functionality of the make file in a new project that functions as a "real" VS project with files and such.
crashmstr
The method of using a make file has always been that way, if it is a make file, it stays that way and there is no way to make it into a "real" project. There might be third party tools to do it though.
crashmstr
+1  A: 

I have been heavily involved in a project at my company to do the same thing. I found that many of the old nmake based projects of our had many common settings. Because of that, I went the route of creating a custom project wizard.

It took several days of fooling around with it to get right, but has saved a lot of time. It has also allowed us to bring other devs into the effort of re-compiling in a manner that makes it easy for them, yet enforces many of the compiler settings we would like.

With the wizard, the steps of recompiling look much like:

1.) Create project.

2.) Compile and stomp out all errors and warnings.

3.) Add libraries that need to be linked in.

4.) Done.

Taylor Price