Showing posts with label Visual Studio. Show all posts
Showing posts with label Visual Studio. Show all posts

Sunday, January 30, 2011

How to Write a Macro in VS 2010

 

We all knows that how much friendly the macros are. Here I am showing a small example of how to write macro to Disable and Enable macros.

 

When debugging projects.Its difficult to add and remove break points all the time. This is a simple macro which enable and disable the Breakpoints

First thing is how to write a macro

Step1: Select Tools –> Options –> Macros –> Macro Explorer (Alt+F8)

image

Step2: Double click on the module created.(Here it is Module2)

image

Step3: Write your Macro Code

image

Step4 : Build the Macro code

 

How to add the Macro created to VS10

Step 5: go to vs10 Project(Take a new one not in Macro) Tools –> Options

 

image

Step 6: Under Environment Variables –> Keyboard –> in Show Commands containing –> Select the macro you created.

image

 

Step 7: Type the key combination then click Assign and then Ok

 

image

Finally: Go to VS and Press the key combination (in the example I shown only for Enable, for disable also do the same step)

 

Hope this will help you.

Wednesday, September 15, 2010

Track Changes in Visual Studio

 

Today I have noticed a nice future in visual studio Track Changes.

 

When you change some code portion in visual studio in says whether you saved it or not. Here is the example for the same.

First I enable the Track Changes in Visual studio. For that go to Tools –> Options –> Text Editor –> General –> (Select) Track Changes.

Track Changes

 

If you type something in code without saving it will come with a yellow line in the margin.

 

B4Save

 

Once you save this yellow changes to Green.

 

AfterSave

 

Summary: This is a nice feature in Visual studio to help us to where we have done the changes in the code before saving the code (Comes as yellow). As well as we come to know which is the last saved one ( comes in green)

Wednesday, June 9, 2010

Enable javascript Debugging in IE

To enable javascript in IE, do the following steps

Open IE –> Tools –>  Internet Options –> Go to Advanced Tab –> uncheck Disable script debugging(Internet Explore)

Javascript

Note: uncheck Disable script debugging(other) to enable debugging in other scripts.

Now open visual studio and put break point in the javascript where you want and runt it once the scripts fire the break point also will hit.

Thursday, May 20, 2010

Unable to load DLL ‘FileTracker.dll’

 

Last two days i am getting the error Unable to load DLL ‘FileTracker.dll’ when i create windows application ,getting this error not for other projects.

I am using visual studio 2010 B2 in a Windows 7 machine.

How i resolved the issue 

I installed in visual studio 2010 B2 in C:\Windows\Microsoft.NET\Framework

There where two folders v4.0.21006 and v4.0.3004. I deleted the v4.0.3004(which is not required). If you want to come out from this problem delete the higher version of v4.0.21006 folder,Which is not required.

Now it is working fine.

Wednesday, May 19, 2010

operation could not be completed – Visual studio 2010

Today i was working on visual studio i got one error: operation could not be completed

how i resolved

open the run(windows + r) type

C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe  /resetuserdata

Press enter –> now its working fine :)

Wednesday, September 30, 2009

Microsoft Visual C# 2008 Compiler could not be created

 

Today i got the error(‘Microsoft Visual C# 2008 Compiler could not be created. QueryService for '{7D960B16-7AF8-11D0-8E5E-00A0C911005A} failed’) when i try to open my existing project in Visual Studio.I repaired my Visual Studio 2008 using VS 2008 CD.But the same error :(.

Then i googled it . i got the solution .

Solution

  1. open command prompt
  2. Navigate to C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE (if your visual studio is installed in the corresponding location)
  3. type devenv /ResetSkipPkgs

Note ResetSkipPkgs

Now my problem is solved :)

Sunday, September 6, 2009

How to copy code from Visual studio to Html page

When i am give some code snippets its not a good way to read for readers.And when i go to see some other blogs they are given the code in very easily and neat way.Today i got the solution,am sharing the same with you all.

Steps to follow

Step 1 : Get the Addins from here
Step 2 :Extract it to your Visual studio Addins folder(C:\Users\anishmarokey\Documents\Visual Studio 2008\Addins) ,if the Addins folder is not there create it.
Step 3 : Open visual studio,click in Tools -> Add-in Manager



Step 4 :Add-in Manager a message box will come.Checked the check box for "Copy as HTML" and click ok.



Step 5 :Now you can select any code and when rigth click "Copy As HTML" as shown


Step 6 : Paste in your blog.It looks like as shown below

6 static void Main(string[] args)

7 {

8 }


Saturday, August 22, 2009

entity framework model

Entiry FrameWorkModel

