All Questions

Tagged with
Filter by
Sorted by
Tagged with
38 votes
6 answers
32k views

Visual Studio macro to find a string and delete matching lines

In my Visual Studio (2010 C#) solution, I need to delete all lines of code that contain a matching string pattern. For example, I want to delete all lines that contain ".BackColor = System.Drawing....
Hadster's user avatar
  • 465
31 votes
5 answers
87k views

Is max(a,b) defined in stdlib.h or not?

I'm using two computers, each with a different version of visual studio. On the visual studio 2008 computer my code compiles. On the visual 2010 computer my code doesn't compile because I'm using the ...
snakile's user avatar
  • 53.8k
22 votes
5 answers
65k views

How to prevent macro redefinition

After working some time on my project, this warning begins to appear: 2>Game.cpp 2>c:\program files\microsoft sdks\windows\v6.0a\include\windef.h(126) : warning C4005: 'APIENTRY' : redefinición ...
Killrazor's user avatar
  • 7,006
22 votes
4 answers
12k views

List of the $(xxx) macro in visual studio

I would like to establish a list of all the visual studio macro that can be used in the post-build event script. $(Configuration) : Name of the current build configuration (ie: Debug or Release).
Martin Delille's user avatar
21 votes
1 answer
4k views

How do I use macros for the command line arguments for debugging a .NET project?

In the Visual Studio Debug property page (for a .NET 4 project) I want to be able to specify macros, e.g. $(OutDir), like I can in the Build Events. But it doesn't work, the macros aren't replaced. ...
Ray's user avatar
  • 46.1k
20 votes
4 answers
27k views

Cross-platform defining #define for macros __FUNCTION__ and __func__

Compiling with gcc 4.4.2 and WinXP Visual Studio C++ 2008 #if defined ( WIN32 ) #define __FUNCTION__ __func__ #endif As I want to use the macro to display the function name. I have done the above ...
ant2009's user avatar
  • 25.5k
19 votes
3 answers
20k views

how to expand VC++ macro references using Visual Studio?

Rather than right clicking on the macro identifier and then on "go to definition", is it possible to expand macro references and see what the code that is passed to the compiler looks like?
J Smith's user avatar
  • 2,385
13 votes
3 answers
24k views

Using UNREFERENCED_PARAMETER macro

I'm using \W4 warning level on Visual Studio and I'm writing a Windows program. int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) All these parameters ...
LppEdd's user avatar
  • 20.6k
13 votes
2 answers
5k views

auto format all files in solution in visual studio 2010

I'm trying to auto-format all files in my solution in vs2010. I've seen there is no built-in option to do it. I've tried to write macro to do it, but I've stucked. When I iterates any ProjectItem in ...
ayo's user avatar
  • 131
11 votes
4 answers
1k views

How to Paste as Comment in VS2010?

This is a micro optimization that I'd have in my ideal IDE - the ability to paste from the clipboard directly into the editor as a comment. The idea is sometimes I feel like I lose entire seconds to ...
Aaron Anodide's user avatar
11 votes
2 answers
474 views

What makes this header file slow VS2005 to a crawl? (IntelliSense exonerated?)

I was experimenting with a C++ project using the Compile Time Hashing technique I found here. The macros work as expected, and the compile time is reasonable, but the 64 recursive macros seem to ...
AShelly's user avatar
  • 35k
10 votes
2 answers
7k views

Visual Studio: Macro for checking configuration type (exe/dll)

Is there a macro I can use for checking the current configuration type in visual studio? Depending on the current setting I'd like to either include a main or dllmain function: #IFDEF ...
Pedro's user avatar
  • 4,120
9 votes
5 answers
5k views

Do you have any recommended macros for Microsoft Visual Studio? [closed]

What are some macros that you have found useful in Visual Studio for code manipulation and automation?
9 votes
1 answer
2k views

Assign keyboard shortcut to Visual Studio 2010 custom macro

