EzDevInfo.com

visual-studio-2013 interview questions

Top visual-studio-2013 frequently asked interview questions

visual studio 2012 / 2013 single click opens file

In my Visual Studio 2012 solution explorer, when I single click a filename it opens it. This was different from VS2010 (required a double click). Is there a way to make double-click the 'view file' command?


Source: (StackOverflow)

Disable ALL CAPS menu items in Visual Studio 2013

In Visual Studio 2013, Microsoft again presents the menu in UPPERCASE as the default.

Can these be modified to be Sentence Case?


Source: (StackOverflow)

Advertisements

Format code shortcut for Visual Studio?

In eclipse there is a shortcut Ctrl+Shift+F that re-indents code and fixes comments and blank lines. Is there an equivalent for Visual Studio 2010?


Source: (StackOverflow)

Where is Developer Command Prompt for VS2013?

I need to run web.exe file from my developer command prompt for vs2013 . but it wasn't installed by default in visual studio 2013 . why ? before I used visual studio 2012 and developer command prompt for vs2012 was installed by default with it .

but why this command is not installed with visual studio 2013 by default ? and how can I reach to this command line ?


Source: (StackOverflow)

How to add MVC5 to Visual Studio 2013?

I'm starting a new project, and would like to give a try to MVC 5 (I have built a web app using MVC 4 before).

In Visual Studio 2013, I click the New Project and navigate to Visual C# > Web > Visual Studio 2012 (even though I have installed VS 2013 it says 2012 in the menu) and on that list I only have MVC 4 application - not 5.

The framework in the drop down menu is set to .NET Framework 4.5.1 - and still nothing.

I've checked Tools > Extensions and Update and searched for MVC 5 - but it doesn't find anything official from Microsoft.

How can I add MVC 5 to my Visual Studio 2013?

Thank you


Source: (StackOverflow)

How do I open an old MVC project in Visual Studio 2012 or Visual Studio 2013?

I have an old ASP.NET MVC 2 project which I do not want to upgrade to MVC 3 or MVC 4. I am working on a new machine running Windows 8, Visual Studio 2012 and Visual Studio 2013. When I try to open the MVC 2 project in VS 2012 or VS 2013 I receive the error:

This project is incompatible with the current edition of Visual Studio

The project is then unloaded and grayed out in Solution Explorer. I do not want to install another copy of Visual Studio. How can I open an old MVC project in a new version of Visual Studio?


Source: (StackOverflow)

Unable to type in Visual Studio

I am unable to edit any files in a project in Visual Studio 2013. It only happens in one project. If I open a different project I am able to type fine, but once I go back into the problem project I am unable to type in the editor windows. Not sure if it matters but the project that is giving me issues we are using SVN on. The other projects are just local ones on the machine. I have restarted Visual Stuido, restarted the computer and still am unable to edit the files. Any ideas?


Source: (StackOverflow)

Enable WiX project in Visual Studio 2013

I have a VS 2012 solution with WiX Installer projects. However, when I open the solution in VS 2013 (Release) the WiX project is incompatible.

Does anyone know where / whether a VS 2013 version (wixtoolset ?) is available being worked on yet? Or is there a way to make the current project compatible in VS 2013?


Source: (StackOverflow)

Could not load file or assembly 'System.Web.Http 4.0.0 after update from 2012 to 2013

I did the upgrade according to. http://www.asp.net/mvc/tutorials/mvc-5/how-to-upgrade-an-aspnet-mvc-4-and-web-api-project-to-aspnet-mvc-5-and-web-api-2

I get the error. Does any one else got this error?

Server Error in '/' Application.

Could not load file or assembly 'System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.FileLoadException: Could not load file or assembly 'System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Source Error:

Line 48: Line 49: Line 50: } Line 51: Line 52: protected void Application_BeginRequest(object sender, EventArgs e)

Source File: d:\SM\7.4Test\WebAPIServerV2\ThirdPartyWebAPI\Global.asax.cs Line: 50

Assembly Load Trace: The following information can be helpful to determine why the assembly 'System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded.

=== Pre-bind state information === LOG: DisplayName = System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 (Fully-specified) LOG: Appbase = file:///D:/SM/7.4Test/WebAPIServerV2/ThirdPartyWebAPI/ LOG: Initial PrivatePath = D:\SM\7.4Test\WebAPIServerV2\ThirdPartyWebAPI\bin Calling assembly : ThirdPartyWebAPI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null. === LOG: This bind starts in default load context. LOG: Using application configuration file: D:\SM\7.4Test\WebAPIServerV2\ThirdPartyWebAPI\web.config LOG: Using host configuration file: C:\Users\michalc\Documents\IISExpress\config\aspnet.config LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config. LOG: Post-policy reference: System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/9184b2ea/c6d4b139/System.Web.Http.DLL. LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/9184b2ea/c6d4b139/System.Web.Http/System.Web.Http.DLL. LOG: Attempting download of new URL file:///D:/SM/7.4Test/WebAPIServerV2/ThirdPartyWebAPI/bin/System.Web.Http.DLL. WRN: Comparing the assembly name resulted in the mismatch: Major Version ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

