2007-11-24

Software Release: Visual Studio 2008

Yes! Finally, Visual Studio 2008 was released. I have to admit, that I downloaded Visual Studio 2008 Express Editions as soon as I found out about them. So from now on - it is the IDE of my choice.

I didn't have much time to test it yet, but I already noticed a significant performance increase. I'm not really sure if it is the performance increase. Visual Studio 2005, even with the performance fix wasn't performing that well. So, if you are still hesitating - don't! Get the new version and enjoy it!

There is one catch with the official Visual C++ 2008 Express Edition release, though. In the FAQ it says that there are no restrictions on the express editions - you can create commercial applications free of charge. However, the Windows SDK version express editions install on your system is 6.0A release. Now, this is very odd, because 6.0A is the pre-release version. As a general rule with all Microsoft products' pre-release versions - they are only meant for personal-use and testing purposes. So it is actually a mystery to me. I tried asking on Windows SDK forum about this, and I was advised to get the version of SDK that isn't marked as pre-release, so I'm passing this advice to everyone! You should really get the Windows SDK 6.0 release just to be on the safe path.

And now, let's return to our own business. I started a series of articles about making a wizard for the Visual C++ 2005 Express Edition. Now, I don't use that version anymore. However, from what I know already about the Visual C++ 2008 Express Edition I can say, that I will be making the same kind of wizard for the new release. Note, that both editions are very similar, and wizard developed for 2008 will probably work with 2005 release as well (you'll just have to change a few strings in a few files). So, if you were waiting for that series of articles to finish - don't worry! I'll finish it! ;)

2007-11-13

Software Update: Visual Studio 2005 Performance Fix

Ah. This is one of the nicest things Microsoft could have done! If you used Visual C++ 2005 (or any earlier version of it) with large solutions and projects - then you definitely know, that sometimes IntelliSense would often slow down things. Sometimes the slow down would be so big, that you'd have to turn off IntelliSense to be able to work on your project.

I haven't tested this fix yet, but I think it's going to be good! :)
And here are the links:
Microsoft's knowledge base article about the issue,
The actual fix download page,
A very nice VC++ Team Blog article giving more detailed explanation of the changes.

Note, that you will have to sign in to your passport account before you get access to the download page.

And once again - thank you Microsoft! :)

2007-11-12

Customization: Custom Visual C++ Wizard - Part II

In the previous part of the series, I explained what I don't like about the default VC++ Project wizard. I also defined how those things should be fixed. So, by now, we have some requirements defined for our final wizard project. Let's continue planning our wizard.

So, what kind of projects we will be making with this wizard? Well, the most basic option should be there to simply create the Solution. When creating solution, it should also create directory for the source code, and add the common headers there. Now, we are facing the first problem. Visual C++ Express Edition doesn't support Solution Directories (or solution files), which means, that we either have to create a dummy project that would contain those headers, or we will not see those files in Solution Explorer window. Personally, I prefer the first option. So, our empty solution will not really be an empty solution - it will have a dummy project (I'll call it "Solution Project") and this project will contain a few header files.

What else? Well, as I mentioned in the first part - I like to have all my projects as a set of libraries, so the next obvious project type we'd want to generate is a Library. There are a three kinds of libraries I will want to generate. The only difference in those three will be the output file it generates. Now, if you remember the first part - I said I want four configurations (Debug Static, Debug Shared, Release Static and Release Shared). Basically, each configuration name describes perfectly, which C/C++ runtime the configuration will link to. I hope I don't have to explain, why linking to the same version of runtime is important across all projects in the solution... So, the three library kinds will be: Static Library, Shared Library and Mixed Library. You are probably wondering what the heck are those. Well, let me explain. In Static Library project, all four configurations will generate a static library (LIB file). In Shared Library project all configurations will generate a shared library (DLL file). In Mixed Library project, however, the both Static configurations will generate static, and the Shared configurations - shared library. In addition, when creating a Library project, I might want to create a Unit Test project for it too. Now, I know that not everyone likes to write unit tests, but I do, so I'll need this option.

Finally, the last kind of project is an Application. I can think of two application types - Console Application and Windows Application. I think those are obvious.