I had a macro (http://weblogs.asp.net/koenv/archive/2008/02/14/quick-attach-and-detach-debugger.aspx) in Visual Studio 2008 that attaches the debugger to IIS (for ASP.NET/WCF development). I assigned ...
Koen's user avatar
  • 3,636
9 votes
2 answers
2k views

Is there a method to swap the left and right hand sides of a set of expressions in Visual Studio?

I have a decent sized set of data that needs to be stored in an active record. In order to prepopulate the form fields on the page, I have already written the following code: Device device = new ...
John Rasch's user avatar
9 votes
2 answers
8k views

DTE.ExecuteCommand and wait

I would like use macros for publishing my webapplication project. The little problem is, DTE.ExecuteCommand run asynchronously, and I need to wait until the command is done. Example: DTE.Windows....
TcKs's user avatar
  • 26.2k
9 votes
0 answers
385 views

What macros are available .editorconfig's file_header_template?

I do know that {filename} macro refers to the actual file name in a .editorconfig's file_header_template. I am wondering if is there any other macro utility? I would like to insert the current year ...
g.pickardou's user avatar
  • 33.9k
8 votes
4 answers
11k views

Visual Studio macro: Find files that aren't included in the project?

I'd like to write a macro to crawl through the files in my project directory and find files that aren't included in the project. In playing around with the DTE object, I see that the Project object ...
Herb Caudill's user avatar
  • 49.8k
8 votes
4 answers
3k views

Macro to wrap selected text with tags in Visual Studio

I realize that I may be being a bit lazy, but does anyone know of a Visual Studio macro, where I can select some text inside of the Visual Studio IDE, click a button, and have it wrap the selected ...
mattruma's user avatar
  • 16.6k
8 votes
1 answer
4k views

Is there a macro defined when IntelliSense is parsing?

Every compiler has a macro like __BORLANDC__ defined that enables the programmer to activate or deactivate certain behaviour or workarounds. Is such a macro defined while IntelliSense parses files so ...
iFreilicht's user avatar
  • 13.9k
8 votes
1 answer
9k views

Detect ARM-64 in preprocessor?

According to Microsoft (here and here), the company will support ARMv8/Aarch64 (ARM-64) in upcoming version of Windows 10. Additionally, Microsoft has already supplied previews so I'm guessing tool ...
jww's user avatar
  • 100k
8 votes
2 answers
4k views

How to define a template for adding multiple files to a project?

My new project is my first look at WPF MVVM and WCF and I like it but it seems like I am creating a lot of files, always in the same basic setup and structure. I am wondering if anyone has a way of ...
GP24's user avatar
  • 867
8 votes
2 answers
1k views

Cross platform way to include system header files, when there is an identically named file in path?

I am trying to get Bloomberg's BDE library to compile in Visual Studio 2015. Because they re-implement the standard libraries typically provided by the compiler, there are header files that have names ...
GBleaney's user avatar
  • 2,136
7 votes
5 answers
4k views

Visual Studio Breakpoint Macro to modify a value?

I'm debugging an application (C++), and I've found a point in the code where I want to change a value (via the debugger). So right now, I've got a breakpoint set, whereupon I do: Debugger reaches ...
Tim's user avatar
  • 9,022
7 votes
2 answers
3k views

How to disable Visual Studio macro "tip" balloon?

Whenever I use a macro in Visual Studio I get an annoying tip balloon in the system tray and an accompanying "pop" sound. It says: Visual Studio .NET macros To stop the macro from running, ...
Owen's user avatar
  • 7,656
7 votes
4 answers
4k views

Retrieve output target name as a string at compilation time in C++

I have a project which compiles in multiple platforms... Windows, Unix, Linux, SCO, name your flavor. I would like to stuff the output target's name into a variable in the project source code (the ...
Allbite's user avatar
  • 2,467
7 votes
2 answers
3k views

getting projectDir as a string or char* in c++

I saw a couple of questions relevant to this topic, but I didn't found the easy and common way to do this. My question is: How can I have $(projectDir) or another Macro as a string or char* in my C++ ...
mbaros's user avatar
  • 825
7 votes
2 answers
2k views

How Do I Copy Comments When Generating an Interface From a Class In Visual Studio?

In Visual Studio I can use the Refactor -> Extract Interface... option to generate an interface from public methods on a class. However this does not copy across the XML comments and I end up spending ...
James's user avatar
  • 809
7 votes
2 answers
1k views

emacs style keyboard macros in visual studio

I'd like to use emacs style keyboard macros in Visual Studio, which for the most part I can do through these shortcut mappings... but I can't figure out a keyboard shortcut to repeat the next command ...
tbischel's user avatar
  • 6,407
6 votes
3 answers
2k views

Is there a way to generate multiple files through one template/macro with Resharper?

When I write my APIs for applications I always follow a set pattern (who doesnt!?) that looks like this: User (Folder/Namespace) User.cs UserDao.cs UserDaoFactory.cs UserService.cs ...
SventoryMang's user avatar
  • 10.4k
6 votes
1 answer
1k views

Run macro until the end of the file in Visual Studio

Is there some AddIn or extension for Visual Studio 2008 that will allow me to run Macro until the end of the file? I really hate holding CTRL+SHIFT+P and waiting until end of the file is reached.
nikib3ro's user avatar
  • 20.5k
5 votes
6 answers
16k views

Is it possible to set preprocessor macro in sln file and not in a project? (VS2008 c++)

I am maintaining a large codebase and some vcproj files are used in different solutions. Due to some horrendous configuration and dependencies it seems the best way to handle some build issues is to #...
Tim's user avatar
  • 20.3k
5 votes
2 answers
3k views

Visual Studio Macro: How to perform "File -> Save All" programatically

I am looking for the equivalent of running "File -> Save All" before certain Rake macros. What I have so far is: Private Sub Pre_Rake() Dim i As Integer DTE.Documents.SaveAll() ...
Sean B's user avatar
  • 353
5 votes
2 answers
8k views

#ifdef _DEBUG in main function

Does #ifdef _DEBUG in the main function has any sense if I am working on visual studio 2013 ? If yes, what it is for ? int _tmain(int argc, _TCHAR* argv[]) { #ifdef _DEBUG //creating some objects, ...
davoid's user avatar
  • 327
5 votes
3 answers
971 views

Load search URL in browser from Visual Studio

I'm finding the built-in Visual Studio Document Explorer less relevant, especially as more of the SDKs I work with have the most up-to-date content on-line. Pressing F1 starts Document Explorer ...
Alex Angas's user avatar
  • 59.7k
5 votes
2 answers
2k views

Change the Target Framework for all my projects in a Visual Studio 2008 to 3.5 [duplicate]

Possible Duplicate: Change the Target Framework for all my projects in a Visual Studio Solution I have a just converted a Visual Studio project from 2005 to 2008 to take advantage of the .NET 3.5 ...
Ryan Spears's user avatar
  • 3,001
5 votes
2 answers
2k views

Can I create a Visual Studio macro to launch a specific project in the debugger?

My project has both client and server components in the same solution file. I usually have the debugger set to start them together when debugging, but it's often the case where I start the server up ...
Jason Diller's user avatar
  • 3,358
5 votes
1 answer
1k views

Visual Studio enable debug exceptions through macro

In Visual Studio I would like to break on certain exception while in debug mode. This is configured through the "Debug >> Exceptions" dialog window (see image below). Can enabling and disabling ...
Aaron Hoffman's user avatar
5 votes
2 answers
616 views

Macro in visual Studio 2010 that loads settings file

I'm just looking for a way (maybe a macro?) to load a settings file. Ideally I'd like to be able to run this as a shortcut from the desktop too. I googled it, but maybe I didn't hit the right keywords....
roundcrisis's user avatar
  • 17.4k
5 votes
1 answer
3k views

How do I run a TFS Work Item Query with Visual Studio Macros

I'm trying to write a Vistual Studio 2008 macro to run a stored TFS query and display the results. Previously I've created a query and named it 'Assigned to Me' to display all the work items currently ...
MrBry's user avatar
  • 392
5 votes
1 answer
885 views

Is there an equivalent of DoEvents in Visual Studio macros?

I've got a long-running macro, in which I write periodic messages to Output just so that the user know somethings happening. The problem is that the output doesn't get shown until the macro has ...
Benjol's user avatar
  • 65.2k
4 votes
9 answers
4k views

Is it possible to have identically named source files in one visual studio c++ project?

I'm working on a static library project for a c++ course I'm taking. The teacher insists that we define only one function per source file, grouping files/functions belonging to the same class in ...
TC.'s user avatar
  • 4,153
4 votes
1 answer
2k views

How to know where a certain macro is defined in Visual Studio

I currently have a visual studio project that uses DirectX. There are some macros in the code such as __range(0, m_lBatchSize) LONG m_nBatched; __field_ecount_opt(m_lBatchSize) IMediaSample ** ...
James Franco's user avatar
  • 4,606
4 votes
2 answers
3k views

Strange syntax error C2143 in Visual only (missing ';' before 'type')

I'm getting a strange compilation error for a C code in MSVC only. More precisely: error C2143: syntax error : missing ';' before 'type' C2143 is a fairly generic error, and there are myriad of ...
Cyan's user avatar
  • 13.5k
4 votes
2 answers
3k views

Run Visual Studio 2008 Macro on Pre Build Event

I have some Visual Studio Macros created in visual studio which run from the macro explorer and/or keyboard shortcuts. I would like to run these automatically on pre/post build events but see no ...
Jason Irwin's user avatar
  • 2,035
4 votes
3 answers
3k views

How to create a C macro for appending /n to every printf

MY_PRINT is a macro throughout the code, which just does printf. I want to temporarily modify it to also append \n after every printf. However, when I do this: #define SENS_PRINT(x) printf(x);...
Doug Null's user avatar
  • 8,141
4 votes
2 answers
4k views

Visual Studio user-defined property sheet macros in C#

I have inherited a C# solution where the projects have a configured "Post-build command line". In this command line, there are a couple of user-defined property sheet macros that copy various output ...
Tim Williams's user avatar
4 votes
1 answer
1k views

Get cursor location when running Macro in visual Studio

I've got a Macro that I run that writes a copyright header to my document. Currently when the header is written, the cursor is left at the end of the header. What I'd like to be able to do is ...
Chase Florell's user avatar
4 votes
1 answer
2k views

Visual Studio: Clean and rebuild with one macro

I am trying to optimize my work with VS by creating some macros. Currently I have the following macros: Public Sub ReleaseBuild() DTE.ExecuteCommand("Build.SolutionConfigurations", "Release") ...
Kiril Stanoev's user avatar
4 votes
1 answer
2k views

Options for defining preprocessor macros with parameters for entire project or solution in Visual Studio

I want some macros having parameters to be available in all files in a project or better a complete solution. In VS2010, if I add them to the Preprocessor Definitions in properties->Configuration ...
Jim Monte's user avatar
  • 111

1
2 3 4 5 6