Stack Trace:

[FileLoadException: Could not load file or assembly 'System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)] ThirdPartyWebAPI.WebApiApplication.Application_Start() in d:\SM\7.4Test\WebAPIServerV2\ThirdPartyWebAPI\Global.asax.cs:50

[HttpException (0x80004005): Could not load file or assembly 'System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +9935033
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +118
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +336
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296

[HttpException (0x80004005): Could not load file or assembly 'System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9913572 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18408


Source: (StackOverflow)

How to enable C# 6.0 feature in Visual Studio 2013?

I was going through the latest features introduced in C# 6.0 and just follow an example of auto property initializer,

class NewSample
{
    public Guid Id { get; } = Guid.NewGuid();
}

but my IDE did not recognize the syntax.

I am wondering how I could enable C# 6.0 in Visual Studio 2013.
Target framework I am using 4.5.1.


Source: (StackOverflow)

Proper way to rename solution (and directories) in Visual Studio

I have a rather involved Visual Studio solution (2010, but it shouldn't matter) that I need to rename.

I want to rename the folders to match the new solution name, but I can't figure out a way to refactor the folder names automatically, and going through every single project file will be painful.

Is there an official way to do this? Alternatively (and much less preferably), are there free tools to accomplish this?


Source: (StackOverflow)

How can I prevent Visual Studio 2013 from closing my IIS Express app when I end debugging?

Previously in 2012, if I debugged in Chrome (for example), and then stopped the debugger, the website would remain running in IIS Express. This no longer seems to be the case in 2013.

Is this a new change that I need to make? How can I keep the website instance running even after I stop the debugger? Thanks.


Source: (StackOverflow)

generates same number in Linux, but not in Windows

The code below is meant to generate a list of five pseudo-random numbers in the interval [1,100]. I seed the default_random_engine with time(0), which returns the system time in unix time. When I compile and run this program on Windows 7 using Microsoft Visual Studio 2013, it works as expected (see below). When I do so in Arch Linux with the g++ compiler, however, it behaves strangely.

In Linux, 5 numbers will be generated each time. The last 4 numbers will be different on each execution (as will often be the case), but the first number will stay the same.

Example output from 5 executions on Windows and Linux:

      | Windows:       | Linux:        
---------------------------------------
Run 1 | 54,01,91,73,68 | 25,38,40,42,21
Run 2 | 46,24,16,93,82 | 25,78,66,80,81
Run 3 | 86,36,33,63,05 | 25,17,93,17,40
Run 4 | 75,79,66,23,84 | 25,70,95,01,54
Run 5 | 64,36,32,44,85 | 25,09,22,38,13

Adding to the mystery, that first number periodically increments by one on Linux. After obtaining the above outputs, I waited about 30 minutes and tried again to find that the 1st number had changed and now was always being generated as a 26. It has continued to increment by 1 periodically and is now at 32. It seems to correspond with the changing value of time(0).

Why does the first number rarely change across runs, and then when it does, increment by 1?

The code. It neatly prints out the 5 numbers and the system time:

#include <iostream>
#include <random>
#include <time.h>

using namespace std;

int main()
{
    const int upper_bound = 100;
    const int lower_bound = 1;

    time_t system_time = time(0);    

    default_random_engine e(system_time);
    uniform_int_distribution<int> u(lower_bound, upper_bound);

    cout << '#' << '\t' << "system time" << endl
         << "-------------------" << endl;

    for (int counter = 1; counter <= 5; counter++)
    {
        int secret = u(e);
        cout << secret << '\t' << system_time << endl;
    }   

    system("pause");
    return 0;
}

Source: (StackOverflow)

How can I turn off Visual Studio 2013 Preview

So I don't have resharper I think the command was like ctrl+shift+t. When I want to search files I use ctrl+ comma. The search box pops up and then I start typing. But the built in preview just grabs whatever I have typed and opens the file. Even though I am still typing. So I am trying to open a file report_vaccine, but I only get out report and the preview has opened the first selected report. It has pretty much rendered this form of quick file searching useless. Which is a huge bummer because we have hundreds of procs and scrolling through and manually finding the file is a huge pain. If there is a way to turn off preview I would be fine with that. This command working properly is waaay more important to me than a preview of the file to be opened. Thanks I would greatly appreciate the help.


Source: (StackOverflow)

Get "Internal error in the expression evaluator" on "Add watch" function when trying to debug WCF service code (MSVS 2013)

Few days ago I moved my solution to MSVS 2013. It works fine except one thing: when I trying to debug code of my WCF service it works, but when I want to watch state of any variable it says: "Internal error in the expression evaluator". Add watch function works normal on client side, but in service code it broken. I'm trying to debug my own WCF service running on the localhost. Could you help me, how to repair this?

enter image description here

Here MSVS info: Microsoft Visual Studio Professional 2013 Version 12.0.30110.00 Update 1 Microsoft .NET Framework Version 4.5.51641 OS: Windows 8.1


Source: (StackOverflow)