.edmx is an xml file that defines an Entity Data Model (EDM) ,Describe the target database schema ,and defines the mapping between the EDMI and the database.An .edmx file also contains information that is used by the ADO.NET entry datamodel Designer to render a model graphically.

How to Add .edmx File in a visual Studio project ?

Right Click on Solution Explorer -> New Item -> Select ADO.NET Entity Data Model .As shown in the figure




Note : In MVC application the .edmx file can be added in the Model .So it act as a Model for MVC

In Entity framework model it is same as LINQ to SQL .But here we can mix and match a number of different database vendors ,application servers or protocols to design an aggregated mash-up of objects which are constructed from a variety of tables,sources services etc.ADO.NET is released with .Net Framework 3.5 service pack 1.

Saturday, August 15, 2009

Linq to Sql Debug Visualizer

Probably the biggest programming model improvement being made in .NET 3.5 is the work being done to make querying data a first class programming concept. We call this overall querying programming model "LINQ", which stands for .NET Language Integrated Query.Read More

Wednesday, August 12, 2009

Assembly Binding Log Viewer (Fuslogvw.exe)

The Assembly Binding Log Viewer displays details for assembly binds. This information helps you diagnose why the .NET Framework cannot locate an assembly at run time. Read more

Monday, August 3, 2009

Visual studio Background Images

Try this out to change the style of visual studio and Get Coding reports and related.

Friday, July 31, 2009

Web site vs Web Application

visual studio 2003 : Introduced Web Application model .
Note :It has static Compilation

Visual studio 2005 : Introduced WebSite project type was introduced .
Note :
  • It contains both web Application Model and webSite model.
Visual studio 2008 : Supports both types of project

Web Site model and Web Application

  • And is based on folder model .After SP1 project file was introduced in visual studio 2005.
  • WebApplication project is more structured than web site project.
  • Class file shuuld be placed inside the App_Code.
  • Web Application project type is restricted to one language .Where as web site supports multiple languages,Because web site is compiled dynamically.
  • web site supports multiple lanuages files ,but those files need to be in the same folder .So the changes required in the webconfig.
E.g:



  • When deploy web Applicaton you can just copy the compiled elements and visual elements to the iis folder..Where as website we need to copy everything to the iis to work.
  • Code behind pages was introduced in visual studio 2005.Where we can create both the files(with code behind and with out code behind paes)
  • Partial class was also introduced in visual studio 2005
Dynamic compilation in Website

When you sent a request for a ASP.Net page,Frame work checks for the corresponding page and if the class is not exists ,Frame work compiles the page into a new .Net class and the stored the compiled class into the temporary ASP.Net folder located at

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files

In future if a request comes to the same page ,the page is not compiled again .The previously compiled class is executed and returns to the browser.This process is called ASP.Net dynamic compilation.
If Asp.Net page is modified corresponding to .Net class is automatically deleted and when a new request comes for that page it compiles the modified page into a new .Net class.

To change compiled in Web site are as follows as

  • change the compilation mode using the page
E.g:




  • To change compilation mode using webconfig
E.g :



Sunday, July 19, 2009

Visual Studio Short Cut Keys

Shortcut keys are easy to navigate,Increase productivity ,etc .... :)

These are the short cut keys i like in visual studio

  • To understanding the code
Class view : [ctrl-w] ,[ctrl -c]
Note : helps to see the class view.
Create Class diagram (by adding .cd file to the project)
Note : This will display the class diagram created.copy and paste the necessary methods ,properties from one class to another class.

  • Navigate through code

F12 : GoTODefinition
shift -F12 : Show all the reference to a symbol
F8:Cycle through list of items in the currently active output window
shift - F8 : same as F8 but opposite in direction

ctrl - m ,ctrl- m: collapses /expand the method the cursor is currently in
ctrl -m,ctrl-o : collapse all methods to the outline view

ctrl - -(minus) : moves to the cursor previous location
ctrl - shift - -(minus) :moves to the cursor last location

ctrl - F :find menu
ctrl - H : find and replace
ctrl - i :incremental search
ctrl - shift - F : find in all files

  • Modify code

ctrl -k, ctrl - c : command out the selected code
ctrl -k ,ctrl - u : uncommand out the selected code
ctrl-k ,ctrl -f :auto format the selected code

ctrl - R ,ctrl - M :extract method
ctrl -R,ctrl - E :encapsulate field
ctrl- R ,ctrl -l :extract interface
F2 :Rename

  • Debugging code

F10 :step over
ctrl - F10 :Run to cursor
F11 :step into
shift - F11 : step out
F9:toggle a break point
F5 :Run with debugging
Shift - F5 :stop debugging
ctrl-F5 :Run without Debugging


 
Counter