Allow loading of JSON files in Visual Studio Express 2013 for Web

After some more googling, and experimenting I found out, that you have to define IIS settings in the Web.config. After adding the following configuration: <system.webServer> <staticContent> <mimeMap fileExtension=”.json” mimeType=”application/json” /> </staticContent> </system.webServer> it works like a charm. Full setup file example: <?xml version=”1.0″?> <configuration> <system.web> <compilation debug=”true” targetFramework=”4.0″/> </system.web> <system.webServer> <staticContent> <mimeMap fileExtension=”.json” mimeType=”application/json” /> … Read more

“Value does not fall within the expected range” when trying to add a reference in a project

I did a ‘devenv /setup’ and that fixed it. Detail Exit Visual Studio Click Start Type cmd, right click Command Prompt and select Run as administrator Navigate to the appropriate Visual Studio folder VS2012: pushd %programfiles(x86)%\Microsoft Visual Studio 12.0\Common7\IDE VS2015: pushd %programfiles(x86)%\Microsoft Visual Studio 14.0\Common7\IDE VS2017: pushd %programfiles(x86)%\Microsoft Visual Studio\2017\<Edition>\Common7\IDE VS2019: pushd %programfiles(x86)%\Microsoft Visual Studio\2019\<Edition>\Common7\IDE … Read more

generates same number in Linux, but not in Windows

Here’s what’s going on: default_random_engine in libstdc++ (GCC’s standard library) is minstd_rand0, which is a simple linear congruential engine: typedef linear_congruential_engine<uint_fast32_t, 16807, 0, 2147483647> minstd_rand0; The way this engine generates random numbers is xi+1 = (16807xi + 0) mod 2147483647. Therefore, if the seeds are different by 1, then most of the time the first … Read more

Force uninstall of Visual Studio

I was running in to the same issue, but have just managed a full uninstall by means of trusty old CMD: D:\vs_ultimate.exe /uninstall /force Where D: is the location of your installation media (mounted iso, etc). You could also pass /passive (no user input required – just progress displayed) or /quiet to the above command … Read more

Unable to authenticate with Git Bash to Visual Studio Team Services

You need to enable Alternate Authentication Credentials if you want to use other Git clients outside of Visual Studio… To set up alternate creds in Visual Studio Team Services (VSTS), click on your name/icon on the top right -> Security -> Alternate Authentication Credentials Edit: Add more details about this from VSTS (taken from the … Read more

Is there a format code shortcut for Visual Studio?

Visual Studio with C# key bindings To answer the specific question, in C# you are likely to be using the C# keyboard mapping scheme, which will use these hotkeys by default: Ctrl+E, Ctrl+D to format the entire document. Ctrl+E, Ctrl+F to format the selection. You can change these in menu Tools → Options → Environment … Read more

Visual Studio 2013 – No Visual Basic/Visual C# Web Templates Installed

I think that “Re-install Visual Studio from scratch” is not a solution. I have faced with the described problem and found much faster way to fix it: First of all, try to repair Visual Studio installation (in “Control Panel\Programs\Programs and Features” find your Visual Studio, right-click and select “Repair”). Reboot after (!). Check if template … Read more

ASP.NET MVC5/IIS Express unable to debug – Code Not Running

For me the solution was a much simpler one. In my Solution Explorer in Visual Studio, I right click on the web project, chose properties and then navigated to the “web” tab. From there I changed the Project URL to another port number. For example, if it was http://localhost:1052 – I changed it to http://localhost:4356. … Read more

ASP.NET (OWIN) Identity: How to get UserID from a Web API controller?

You should be able to get user id on both MVC controller and web api controller by same extension method in identity 1.0 RTW package. Here is the extensions from identity package: namespace Microsoft.AspNet.Identity { public static class IdentityExtensions { public static string FindFirstValue(this ClaimsIdentity identity, string claimType); public static string GetUserId(this IIdentity identity); public … Read more