C#, Microsoft, Technical, Visual Studio

Visual Studio 2010 unable to resolve project reference

I created a new console application in VS 2010 and imported an existing class library project from the disc into the solution. When I tried to build the project VS was complaining that it was unable to resolve the reference to the project. I did ensure that the imported project was correctly referenced in the console app.

It was due to the fact that the console app was targeting the .net 4.0 client framework and the class library was targeting the full .net 4.0 framework. I changed the console app to target the full framework and voila I was able to build the solution successfully!

.net, Code, Microsoft, Technical, Visual Studio

LIFO and FIFO (Stack and Queue)

Well, I was working on one of the projects which required the use of the FIFO and LIFO data structures. Since the project was based on .NET, I had no trouble at all implementing the same.

The System.Collections namespace provides us with the classes required to implement FIFO and LIFO.

Declare the queue:
Queue myQ = new Queue(5);
To add an item:
To remove an item:

Declare the Stack:
Stack myStack = new Stack(5);
To add an item:
To remove an item:

Gone are the days where one has to write the entire code to implement these oft used operations.

Microsoft, Technical, Visual Studio

Error to use a section registered as allowDefinition=’MachineToApplication’ beyond application level

I have been giving the Visual Studio 2008 Beta 2 a whirl and the first thing I wanted to do was to open my existing project targeted for .Net Framework 2.0 in Orcas beta. The good thing about the conversion wizard is unlike the the 2005 conversion wizard which converts all projects to use the new framework, this one actually prompts and asks if you want to continue with the existing framework or upgrade to the .Net framework 3.5. Sweet, as I just wanted to test the IDE and not the framework. I am more interested in the IDE capabilities like the JavaScript debugger and Split mode design and code view (just like in Adobe Dreamweaver 🙂 amongst others.

So, I fired up the IDE and opened my existing solution which contained about 6 projects in them including a Website and the rest as class libraries. It opened up the conversion wizard and asked me if I would like to create a backup. I said yes and proceeded. That is where my trouble started. Once the conversion was done I tried building the solution and the compiler threw the following error:

Error    46    It is an error to use a section registered as allowDefinition=’MachineToApplication’ beyond application level.  This error can be caused by a virtual directory not being configured as an application in IIS. 

I was using the development server and no IIS. And no clue about how to configure a website in the the development server as an application. After scavenging through tons of Google Results I came across a post that mentioned the following:

I don’t understand why, but when I have a web.config file defined within the individual application directories, I receive the error described the the person initiating this thread. Removing the web.config file fixed the problem for me. With that said, it is also important to define the applications virtual directory as a web app, the the last forum post explained.

Hmmm.. having read that the backup I created on conversion came across my mind. It was inside the website folder like this:


The backup folder also had a copy of the Web.Config file inside it. That was it. I moved the backup folder elsewhere and tried rebuilding the solution and voila,

========== Build: 6 succeeded or up-to-date, 0 failed, 0 skipped ==========

CSS, HTML, Microsoft, Technical, Visual Studio

Applying Style Sheets in Microsoft Visual Studio 2005

When trying to attach style sheets in Visual Studio I was wondering if there is an easier way to do so rather than typing the entire markup in the HTML view.

Check this out…

– Open up the Designer view of the page you want to apply the style

– From the Solution Explorer just drag and drop the CSS file on to a blank area of the screen

– A black border around the designer view indicates that the change is being applied

– Once done, you can see the changes on the fly!

I should have guessed that one 🙂