Showing posts with label VS 2008. Show all posts
Showing posts with label VS 2008. Show all posts

Friday, April 20, 2018

Duplicate Menu Items in Visual Studio

Recently I had a situation with Visual Studio 2010 where menu items where duplicated like 3-4 times. Looks like some configuration file was corrupted. I have tried to restore current settings and setup new settings but none worked out.

To resolve this I ran the following from command line

devenv.exe /safemode /setup

Once this ran, I restarted Visual Studio I could able to see Visual studio with default factory settings.

PS: If you have any personal settings done before you have to redo those settings again.

Monday, December 26, 2016

How to load Visual Studio without extensions

All versions of visual studio can be started with a set of arguments.

Using devenv.exe /SafeMode allows you to run any version of visual studio (devenv.exe) in SafeMode that will disable 3rd party plugins.

Using devenv.exe /ResetSettings will restore Visual Studio default settings

Run these commands from Command prompt in admin mode. For additional options refer MSDN for help.

Saturday, April 20, 2013

How to Remove Css Style from codebehind?

Here is how we can achieve this from codebhind in c#. Here is the sample code snippet I am here removing CssSytle from DIV but I works for any Control

   1: // Removing Div class when we have only transaction details
   2: divTransactionSummary.Attributes.Add("class", divTransactionSummary.Attributes["class"].ToString().Replace("prodiv", ""));
   3:               

Here “prodiv” is the class of div I have used in my aspx page for this DIV


Hope this helps!!

Sunday, February 10, 2013

File Handling by Source Control

What are the files that needs to be check in VSS for better handling of files when we do development. There are many file types and are stored and updated internally for each developer based on their own settings. So in other words these files doesn’t need to be part of Source control system. Here are the list of file types that we might need to look in as developer

You can add the following files to Visual Studio source control:

  • Solution files (*.sln).

  • Project files, for example, *.csproj, *.vbproj files.

  • Application configuration files, based on XML, used to control run-time behavior of a Visual Studio project.

But the Files that you cannot add to source control include the following:

  • Solution user option files (*.suo).

  • Project user option files, for example, *.csproj.user, *.vbproj.user files.

  • Web information files, for example, *.csproj.webinfo, *.vbproj.webinfo, that control the virtual root location of a Web project.

  • Build output files, for example, *.dll and *.exe files.

For more information

Tuesday, April 03, 2012

How to: Share Visual Studio Settings Between Computers or Visual Studio Versions

There's a real cool functionality that's built into Visual Studio that allows me to set up the Visual Studio environment just the way I like it, then I can export those settings out and then import them into another instance of Visual Studio. So say I have Visual Studio running on my development machine at work then I have a copy of Visual Studio on my laptop so that I can work at home or work on the weekends, or whatever. It'd be really cool if both of these environments matched. It's going to help productivity. It's going to make it easier for me just to live and get around. Well, first thing, if we go to Tools, Options I want to show you something. There's an Import-Export Settings and yours may look like this.

1

You will have to expand Environment and you will see Import Export Settings. Now it's going to tell you that I can use team settings files if I'm using a team server or I can automatically save my settings to this particular file. And if I click Browse I can jump out and put it wherever I would like, but you can notice by default here.

image

if I just click up here in the text box, the drop-down box, it's going to put it on C:\Users\nagasai\documents\Visual Studio 2010\Settings folder. And then I can give it a name, whatever I would like. So this is where I can work with that. Now, what's really cool is, if I go back to Tools you will notice down here we've been going to Options but right above Options is an Import and Export Settings, and so I will click on that and you will notice that I can export selected environment settings, or I can import. Well, let's say that I want to save the settings that I have out, so I click Next. And notice it says, What do you want to send out? I want all my Code Analysis, Database Tools, General Settings, my Team Foundation Server settings, and then notice on Options it's saying wait a minute. You've got some things here that you may want to go take a look at, and it is saying I may have some things on the Import-Export Settings that I need to go take a look at. This is warning me, notice up here, that it might expose intellectual property or other sensitive information, and so it's saying not to choose those and I can read F1, but for now we're just going to leave that alone. Actually, I'll just clear that for now, and I'll just choose Next and it's asking me, what do you want to name your settings file? And I will just call it MTL Exported VS Settings and I will tell it where to save those, and actually, just for the purpose of this I'll put it on the Desktop and I will click Save and then I will click Finish and notice my settings were exported out there.

3

