That seems to be the name of the game in software development. Our customers need new features in their apps and we developers want new tools, and new techniques to build them. We are all just trying to keep up, stay current, keep that edge.
Microsoft is happy to keep moving the target too. .NET is arguably the fastest moving platform in the software tools market at the moment. The major milestones of .NET development evolution are the major releases of Visual Studio tabulated below (source):
|Visual Studio||N/A||4.0||N/A||April 1995|
|Visual Studio 97||Boston||5.0||N/A||February 1997|
|Visual Studio 6.0||Aspen||6.0||N/A||June 1998|
|Visual Studio .NET (2002)||Rainier||7.0||1.0||February 13, 2002|
|Visual Studio .NET 2003||Everett||7.1||1.1||April 24, 2003|
|Visual Studio 2005||Whidbey||8.0||2.0, 3.0||November 7, 2005|
|Visual Studio 2008||Orcas||9.0||2.0, 3.0, 3.5||November 19, 2007|
|Visual Studio 2010||Dev10/Rosario||10.0||2.0, 3.0, 3.5, 4.0||April 12, 2010|
|Visual Studio 2012||Dev11||11.0||2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2||September 12, 2012|
|Visual Studio 2013||Dev12||12.0||2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2||October 17, 2013|
So ... onward we go!
We started work on gmStudio in 2004 with VS2003 and .NET 1.1. Now we support rewriting VB6/ASP/COM code for VS2005, VS2008, and VS2010 although it has been a while since anyone showed interest in anything older than VS2008 and VS2010 is the default. With the release of a major service pack for VS2012, and VS2013 already in beta, its well past time to add support for VS2012. I want to use this blog post to walk through the addition of VS2012 support to gmStudio. I will describe some of the conventions and configuration features that allow gmStudio to target and integrate with different VS versions. The tasks in this small maintenance effort are as follows:
Preparation is downloading and installing VS2012 and checking it out. I downloaded the 1.5GB ISO for VS2012 Premium ran the install. All of that took a couple hours, but other than a couple restarts, it was smooth sailing. Looking at the VS2012 UI and... hmm ... I think its called Metro right? Functionally everything seems to be there, and more, but it reminds me of the character-based IDE turbo-Pascal that I first did PC programming on back in 1984... very plain but now in high resolution. (Hey at least I didn't compare it to DOS Basic). No problem, it works; and I bet it will grow on me.
I was able to rebuild the gmStudio projects (C#) in VS2012 with no issues. Our gmStudio-as-a-VS-Extension project did not load or upgrade – no surprise there; it is VS2010-specific. Also our plug-in will not load in VS2012; no surprise there either. Maybe I will do a separate blog post on bringing VSIX extension up to date.
The first thing I notice is that VS2012 is backward compatible with the VS2010 project files (i.e. csproj, vbproj) we generate for DLLs and EXEs. They open and work without asking to upgrade. Web Application projects on the other hand, automatically upgrade to VS2012 format. We will have to account for this minor matter when we translate web application projects.
Updating gmStudio to support VS2012 is a matter of changing the UI on the migration project setup form and the user default form.
Updating the docs is also pretty mundane. We use a Wiki for the gmStudio User Guide, so the update is quick and easy. Gotta love a wiki...
gmStudio has a .NET build operation that tries to compile the generated csproj/vbproj file. This operation runs MSBuild as a shelled process. Before we can run MSBuild executable, we execute SetEnv.cmd. This is a command script distributed with gmStudio to setup the environment based on the desired VS version. SetEnv.cmd updated to support VS2012 is listed below.
For standard DLL and Exe projects, there are no required changes: you can open and build VS2010 files in VS2012 as-is. However, when the user selects VS2012, I want to default to Framework 4.5. This requires a small change to the a system configuration script called AuthorText.gmsl. The change is made in a function called Project_Preamble. A similar change is needed in function called StartNewcProject which is used when generating stub projects.
As mentioned above, web application projects are different in VS2010 and VS2012.
Opening a VS2010 web application project file in VS2012 will invoke a conversion process and display a conversion log:
Opening a VS2012 web project in VS2010 and will get you nothing but an error message about incompatibility.
I created new empty ASP.NET web application projects with both versions and compared them side-by-side; see the attachment for details. Most of the differences are MSBuild tool and targets. In any event, I made all differences conditional on DevEnv in AuthorText.gmsl. I am doing all this on a Win7 64 machine. There is chance it will not work on Windows versions.
Modifying Build and Run control files
Build and run control files, like csproj/vbproj, AssemblyInfo, and web.config, can direct some very powerful .NET features. When gmStudio upgrades your source code, it generates build and run control files for you. These generated files are simple, generic versions of these files. Their content is based on the templates and rules in AuthorText.gmsl.
If you want to take advantage of the advanced features you can simply use author/fix commands to modify the generated files. If you need to do something more sophisticated or something specific to your organizations standard build procedures , you can activate a project-specific AuthorText.gmsl file and change it for your purposes.
There are two changes that result from setting DevEnv="VS2012" in your migration project. First, the TargetFrameworkVersion=4.5. Second, there are some changes in the CSC command line string used by MSBiuld. Recall we modified SetEnv.cmd to call "%VS110COMNTOOLS%vsvars32.bat" which sets the environment to use the .NET build configuration installed with VS2012. There were a few changes in the build configuration. Most of the changes were Framework v4.0 to v4.5 related as expected. The other two changes relate to the highentropy flag and the subsystem flag.
These compiler settings are defaults chosen by Microsoft.
Left file: VS2010 build log
Right file: VS2012 build log
/debug+ /debug:full /filealign:4096 /optimize-
/debug+ /debug:full /filealign:4096 /optimize-