Wednesday, August 3, 2005

More Visual Studio.Net IDE errors - solved

[This was originally posted at]

After my harddrive crashed last week and I needed everything reinstalled, I've been running into errors with Visual Studio's IDE. A new one that I encountered was the inability to add classes or WebForms. I would try adding a WebForm, and get an error like:

Cannot find: C:\Program Files\Microsoft Visual Studio .NET 2003\VC#\VC#Wizards\CSharpAddWebFormWiz\Templates\1033\NewComponent.cs

There are just some things that you take for granted, so this was a little frustrating. I checked to see this file location, and I saw a structure like:

  1. [Folder] Microsoft Visual Studio .NET 2003
    1. [Folder] VC#
      1. [Folder] VC#Wizards
        1. [Folder] CSharpAddWebFormWiz
          1. [Folder] Scripts
            1. [Folder] 1033
              1. default.js
          2. [Folder] Templates
            1. [Folder] 1033
              1. Templates.inf
              2. WebForm1.aspx

I saw two existing files: Template.inf and WebForm1.aspx - no "NewComponent.cs" file. At first I though perhaps the file was missing, then I did a search for "NewComponent.cs" and saw it was the sole contents of the Template.inf file. I reasoned that Template.inf contained the name of the template to call. So I changed Template.inf from that to "WebForm1.aspx", and it worked perfectly. I verified that other machines, were this wasn't a problem, has the same contents for their template file too.

While I'm glad it was a simple fix, It seems like such a strange thing to happen.

On a related note, this article by Deborah Kurata shows how to make your own Code Templates that you can add in Visual Studio, just like the wizards for adding classes or WebForms.

No comments:

Post a Comment