Now if I minimize this and let me just make this easy on myself and go out to the Desktop, notice there are my exported files, so all I have to do is put that on a thumb drive, take it to another machine and import it into another Visual Studio instance and I will have everything there just like I wanted. Now, let me go back to something else. If you remember, I talked about this particular little guy right here that shows up the first time you start Visual Studio. Well, what if you chose something here that you don't like and now you want to go make a change to that? After the first time that you see this screen and you make a choice here and start Visual Studio you will never see this particular dialog box again. So what we're going to have to do to make changes to that, if you ever want to, is go into Import and Export Settings and you can tell it that you can Reset All Settings and you can say just Reset, and notice it's going to take you right back to that same screen with a couple of differences and I can say, you know what, just give me General Development Settings, or give me Visual Basic but let's say that we want to go back to General.

 

Now we just click Finish and it's resetting them and now when we start up we're going to see, in all of our projects and everything, General Settings out there.

image

image

So I hope this doesn't confuse you, but the way Microsoft did that with that screen, that dialog box popping up the first time and then never coming back, a lot of people are like, well, wait a minute. I don't like the choice I made. How do I get back to that and make changes on it? So, very easy to import and export settings so that you have the consistent environment across all your copies of Visual Studio. So, make sure that you use that to set up multiple copies so that you're the same everywhere you go

Hope this helps…Smile

Monday, June 06, 2011

Difference Between Add Service Reference And Web Reference?

Service References or WCF comes from VS 2008 and above with an extension as .svc and Web References are their from the beginning as .asmx.

The main difference between WCF service and Webservice while consuming, we need to add them in solution as reference to access them.

Add Web Reference is a wrapper over wsdl.exe and can be used to create proxies for .NET 1.1 or 2.0 clients. This means we are pointing to a WCF service you have to be pointing to an endpoint that uses basicHttpBinding.

Add Service Reference is a wrapper over svcutil.exe and also creates clients proxies (and additionally web.config entries). These proxies, however, can only be consumed by .NET 3.0+ clients.

Below image will show you how to add web reference from Service Reference. Right click theService References from solution explorer, then select advance button on Add Services windowyou will get to the form as in below image and then will be able to add Web Reference via Addweb Reference window..

image

But there is some things which changed in VS2010 about adding web references to a class library. So in VS 2010 you cannot add Web Reference directly.  Here is how you need to do it.

From Project -> Add Service Reference ..., (From Solution Explorer, Right Click on Project, From the drop down Menu, Select Add Service Reference)

image

This window will appear, Click advanced,

image

On Add Service Settings window, Now click on Add Web Reference

image

This will open add Web reference window from where we can add web service. Hope this helps. Good luck.

Saturday, March 12, 2011

Difference Between Build and Re-Build in Visual Studio .Net?

Build means compile and link only the source files that have changed since the last build, while Rebuild means compile and link all source files regardless of whether they changed or not. Build is the normal thing to do and is faster. Sometimes the versions of project target components can get out of sync and rebuild is necessary to make the build successful. In practice, you never need to Clean.

Build or Rebuild Solution builds or rebuilds all projects in the your solution, while Build or Rebuild <project name> builds or rebuilds the StartUp project. To set the StartUp project, right click on the desired project name in the Solution Explorer tab and select Set as StartUp project. The project name now appears in bold.

Build.BuildSolution F6 or CTRL+SHIFT+B Builds all the projects in the solution.
Build.BuildSelection SHIFT+F6 Builds the selected project
and its dependencies.

Hope this helps Smile

Tuesday, December 28, 2010

Working with the ASP.NET Global.asax file

The Global.asax file, sometimes called the ASP.NET application file, provides a way to respond to application or module level events in one central location. You can use this file to implement application security, as well as other tasks.

Overview

The Global.asax file is in the root application directory. While Visual Studio .NET automatically inserts it in all new ASP.NET projects, it's actually an optional file. It's okay to delete it—if you aren't using it. The .asax file extension signals that it's an application file rather than an ASP.NET file that uses aspx.

The Global.asax file is configured so that any direct HTTP request (via URL) is rejected automatically, so users cannot download or view its contents. The ASP.NET page framework recognizes automatically any changes that are made to the Global.asax file. The framework reboots the application, which includes closing all browser sessions, flushes all state information, and restarts the application domain.

 

Programming

