visual-studio

Is there a shortcut to swap/reorder parameters in visual studio IDE?

I have a common issue when working with code in the IDE: string.Concat("foo", "bar"); and I need to change it to: string.Concat("bar", "foo"); Often I have several of these that need to be swapped at once. I would like to avoid all the typing. Is there a way to automate this? Either a shortcut or some sort of macro would be grea...

Visual Studio macro that references current project

I want to do the following in my macro: Dim selection As EnvDTE.TextSelection = CType(DTE.ActiveDocument.Selection, EnvDTE.TextSelection) Dim selType As Type = Type.GetType(selection.Text) // do some stuff with the type But the problem is that the macro editor doesn't have a reference to my project, so it can't figure out how to get i...

Debugging a foreach loop in C#: what iteration is this?

Other than setting a debug variable and incrementing it every time you start the foreach, when you break in with the visual studio debugger connected, is there any way to tell that this is the Xth time through the loop? I guess this would be a feature of visual studio if anything, not something that would be added to the compiled code....

Multi monitor support in Visual Studio 2010

I hear that Visual Studio 2010 has "Multi-Monitor Support". Yet now that I am using it, I see no difference from VS2008. I still have to resize all my windows when switching from one monitor to two and back again. Is there somekind of Profile or setting I am missing? For example, Delphi lets you save desktop profiles that record wher...

in Visual Studio, how do I set the default access modifier to private instead of protected when automatically creating new eventhandlers?

While developing and ASP.NET application in C# or VB using Visual Studio 2005/2008/2010 (Not a problem in 2003), if I create a new method automatically by double-clicking on a control in the designer or picking the new method in the code editor dropdowns (VB only), the access modifier is always protected instead of private. This is anno...

NCover code coverage result for deliberately failing tests

I have a couple of unit test helper extension methods, such as, IsNotEmpty(this string str) for which I have also written unit tests. The basic structure of these tests is that I have one test that verifies that the extension method passes and returns the expected result on a "good" input, and one that verifies that a fail exception is t...

How do I disable (or change) keyword highlighting in comments?

I am using Visual Studio 2008, and Resharper 5.0: There are certain keywords such as note, bug, and todo that are highlighted within comments that I would like to disable or at least alter the highlight color and/or specify keywords. However I can't find any settings in Visual Studio's Fonts and Colors options nor in Resharper's option...

Select code window after compiling

When I am working on a project and compiling all the time, it gets very annoying having to select the code window with the mouse each time after compiling, is there a keyboard shortcut in visual studio to select the code window? ...

How can I programmatically read what version of software I am using?

How can I programmatically read what version of software I am using? If I use MSVS to create a project, and that project includes a resource (.rc) file and the version is specified in that file, how can I use code to "read" the version information? IE. If I want the software to report what version it is when it is run, and the only pla...

Weird error message when running my application

Guys I created a console application in Visual Studio 2010. It targets the .NET framework 2.0. When I run the application is Visual Studio, it works perfect. I then exited Visual Studio and copied the executable to my C:\Windows\System32 directory. When I open a command prompt window and try to execute my program, it comes up with a stan...

How do I change the language (specifically from french to english) in Visual Studio 2008's compiler output.

At first I had the french version of VS, then I installed the English version on top of it; so now I have the menus in English, but the compiler still outputs in French. Changing the language in 'Tools > Options > Environment > International Settings' doesn't help. ...

Entity framework: Using transaction scope and querying

Hi, I'm using entity framework with oracle DB. I tried to use transaction scope (because I want the option to rollback): using (TransactionScope ts = new TransactionScope()) { ..... } The problem is that when I'm trying to query inside the using statement, an exception is thrown: "Unable to load DLL 'oramts.dll': The specified...

How to know that the application is launched by debugger (VisualStudio) C#

Hi all, In my c# code I'd like to know whether the app has been launched by the debugger (in my case VisualStudio). Does anyone know how to get this information? TIA ...

Why ought I not to install Visual Studio on my CI server?

A lot of people new to CI (Continuous Integration) install VS (Visual Studio) on their CI server "because it is required to compile the code". MSTest is a common reference brought up here. Why should I not install VS (or generally speaking, any software not out-of-the-box) on my CI server? (This question has not been asked before appar...

Compiling x64 dll from x86 using Visual Studio 2008

Hello gurus, I am compiling some external C++ code into a dll using Visual Studio 2008. The code is wrapped in extern "C". Since I am cross compiling, creating a 64 bit dll on my 32 bit machine; I am using x64 as "Active solution platform" in the "Configuration Manager". My dll compiles and links successfully. However when I open it ...

Visual Studio build error: claims member of class in other assembly doesn't exist

Hi all I have a website solution which contains a project with domain classes. I have added a public auto property (get; set;) to one of the domain classes. A page on the website references this property - it was added to the page using IntelliSense. The website project builds okay. But when I build the solution, I get the old 'Class ...

How to automatically deploy Visual Studio database project after build

I'm trying to automate the build process of a database project so that it would automatically be deployed to a database server against which I could run database unit tests. I'm really new to developing databases with VS so this might be obvious, but I can't find a way to make the project be automatically deployed after it is built. I us...

VS corrupted .sln file?

When I try to open my .sln file, Visual Studio quits on me. I can open it by opening up TFS, getting a specific version, choosing the latest version, forcing an overrwrite, opening up the .sln file, and then ignoring an 'incompatible doc message". However, I would like to know what's wrong and how it can be fixed, in case some day I can...

Visual Studio problem with deploying all files of .NET Compact Framework application

My application consist of an executable project and a dll library. My executable project has added the reference to the library project. The library project contains some "content" files like .ini .bmp. The problem is that these files are not copied to the device when I deploy the executable project. Only dll file is copied. The curiou...

Why would you choose SharpDevelop over Visual Studio for coding in C#?

I've encountered SharpDevelop a few times before but I don't know anyone who actually programs in it. Would you recommend it for medium size projects in C#? Subquestions: Is there a difference in speed of compiling? (Article is about multi-threading compliling in SharpDevelop) Thanks for answers! ...