visual-studio,preferences,options , Visual Studio 2013 code snippets / code templates

Visual Studio 2013 code snippets / code templates


Tag: visual-studio,preferences,options

I.e. in eclipse there is a place where I can define my own user keywords for autocomplete like:

word: else

And template to paste:

else {

Sorry if this is naive but so far I'm unable to discover such feature in Visual Studio. Does any one of You know where I could find that feature?


In Visual Studio these are called "Code Snippets". This feature is not related to IntelliSense.

There are a number of them built in, for example in C# if you type "ctor" it will create a simple constructor for the class you are in. For other C# snippets see here.

You can create your own as well.

Have a look here:


How to Customize Visual Studio Setup

I have created a video chat application in c#. Now I wan to make a setup of it. I have created a setup using Visual studio's setup project but my client told me to customize the setup progress bar styles and other properties. i dont know how to do it....

Proget Server Up but Feed Inaccessible in Visual Studio

We have reinstalled ProGet as we rebuilt our server after a security hole was discovered (unrelated to ProGet). The feed is visible in the browser, but inaccessible in Visual Studio. While rebuilding our server, we have ProGet running on a temporary Azure server, which is working and serving our NuGet...

Azure : HOWTO/BEST-Practice : Publish WebApp with Webjob using blobs Q's to multiple destinations?

I have a webapp that I publish from VS. I have 3 publishing profiles (Test, Demo and Production). Each targets a different server on Azure, with it's own SQl behind it. I added a webjob using Queue's and Blob-storage. Again for test, demo and production I create 3 different storage...

Msbuild now to conditionally use one of two targets with same name

I've seen some answers to a similar question but not exactly the same and not with positive luck trying to use suggested solutions... so I'm trying something like this: <project> <target name="foo" Condition="'$(Configuration)' == 'Debug' "> <Message Text="=== RUNNING FOO DEBUG TARGET ===" /> </target> <target name="foo" Condition="'$(Configuration)' == 'Release'...

Include file in solution explorer without it being a build dependency

How can I include a file in the list of files in solution explorer without including it as a dependency for compilation? I have a .targets file that generates .cs files, similar to the examples in this answer. <Project xmlns=""> <PropertyGroup> <CoreCompileDependsOn>$(CoreCompileDependsOn);GenerateCode</CoreCompileDependsOn> </PropertyGroup> <ItemGroup> <Sources Include="..\sources\*.txt" /> </ItemGroup> <Target Name="GenerateCode"...

Form close event in visual studio c#

I had an problem with my application closing in c#. When I hit the close button it display twice or more times the message box. What should I do? private void home_FormClosed(object sender, FormClosedEventArgs e) { DialogResult dialog = MessageBox.Show("Are you sure you want to really exit ? ", "Exit",...

Using Try/Catch block to set file path?

I'm having a bit of trouble figuring out an assignment for my Visual Basic course. I am told to assume that a given text file is not in the \bin\Debug folder of my program, so I am trying to throw an exception error and get the correct path from the...

Linker error compiling DX10 program in Visual Studio 2015

I am trying to compile old program which works with DirectX 10. Full list of libraries used: #pragma comment(lib, "d3d10.lib") #pragma comment(lib, "d3dx10.lib") #pragma comment(lib, "dxgi.lib") #pragma comment(lib, "dxerr.lib") #pragma comment( lib, "dxguid.lib" ) Linker error: dxerr.lib(dxerrw.obj) : error LNK2019: unresolved external symbol _vsnwprintf referenced in function "long __cdecl StringVPrintfWorkerW(unsigned...

SQL server & Visual Studio

i need help with SQL server in visual studio. I can't seem to connect my visual studio with internal SQL server. I had created a database with visual studio earlier and it was working fine but now i'm getting an error saying; "The attempt to attach to the database failed...

Translate this float value into english

So I was debugging in VS and I found this to be the value of a float variable -1.#INF0000 What is it? negative infinity? If not then what's the INF mean?...

TFS Build - Get Assembly Version Info

Is there a simple way to set the TFS Build Number to be an Assembly Version during build? I've seen many examples of the other way around (i.e. a build number updates the assembly version). We already use the SharedAssemblyInfo implementation from here, so we would like to leverage this...

C# SocketException was unhandled

I just went through a YouTube tutorial on tcpip servers and clients and was using the code from it: both part 1 and part 2. I have redone the code twice and have made sure that everything is the same. Whenever I run the server I get the error...

How to map Visual Studio shortcut keys in Github Atom

How to map the shortcut keys in GitHub Atom just like Visual Studio. If anyone have keymap file kindly share. I tried to implement (Ctrl+K ,Ctrl+C) in github atom for comment. It didnt work. Also Ctrl-K,Ctrl-U to turn off comment 'atom-text-editor': 'ctrl-k+ctrl-c': 'editor:toggle-line-comments' ...

Regex to find C# async methods with missing “Async” suffix?

In C#, one of the conventions for asynchronous methods (those marked with the async keyword) is that their names should end with an "Async" suffix: public async Task MyMethod(/* params */) ... <-- Bad, missing "Async" suffix public async Task MyMethodAsync(/* params */) ... <-- Good, as per convention I've...

Node.d.ts issues errors using typescript compiler, how do I fix?

I have a project that's a NODE console application project using Visual Studio 2013. When I compile the solution I'm getting typescript errors as follows: Typescript wants a semicolon after export interface ReadableStream extends EventEmitter { readable: boolean; read(size?: number): string|Buffer; //Like this ----> read(size?: number): string;|Buffer; Which means I...

Where to store an mp4 file in my project?

I have been studying for a couple of months now and I want to try something new. I have this sample project to try. It is a web browser and I want that if a button will be clicked, a video will play immediately. This is what my application...

How To Install Extended WPF Toolkit?

I just used the NuGet console to install the Extended WPF toolkit to my Visual Studio 2013 project, but the controls won't show up in the Toolbox. Am I doing something wrong?(I'm new to WPF)

how to display dates from two different tables?

In a DataView I am displaying two dates from two different tables in a database. Service date from maintenance table and Checklist date from fleetchecklist table. Both columns are called Date in the database tables. The problem is its only displaying one date (checklist date). Service date should say 14/06/2015....

C# Referenced Namespace Hidden By Class Namespace

I have a class like this: namespace Token1.Token2.Token3 { public class Class1 { } } And another class like this: namespace Token2.Token4.Token5 { public class Class1 { } } The first class is a part of my project, the second class is from a framework library developed by another group...

Is there an opposite to 'go to definition' in Visual Studio?

I can right click a variable/method/class etc and click 'go to definition' and it will show me where that variable/method/class was created. Is there a way to do the opposite of that? Is there a way to see where that variable/method/class is used in your C# project?...

.gitignore File Not Working With Bonobo

I set up a Bonobo Git server in IIS and have it working on my local computer. However, the .gitignore file is not working. I'm using the GitHub Windows client and this ignore file. I want the bin and obj folders ignored, but they are showing up as changed folders...

Visual Studio code generation - Use uppercase type names

I prefer to use actual type names for primitive types instead of their corresponding keywords, such as String instead of string, Int32 instead of int, etc., because I like to have consistent syntax highlight and casing - that is, typenames are colored like typenames (aqua blue), and cased properly (uppercase...

Build/Publish Single Page of Visual Studio 2013 ASP.NET Web Site

I'm working on a web project that was migrated from Visual Studio 2010 to Visual Studio 2013. In VS 2010 when working on a page and it's respective code-behind you could right click the page in the solution explorer and click "Build/Publish" page and it would compile the aspx...

Visual Studio Ctrl + F search freezes when including a '(' character

For some reason whenever I include the '(' character in a Ctrl + F search in Visual Studio 2013 the search bar never works. It doesn't matter what other text is included in the search bar. It doesn't matter if I choose to search on just the current document, or...

How to uninstall a program using C#? [duplicate]

This question already has an answer here: How to uninstall MSI using its Product Code in c# 4 answers I'm trying to uninstall a program using C# via Visual Studio and possibly CMD. I made several attempts but could not getting anything to go. Attempt #1: RegistryKey localMachine =...

nuget security - malware installed by nuget packages?

Is it possible that you can be infected with malware by installing nuget packages? This is especially interesting when you think of Microsoft Visual Studio 2016 which will be fully dependent on Nuget....

Tab completion for array not shows after first selection

This is a script for VS PowerShell. function global:Add-Shape { param([string]$Shape, [string[]]$Colors) Write-Host "Shape Name:$Shape" foreach ($i in $Colors) { Write-Host "Color Name:$i" } } Register-TabExpansion 'Add-Shape' @{ 'Shape' = { "Circle", "Square", "Triangle" } 'Colors' = { "Brown", "Red", "Blue" } } In Package Manager Console When I try...

C++ Have a function repeat in the background

I am using microsoft visual express. I have viewed the accepted answer for this question and it seems to not be doing what I want it to do. This is the function that repeats every second for me: double time_counter = 0; clock_t this_time = clock(); clock_t last_time = this_time;...

How to set a custom color for html angle brackets in VS 2013?

Under Tools => Options => Environment => Fonts and Colors there is Text Editor settings. Under Display Items there are items with names starting with HTML keyword. But I cannot find there a name for HTML angle brackets. How do they called?...

Tiny stub of bogus code purely for the purpose of setting a breakpoint (that doesn't create a compiler warning)

This is trivial question but find myself thinking it all the time - often when debugging, I want to break right after a certain line of code executes, and rather than putting the breakpoint on the next line of code (which may be a ways down due to large comment...

An exception of type 'System.FormatException' occurred in mscorlib.dll but was not handled in user code

I am attempting to multiply the values of dropDown to the user's inputted value in daysRenting. I am getting a format error with respect to the data types being used. dropDown uses doubles and daysRenting is an int. My problem lies in this line of code... How can I rewrite...

Emulate Devenv/Runexit under MSBuild

I am new to MSBuild and busy automating tests of Visual Studio solutions. I previously worked with the command line of Devenv, which provides a convenient /Runexit mode of operation. From the manual: /Runexit (devenv.exe) Compiles and runs the specified solution, minimizes the IDE when the solution is run, and...

Trouble with LINQ query and XML elements

I've run into an issue trying to work with xml files in visual studio and was hoping someone could point out my error for me. What I'm trying to do is read in all the child elements, then find the longest child from the parent . I've tried many, many...

How do I make program with c# to check to see if a word is a palindrome? [closed]

so i'm trying to make a program (text based) that can scan a word you type into it to see if it's a palindrome or not so just a true or false outcome i'm a beginner with c# so please help me out! So far this is all i have...

Can I pass VisualStudio Edition name through a compiler option?

I am using Microsoft.QualityTools.Testing.Fakes to mock some unit tests. But this assembly is only available to users with VisualStudio Ultimate. Users with other editions (Professional) can't build and run this test project, and it gives an error on their environments. So I have created a compiler directive to deal this:...

Visual Studio 2013 closes

I recently installed Visual Studio 2013, so I'm relatively new to it. I'm trying to run the code below: #include <iostream> int main() { std::cout << "Hello World! "; } but the terminal that's supposed to open to display "Hello World" closes immediately and doesnt give me the chance to...

In Visual Studio 2013, what does this black arrow-shaped symbol in the breakpoint bar mean? [duplicate]

This question already has an answer here: Black dash / line on visual studio 2012 left margin 1 answer Somehow, one of the lines in my source code became marked with a black arrow-shaped icon pointing to the right. I'm familiar with bookmarks and breakpoints, but I can't find...

Visual Studio 2013 LINK : fatal error LNK1181: cannot open input file

I am using Visual Studio 2013. I'm trying to build some code given to me from my professor and I keep getting this error: LINK : fatal error LNK1181: cannot open input file 'C:\Users\manduchi\Documents\eyegaze\EyeGazeDemo..\Libraries\OpenCV\lib\opencv_core249.lib' However, on my computer opencv_core249.lib is located somewhere else. I've tried updating the linker directories to...

Exception in async task gets intercepted in Visual Studio

I want to run several tasks, some of which would complete async'ly, and then wait for all of them to complete. As the tasks may throw exceptions, I want to catch and log them. sample code for that: static async Task doit(int x) { try { Console.WriteLine("{0} {1} start", x,...

uint32_t variable is strange changing

I have simple code: #define NUM_UA_SOCK 100 typedef struct _UA_REQUEST { string full_url; uint32_t url_adler32 ; TCPsocket sock_ua ; uint32_t status_flag ; // ref Enum STATUS } UA_REQUEST ; UA_REQUEST GLB_ARRAY__UA_REQ[ NUM_UA_SOCK ] ; void handle_ua_sock_ready( uint32_t ii ) { string _req_mstr; byte*request = (byte*) _req_mstr.c_str() ; byte*pcrlf = NULL...

Use Sync Framework without Installation

I developed an application, which uses the Microsoft Sync SDK for syncing Directories. But I want to run the application without installing the sync framework on every computer before. So is there a way to publish the application, including the framework in his program directory?

Assembly Dependencies Change After Installation

I have a .NET application that seems to have some of its dependency versions change between debugging and running as an installed release app. I'll just focus on the Castle.Core assembly for my details, but the same issue occurs with a couple others as well. A NuGet package I'm using...

Why a breakpoint jumps in my C++ code?

MS Visual Studio 2013. I see my breakpoint is moving in runtime (C++ code). I had never such behaviour in my C# code, why I get this in C++? How can I solve it? #include <Windows.h> int main(){ HANDLE hFile = ::CreateFile(TEXT(""), 0, 0, NULL, OPEN_EXISTING, 0, NULL); if (INVALID_HANDLE_VALUE...

C++ Why does this work

I am using Microsoft Visual studio 2013 I currently have this switch statement: switch (option) { case 1: getline(cin, newname); cout << "What would you like your new username to be?\nName: "; getline(cin, newname); name = newname; cout << "\nYour username is now '" << name << "' with your...

How do I make visual studio show exceptions that any method may throw?

I was wondering about how I can make visual studio show the exceptions that any method may throw, not just the .NET Framework methods (I am using C#). For example, here's a picture showing that when I hover over Console.WriteLine it says "Exceptions: System.IO.IOException". However when I do that for...

why my project look like references not resolved?,visual-studio,visual-studio-2015
Running VS 2015 RC on windows 7 64, for the projects, it looks like the screenshot below, there is also no intellisense, but the project can compile, something wrong? the VS has resharper 9 and web essential extension installed as well project.json { "webroot": "wwwroot", "version": "1.0.0-*", "dependencies": {...

How do I display an Icon on the Taskbar but not on the form itself?,winforms,visual-studio
If I use ShowIcon in the form properties, I get the icon in the top left of my form (I don't want that), but I do get my icon in the taskbar. If I turn ShowIcon off, then I get no icon on the form but I get the default...

VIsual Studio: Deleting SUO file causes vs2013 to hang?

Visual Studio 2013 was acting up - it would take > 20 minutes to compile. I decided to try and help myself by deleting the SUO file thinking that may be a good first step. Here is the thing, when I delete the file VS hangs at "loading solution". Put...

finding file in root of wpf application

I'm trying to load a file with pack://application: The file is situated in the root of my project but I keep getting a null reference error. However When I do an absolute reference it finds the file and loads just fine. What am I missing here? This doesn't work var...

Lightswitch HTML Client: How to re-render an item (re-execute postRender callback)

I am developing an lightswitch HTML client with Visual Studio 2013. I have a screen with a tile list of customers, where the ones that are marked as "premium" (which is a boolean field of the customer entity) are highlighted with an orange background, whereas all other customers stay in...