MinimizeMaking Visual Studio 2005 do Things for You

Here is how to create a Visual Studio macro to automatically do things for you. I have kept a record here of my own experiences in doing this.  Please note that the coding is done in Visual Basic (VB.net).

Now if you’re a seasoned developer you may at first be despising the word "macro".  But I assure you if you've never used them in your Visual Studio work - I think you will change your mind about them. If you’ve never created and edited VS macros then you'll realize that VS macros do much more than “record and replay”.  My previous VS macro used in my Visual Studio 2003 version is hand coded and is well over 500 lines! It is a huge time saver!

As I read through Shaun Walker's post on DotNetNuke® Ver. 4 module development for ASP 2.0, I noticed things such as, "You will need to manually rename a couple of folders." and so forth.  Whilst transferring some VS macros to my new copy VS 2005 Pro I thought certainly one of my macros could do this work for me. Wouldn't that be nice?  Should be easy to do.  Not so! - I could not get a VS macro to do this very simple task! Maybe it has something to do with it being a web app. And another sad fact: The macros from my VS 2003 are nearly worthless in VS 2005. A number of major changes have taken place in the world of macros.

I still wanted badly to automate. This bugged me so I decided I wouldn't let it get the better of me and after much Headache I figured out the whole mess.

In order to save time and show you exactly what I accomplished there is some housekeeping to do first. To begin with, before jumping into Visual Studio 2005, please undergo the following steps to create an “unzipped” copy of the DotNetNuke Custom Template. You will reference these unzipped files later.  Begin by first navigating to your My Documents folder.

screen1.jpg

Inside your My Documents folder you will find other folders. If you’ve done a DotNetNuke portal version 4 installation (see sidebar) then you will see the folder “Visual Studio 2005”. If you haven’t done the DotNetNuke version 4 installation yet, please do so before continuing. Having version 4 installed is going to be paramount to accomplishing anything at all (with this tutorial).

Open the folder Visual Studio 2005 and inside of it create a new folder. For lack of anything better I’ve just called my new folder DNNModule. Now if you’ve generated yours in the same manner, you will have an empty DNNModule folder located at \My Documents\Visual Studio 2005.

Next, store your template information inside this new DNNModule folder. This is another simple step. It requires that the original DotNetNuke Module Template zip file be unzipped here. Navigate all the way down to this folder: \My Documents\Visual Studio 2005\Templates\ItemTemplates\Visual Web Developer\VisualBasic. You should find the zip file named Module_VB.zip. Unzip this file into the newly generated DNNModule folder.

Finally, we’ll do away with some future problems by right-clicking the DNNModule folder and selecting “Properties”. Uncheck the “Read-only” box. Click “Apply”. At this point you should be asked, “Do you want to apply it to all subfolders and files as well?” Yes you do! Apply the changes to this folder and all subfolders and files. You are now ready to begin some Visual Studio 2005 automation work.

continued page 2.....

Print  

Friday, November 21, 2008

Copyright 2008 by Powerhouse Data   *  Terms Of Use  *  Privacy Statement