The Global.asax file, which is derived from the HttpApplication class, maintains a pool of HttpApplication objects, and assigns them to applications as needed. The Global.asax file contains the following events:

  • Application_Init: Fired when an application initializes or is first called. It's invoked for all HttpApplication object instances.
  • Application_Disposed: Fired just before an application is destroyed. This is the ideal location for cleaning up previously used resources.
  • Application_Error: Fired when an unhandled exception is encountered within the application.
  • Application_Start: Fired when the first instance of the HttpApplication class is created. It allows you to create objects that are accessible by all HttpApplication instances.
  • Application_End: Fired when the last instance of an HttpApplication class is destroyed. It's fired only once during an application's lifetime.
  • Application_BeginRequest: Fired when an application request is received. It's the first event fired for a request, which is often a page request (URL) that a user enters.
  • Application_EndRequest: The last event fired for an application request.
  • Application_PreRequestHandlerExecute: Fired before the ASP.NET page framework begins executing an event handler like a page or Web service.
  • Application_PostRequestHandlerExecute: Fired when the ASP.NET page framework is finished executing an event handler.
  • Applcation_PreSendRequestHeaders: Fired before the ASP.NET page framework sends HTTP headers to a requesting client (browser).
  • Application_PreSendContent: Fired before the ASP.NET page framework sends content to a requesting client (browser).
  • Application_AcquireRequestState: Fired when the ASP.NET page framework gets the current state (Session state) related to the current request.
  • Application_ReleaseRequestState: Fired when the ASP.NET page framework completes execution of all event handlers. This results in all state modules to save their current state data.
  • Application_ResolveRequestCache: Fired when the ASP.NET page framework completes an authorization request. It allows caching modules to serve the request from the cache, thus bypassing handler execution.
  • Application_UpdateRequestCache: Fired when the ASP.NET page framework completes handler execution to allow caching modules to store responses to be used to handle subsequent requests.
  • Application_AuthenticateRequest: Fired when the security module has established the current user's identity as valid. At this point, the user's credentials have been validated.
  • Application_AuthorizeRequest: Fired when the security module has verified that a user can access resources.
  • Session_Start: Fired when a new user visits the application Web site.
  • Session_End: Fired when a user's session times out, ends, or they leave the application Web site.

The event list may seem daunting, but it can be useful in various circumstances.

A key issue with taking advantage of the events is knowing the order in which they're triggered. The Application_Init and Application_Start events are fired once when the application is first started. Likewise, the Application_Disposed and Application_End are only fired once when the application terminates. In addition, the session-based events (Session_Start and Session_End) are only used when users enter and leave the site. The remaining events deal with application requests, and they're triggered in the following order:

  • Application_BeginRequest
  • Application_AuthenticateRequest
  • Application_AuthorizeRequest
  • Application_ResolveRequestCache
  • Application_AcquireRequestState
  • Application_PreRequestHandlerExecute
  • Application_PreSendRequestHeaders
  • Application_PreSendRequestContent
  • {{{{code executed}}}}
  • Application_PostRequestHandlerExecute
  • Application_ReleaseRequestState
  • Application_UpdateRequestCache
  • Application_EndRequest

A common use of some of these events is for security. The Global.asax file is the central point for ASP.NET applications. It provides numerous events to handle various application-wide tasks such as user authentication, application start up, application error and dealing with user sessions etc. You should be familiar with this optional file to build robust ASP.NET-based applications.

Wednesday, May 26, 2010

Tips & Tricks : Visual Studio

Shortcuts Its fun and helpful. They are helpful for faster development and easy. Here are the few shortcuts that we use regularly.

Usage C# Key Description
View.ShowSmartTag CTRL + .  
Edit.ParameterInfo CTRL + SHIFT + SPACE  
Edit.Find CTRL + F Quick find
Edit.IncrementalSearch CTRL + I Incremental find
Edit.FindInFiles CTRL + SHIFT + F Find in files
Edit.Replace CTRL + H Quick replace
Edit.ReplaceInFiles CTRL + SHIFT + H Replace in files
Edit.GotoNextLocation F8 Go to next location (in search results)
Edit.GotoPrevLocation SHIFT + F8 Go to previous location (in search results)
Edit.FindNext F3 Repeat search
Edit.FindPrevious SHIFT + F3 Search previous
Edit.FindNextSelected CTRL + F3 Search for next with selected text
Edit.FindPreviousSelected CTRL + SHIFT + F3 Search for previous with selected text
     
View.NavigateBackward CTRL + - Go back to previous location (Browser-style)
View.NavigateForward CTRL + SHIFT + - Go forwards to next location
View.ViewCode F7 View code
View.ViewDesigner SHIFT + F7 View designer when in markup
View.ViewMarkup SHIFT + F7 View markup when in designer
     
Edit.CycleClipboardRing CTRL + SHIFT + V Cycle through Visual Studio clipboard
     
Edit.GotoBrace CTRL + ] Jump to opposing brace / XML tag
Edit.GotoBraceExtend CTRL + SHIFT + ] Select text to the opposing brace / tag
     
Edit.GotoFindCombo CTRL + / Jump to the find combo in the toolbar
     
Window.ShowEzMDIFileList CTRL + ALT + DOWN ARROW Show popup of all open files
     