So what else can we plan? In the first part, I described what the directory structure should look like, but I didn't discuss naming issues. You see, when creating directories or naming files - there are a few things to be careful with. There are all kinds of special characters that you can not use in those names. Also, it is a bad idea in general to use paths with spaces in projects. So, whatever I enter as a project or solution name - it might not be possible to use them as the directory names and solution/project file names. So, the wizard could generate safe names for us. It could generate them, but it could also let us edit those names just in case we want that. Also, if I'm creating a library called "PM's Standard Library" I don't really want to include headers from that library by prefixing "pm_s_standard_library/". So, we will also need an abbreviated solution/project name.

Having discussed all that, I think it's time to start designing the pages of our wizard. However, that's the thing we will talk about in the next part of this article series. Stay tuned! ;)

2007-11-07

Customization: Custom Visual C++ Wizard - Part I

As I told you earlier - I am using Microsoft Visual C++ 2005 Express Edition. Unfortunately, this version of Visual C++ has some limitations. One such limitation, is that you can not design custom project (or item) wizards with it and for it. However, a creative person such as me or you, might still figure out the way...

Yes, that is true. I know how to add wizards. I will try to make one such custom wizard and in the process of making it - I will post articles about what I'm doing.

So. What is the first thing you should do, when making a wizard? Personally, when I figured out how wizards work - I started making one. Planning is for pussies, right? Wrong! Plan every single thing in your wizard. It is very frustrating, when you have to start over and over again.

Ok, so let's start from the list of annoying things in the default (console project) wizard. Here is my list:

  1. The default Debug and Release configurations.
  2. Default settings in those Debug and Release configurations.
  3. Solution and project directory structure.
  4. Default generated code.
I'd be interested to see your lists (it might give me ideas), so please - feel free to leave a comment. Thanks! Now, let's proceed.

Here are the explanations of each item on my list:
  1. I always break down my projects into small libraries. When I start developing those libraries - I never know if I'll want static library (LIB) or shared library (DLL). Also, I don't know which run-times I'll want to use in my final application (they can also be static and shared). So, it would be great if I could have a project with both. It means, that I want to start with four configurations: Debug Static, Debug Shared, Release Static and Release Shared. It doesn't really matter what kind of project I'm making - I always want these configurations.
  2. Now, when I'm writing my code - I always set the warning level to the max (level 4). Whenever I create a project with the default project wizard - I spend 15 minutes or so going through Project settings. That is wrong! I want the wizard to set the correct values for me, so that I can create a project and start coding!
  3. This is the tricky one. By default, Visual Studio solutions and projects have this directory structure:
    [solution] - top level solution directory;
    • [config] - each solution configuration gets it's own output directory;
    • [project] - project directory;
      • [config] - each project configuration gets it's own intermediate directory;
      • [project].vcproj - project file;
      • *.cpp, *.h, *.rc and so on - source files are all in this directory as well;
    • [solution].sln - solution file.
    Am I the only one concerned about the fact that intermediate files are placed in the subdirectory of the source code directory? I mean, when you hit "Clean Solution" - VC++ never cleans all of the files. There is always something left in that directory. So if you want to create a source code package (for whatever purposes), you have to manually delete those files. And the binaries? They are placed in separate directories in the top-level solution directory. Let's summarize. Here's how I imagine the perfect solution directory structure:
    [solution] - top level solution directory;
    • bin - executables (EXE and DLL files);
    • lib - libraries (all LIB files - DLL export libraries and static libraries);
    • src - source directory;
      • [solution] - top level source directory (so that we can have includes like this: "[solution]/[project]/[file].h");
        • [project] - project directory;
          • [project].vcproj - project file;
          • *.cpp, *.h, *.rc and so on - source files are all in this directory as well;
        • *.h - some common configuration headers;
    • tmp - intermediate files;
      • [config] - each project configuration gets it's own directory;
        • [project] - each project gets it's own intermediate directory;
    • [solution].sln - solution file.
  4. Seriously, is there anyone who uses that default code? I talked to a few coders I know - they all say that they always check "Empty project"! The code is just wrong. It could be so much more useful. Anyway, we will make a wizard that will add a lot of useful code for us (it will be preprocessor macros, mostly).
So. I have defined what I don't like about the default wizard and I've defined how those things should be fixed (how they will work in my own custom wizard). This is it for today. The second part of the article series will follow shortly.