Visual Studio Tips - How to Refactor interface from a class

by Naveen 8. April 2011 04:18

When you are developing a new functionality, you are not sure how the interface for your services will look like. It is good to have the interface defined first but it is not always the case. Like most of developers, you then end up creating a class and putting some meat in it. At some point you have defined all the methods that need to be exposed. So now you want to create an interface. I am not going to discuss here why I need an interface and things like that. Thats topic for another day.

Here is where Visual Studio 2010 will help you in automatically create an interface from your class.

  • Right click on class in editor window. It will bring up context menu as shown below.

  • Click on Refactor menu item and it will bring up next context menu as shown below.

  • Click on Extract Interface option and it will bring up dialog box as shown below.

  • Now you can configure name of interface, file name, methods and properties to include in the interface. Once you have made selection, click OK and you will have a new interface file in your project and your project will be modified to implement the interface that you just created.
 

Views: 1085

Tags:

Visual Studio

Visual Studio Tips - Inlellisense not working

by Naveen 8. June 2010 04:38

When you install Visual Studio 2010 you may notice that when you start writing some code in any language, intellisense may not be working as you expect from previous version of Visual Studio. What this could mean is that when you type few characters you are not being given hints and choices to auto-complete variable names or types etc. This is not a bug or anything. There is an option in Visual Studio settings that controls this behavior. For some reason, it is OFF by default. You will have to turn it on. Here are the steps that you will need to follow.

  • Click on Tools > Options menu item.
  • Click on Text Editors > All Languages link in left pane.
  • In the right pane you will notice Statement Completion options at top. Make sure that you have those checked to enable them.

visual studio 2010 options

If you have already have Visual Studio 2008 or earlier installed and had this statement completion enabled, then at the time of first time launch of Visual Studio 2010, when it asks you for import of settings from previous versions of Visual Studio, then you say yes to it and then you will not see statement completion disabled.

 

Views: 3530

Tags:

Visual Studio

Unable to start debugging on the web server - Error when starting ASP.Net debugging

by Viper 1. October 2009 13:59

Recently I installed Visual Studio 2010 and was working on a prototype User Activity Monitoring administration application. When I tried to launch the application in Visual Studio IDE, I got the following error message box.

---------------------------
Microsoft Visual Studio
---------------------------
Unable to start debugging on the web server. Debugging failed because integrated 
Windows authentication is not enabled. Please see Help for assistance.
---------------------------
OK   Help   
---------------------------

As the error suggests that I need to enable windows authentication. And that is a pre-requisites for running ASP.Net application under debugger. But thing that was different is that till Visual Studio 2008 when you made the IDE to create Virtual Directory, it used to enable windows authentication in IIS for that virtual directory. It seems that Visual Studio 2010 does things differently. It only enables anonymous access. You will have to explicitly enable windows authentication. It is simple procedure.

  • Launch IIS manager
  • Right click on virtual directory and select Properties menu option
  • Select Directory Security tab on the dialog box.
  • On this view click on Edit button in Anonymous access and authentication control section at top
  • On this dialog box, check the check box at the bottom in front of Integrated Windows Authentication option.
  • Click OK and apply your changes.
 

Views: 7077

Tags: ,

ASP.Net | IIS | Visual Studio

How to fix corrupted project and item templates in Visual Studio?

by Viper 23. September 2009 05:09

While working on an ASP.Net application on Visual Studio 2008, I ran into a problem. When I right clicked on the project to add a new page into the project, i got the error message that no templates could be found. Well, that was kind of strange that I was working on the project night before and I did not run into such problems. Recently Microsoft has become pretty good about their error reporting providing some initial hints. In this case the message said that I should look in the event logs to find more details. The event logs had the following error message.

The global template information is out of date. Regenerate the templates by running 'devenv.exe /installvstemplates' or reinstalling the application. Note: corrective action requires Administrator privileges.

In the past I would have took the option of reinstalling Visual Studio. But this time the error message provided an alternative to fix the issue by reinstalling templates by running a command line option. And it worked. After I ran the command, Visual Studio 2008 was back to its normal templates.

 

Views: 7024

Tags:

Visual Studio

How to configure auto recover options in Visual Studio

by Viper 1. July 2009 04:31

Recently my laptop has been behaving nicely to me. Because of an error in video card device driver, it kept crashing on me in middle of important development work or things like that. In times like that Visual Studio Auto Recovery has been god send for me. A lot of times I will have project or source code files not saved and system will Blue Screen (BSOD) on me. So I decided to dig around and see how I can tweak settings of auto recovery so I can make it to auto save more often than what it is doing now. You can do it from Tools > Options >AutoRecover view. See the screen shot below.

visual studio autorecover options

The options are very self explanatory. If you are interested in knowing where the autorecovery data is stored, you can find it at following location in your profile in windows.

C:\Documents and Settings\{username}\Application Data\Microsoft\VisualStudio\{vs version}\AutoRecoverDat
 

Views: 7526

Tags:

Visual Studio

Visual Studio 2010 Beta 1 Installation

by Viper 19. May 2009 11:14

This morning i downloaded Visual Studio 2010 Beta 1 and decided to give it a try. Download went smooth. Took about an hour to download team Suite. Extracted ISO file and installed it. The installation went very smooth as well. It had to restart my machine after finishing installation of .Net 4.0 Framework. And after that installation of Visual Studio took place. Over all installation experience was very good. It did not take any long and in between there were no errors or things like that.

Now came to fire up the IDE and see how it works. Lets just say that I am not very impressed.

  • There is no offline help available. So only option you have is online help.
  • This is a show stopper for me. The performance is just horrible. I did not create an project. I just moved my mouse from start page to top menu bar. The CPU usage spikes to 100% for no good reason. Well there may be some reason that Microsoft knows about. And its very consistent.

I am not sure if i want to keep this Beta 1 on my development if I can't even move my mouse.

 

Views: 3172

Tags:

Visual Studio

Silverlight support in FireFox is not very stable

by Viper 1. January 2009 10:34

This morning I was trying to set up a new web site to host some silverlight applications. I went through all the steps to set up the site and then fired up the demo page in FireFox 3.0.5. To my surprise page kept coming back empty all the time. When I looked at the source of the page, I could see all the markup and JavaScript that was required to run silverlight applications. I thought that I forgot something to do on web server to support silverlight applications. I went through my check list and saw i have done all the things. Then I fired up web site in Chrome. The application came up nicely and same thing in Internet Explorer. I looked at the plugin lists in FireFox and saw that Silverlight is installed. So much for cross-browser/cross-platform framework. From what I could see that behavior of silverlight applications is very flaky in Firefox. Oh well!

You can try the following demo application I created for another article on silverlight communication between plugins.

Silverlight Cross-plugin communication

 

Views: 3981

Tags:

ASP.Net | Silverlight | Visual Studio

Smart Phones Poll

What smart phone do you currently own?





Show Results

Month List

Powered by BlogEngine.NET 2.0.0.49
Theme by Naveen Kohli