Debug.Start F5 Start with debugger
Debug.StartWithoutDebugging CTRL + F5 Start without debugger
Debug.Restart CTRL + SHIFT + F5 Restart the program
Debug.StopDebugging SHIFT + F5 Stop debugger
Debug.RunToCursor CTRL + F10 Run to the cursor
Debug.ToggleBreakpoint F9 Set / remove breakpoint
Debug.DeleteAllBreakpoints CTRL + SHIFT + F9 Delete all breakpoints
Debug.EnableBreakpoint CTRL + F9 Enable a breakpoint
Debug.StepInto F11 Step into a method
Debug.StepOut SHIFT + F11 Step out of a method
Debug.StepOver F10 Step over a line
     
Tools.RecordTemporaryMacro CTRL + SHIFT + R Start recording a macro
Tools.PlayTemporaryMacro CTRL + SHIFT + P Playback a macro

 

If you want an even more comprehensive list of keyboard combinations, you can check out the following links, or go exploring in Tools > Options > Keyboard in Visual studio.

C# Keybindings

VB Keybindings

Thursday, January 03, 2008

VS 2008 Features and support

The official name for the .NET Framework "Orcas" release will be called .NET Framework 3.5 (it includes the new LINQ support, integrated ASP.NET AJAX support, new ASP.NET data controls, and more).

Multi-Targeting

Past few releases of Visual Studio, each Visual Studio release only supported a specific version of the .NET Framework. For example, VS 2002 only worked with .NET 1.0, VS 2003 only worked with .NET 1.1, and VS 2005 only worked with .NET 2.0.

One of the big changes starting with the VS 2008 release is to support "Multi-Targeting" - which means that Visual Studio will now support targeting multiple versions of the .NET Framework, and developers will be able to start taking advantage of the new features Visual Studio provides without having to always upgrade their existing projects and deployed applications to use a new version of the .NET Framework library.

Now when you open an existing project or create a new one with VS 2008, you can pick which version of the .NET Framework to work with - and the IDE will update its compilers and feature-set to match this. Among other things, this means that features, controls, projects, item-templates, and assembly references that don't work with that version of the framework will be hidden, and when you build your application you'll be able to take the compiled output and copy it onto a machine that only has an older version of the .NET Framework installed, and you'll know that the application will work.

Creating a new project in VS 2008 that targets .NET 2.0. While creating a project you can notice with dropdown with different .NET framework in it. You can select what type of Framework you want to use.After you select the framewrork, it will automatically filter the project list to only show those project templates supported on machines with the .NET 2.0 framework installed. If you create a new ASP.NET Web Application with the .NET 2.0 dropdown setting selected, it will create a new ASP.NET project whose compilation settings, assembly references, and web.config settings are configured to work with existing ASP.NET 2.0 servers.

why use VS 2008 if you aren't using the new .NET 3.5 features?

Well, the good news is that you get a ton of tool-specific value with VS 2008 that you'll be able to take advantage of immediately with your existing projects without having to upgrade your framework/ASP.NET version. A few big tool features in the web development space I think you'll really like include:
  • JavaScript intellisense
  • Much richer JavaScript debugging
  • Nested ASP.NET master page support at design-time
  • Rich CSS editing and layout support within the WYSIWYG designer
  • Split-view designer support for having both source and design views open on a page at the same time
  • A much faster ASP.NET page designer - with dramatic perf improvements in view-switches between source/design mode
  • Automated .SQL script generation and hosting deployment support for databases on remote servers

And also, you can upgrade or downgrade to any version on .NET framewrok by pulling properties and selecting the desired framework you want. This will automatically remove the newer assembly references from your project, update your web.config file, and allow you to compile against the older framework (note: if you have code in the project that was written against the new APIs, obviously you'll need to change it).

What about .NET 1.0 and 1.1?


Unfortunately the VS 2008 multi-targeting support only works with .NET 2.0, .NET 3.0 and .NET 3.5 - and not against older versions of the framework. The reason for this is that there were significant CLR engine changes between .NET 1.x and 2.x that make debugging very difficult to support. In the end the costing of the work to support that was so large and impacted so many parts of Visual Studio that we weren't able to add 1.1 support in this release.
VS 2008 does run side-by-side, though, with VS 2005, VS 2003, and VS 2002. So it is definitely possible to continue targeting .NET 1.1 projects using VS 2003 on the same machine as VS 2008.

Monday, September 17, 2007

VS 2008 and .NET 3.5 Beta 2 Released

I'm very pleased to announce that the Beta 2 release of VS 2008 and .NET 3.5 Beta2 is now available for download. You can download the Visual Studio 2008 product here. You can alternatively download the smaller VS 2008 Express Editions here.
VS 2008 and Visual Web Developer 2008 Express can be installed side-by-side with VS 2005. .NET 3.5 Beta2 also includes a go-live license which allows you to build and deploy applications into production.