Visual Studio 2005

Temporary Projects in Visual Studio 2005

Recently while poking around in Tools –> Options of Visual Studio 2005 I found a setting that allows for the creation of temporary projects. I wish I had found a long time ago, yet for some reason I breezed right over it.

The Visual Studio 2005 Temporary Project

The temporary project will be created in memory and will not be persisted to the disk. Another benefit is that it will not show up in your recent project list. If you decide to close the project Visual Studio 2005 will prompt you with this dialog box:

Supported Project Types

All C#, VB.NET, and J# projects are supported. If you have the Web Application Project installed, you can even create throw away web projects projects too.

 

How To Enable


Go to Tools –> Options and uncheck “Save new projects when created” as seen below.

 

See this MSDN topic for more information.

kick it on DotNetKicks.com

HOWTO: Debugging JavaScript using “debugger;”

There are a lot of developers who write custom JavaScript or need to debug pre-written JavaScript, yet do not know that they can debug it in Visual Studio 2005. This is a fairly simple process.

Visual Studio offers the developer the ability to utilize the IDE to debug, just like you would debug if you are debugging .NET code. How? Very simple, the “debugger;” key word.

How It Works

First, you must enable script debugging in Internet Explorer (we will get that in a minute, first lets look at some code).

To debug: Write your JavaScript and place the “debugger” keyword where ever you want the code to break into debugging. The JavaScript interpreter hits this keyword and halts execution and returns the control back to the IDE. This is like setting a breakpoint inside of Visual Studio.

Example

<%@ Page Language=”C#” AutoEventWireup=”true” CodeBehind=”Default.aspx.cs” Inherits=”JsDebuggerExample._Default” %>

<html xmlns=”http://www.w3.org/1999/xhtml” >
<head runat=”server”>
<title>Untitled Page</title>
<script type=”text/javascript” language=”javascript”>

var myJsonVar = {
firstName : “Donn”,
lastName : “Felker”
};

debugger; // The code will break right here and return to the IDE for you to debug.

</script>
</head>
<body>
<form id=”form1″ runat=”server”>
<div>

</div>
</form>
</body>
</html>

This will allow you to break into the code. When control returns to the IDE, it looks like this:

 

How To Enable in Internet Explorer

You’ll need to uncheck a few boxes in the advanced section of Internet Explorer to enable script debugging. If you dont, script debugging simply wont work. It will not break and you’ll be left scratching your head wondering what you did wrong.

Go to Internet Options inside of Internet Explorer

Then go to the Advanced Tab and Uncheck “Disable script debugging (Internet Explorer)” and “Disable script debugging (Other)”

Click “Ok”.

Now place your “debugger” keyword anywhere in your JavaScript. Fire up the page through Visual Studio and get your debug on.

:)

kick it on DotNetKicks.com

Visual Studio SP1 with Vista


 

At work, we just upgraded our machines to Quad Xeon x64 machines with four gigs of ram. NICE….. :) But for some reason the manufacturer loaded 64 bit XP, even though we requested Vista. We upgraded it to 64 bit Vista quite easily, problem solved.

I did run into an issue while installing Service Pack 1 for Visual Studio 2005. I was attempting to install the SP1 Vista Update and I kept getting this error that told me that the proper “patches” were not in place, therefore the SP1 Vista Update would not install. To resolve this error you have to actually install SP1 (the regular one) and then the update. IMHO the documentation isnt that great in this area, I got confused…  See for yourself:

For developers using Visual Studio 2005 on Windows Vista, Microsoft provides an update to Service Pack 1 called Visual Studio 2005 Service Pack 1 Update for Windows Vista. This update builds on the improvements made in SP1 and delivers a first class experience for developers wanting to take advantages of the new features in Windows Vista.

I was taking this as “this is the SP if you’re on Vista”.

So… to upgrade to SP1 on Vista… do the following:

1. Install SP1

2. Instal The SP1 update for Vista

3. Get you’re code on…

Warnings as Errors

Warning:
A: To give notice to beforehand especially of danger or evil
B: To give admonishing advice
C: To call to one’s attention

With that said, we could infer that a warning is something that says “Hey, this is kind of important, you might want to watch this.” To me, in .NET Development, a warning means I’ve done something wrong, I’ve created an error.

To ensure my builds are top notch, I have updated my projects to treat Warnings as Errors. This allows me to be notified of something immediately. If a warning occurs, its foresight into the future. Warning: “This is what could happen.” Pretty much that means, you should probably fix that right now. Therefore I dont let builds complete if there are warnings in certain projects.

Here’s how to do it…

  1. Go to the project properties and select the Build Tab.
  2. Select “All” under Treat Warnings as Errors

3. Save and build.

Now, lets say you have a variable thats created but not used in a method somewhere, you’d get an error screen like this:

The build will fail locally as well as on your build server.

This will help alleviate errors in the future that may be caused by something that was a warning two months ago. :)

You can also accomplish through the command line compiler:

csc.exe /warnaserror

This compiler switch will treat warnings as errors.

*Note: You might want to leave this option in its default state for projects where a warning is ommitted automatically, like set up projects that publish to a local system. This is something that I’m ok with as we publish it locally anyway.