Showing posts with label Visual Studio. Show all posts
Showing posts with label Visual Studio. Show all posts

Thursday, June 4, 2020

Visual Studio 2013 - Run as administrator - The application cannot start.

All of a sudden, Visual Studio 2013 no longer works with the error message "The application cannot start" when trying to run it as local administrator.

For those of us who prefer to host a development environment using local IIS server (not IIS Express), this could be a show stopper.

Running the "devenv.exe /resetuserdata" did not help. Uninstall/Re-install of VS 2013 did not help either.

Try the following and see if it helps.

  1. Open the folder "C:\Program Files (x86)\Common Files\Microsoft Shared\MSEnv\
  2. Look for files that start with "dte" and "*.olb" extension. For example,
    • dte80.olb
    • dte80a.olb
    • dte90.olb
    • dte90a.olb
    • dte100.olb
  3. Copy all of these files.
  4. Paste them into "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE

Tuesday, July 31, 2018

ASP.NET MVC Scaffolding Template Files (T4)

The following is where you can find the T4 template files used by ASP.NET MVC Scaffolding:

Visual Studio 2015:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Web\Mvc\Scaffolding\Templates\

Visual Studio 2017:
C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.visualstudio.web.codegenerators.mvc\


Friday, March 9, 2018

Git could not pull because there were uncommitted changes

Recently, I could not pull from origin master on my Visual Studio 2017. Git could not pull because there were uncommitted changes. I forgot that every change in my local repo must first be committed before pull.

One easy way to commit uncommited changes and then pull was using command-line on the Visual Studio solution folder as follows.

git add -A
git commit -m "your message"
git fetch origin master
git pull origin master
git push origin master //To push to the git

Sunday, November 23, 2014

Smooth Scroll in Visual Studio on VM Windows in Parallels Desktop

When using Visual Studio in Windows running on Parallels Desktop on Mac, I used to have a jumpy scroll issue on the Source Code or the Solution Explorer window. Whether I used the built-in MacBook Pro's TrackPad or an external mouse's scroll wheel, I was not able to fine-control the number of lines to scroll up or down while using the Visual Studio. The only way to scroll a few lines at a time was by using the scroll bar on the right, but this can be very counter-intruitive, since we are so used to the scrolling via the scroll wheel.

The easy workaround to this nuisance is rather simple. Go into the VM settings in the Parallels Desktop VM, select Hardware --> Mouse & Keyboard, and then un-check "Enable smooth scrolling".

Un-check "Enable smooth scrolling" to Enable smooth scrolling.

Thursday, August 28, 2014

Using Less in Visual Studio 2013 Web Project

Here is a cheat sheet on "what to do" to start using LESS on Visual Studio 2013 web project.

  1. Install "dotless" using Package Manager Console ("install-package dotless") or the Nuget Package Manager
  2. Open Web.config, locate the "dotless" section, and change it as the following.
    The main thing is to add
    <validation validateIntegratedModeConfiguration="false"/>
    
    to the <system.webServer> node.
    <dotless minifyCss="false" cache="true" web="false" />
    <system.webServer>
        <validation validateIntegratedModeConfiguration="false"/>
        <handlers>
          <add name="dotless" path="*.less" verb="GET" type="dotless.Core.LessCssHttpHandler,dotless.Core" resourceType="File" preCondition="" />
        </handlers>
    </system.webServer>
    
  3. If the main less file is "my.less", which imports all other less files, add the following comment at the top of each less file except the "my.less".
    /// <reference path="my.less" />
    

Wednesday, August 20, 2014

Enable vertical split of the same CSHTML view file in Visual Studio 2013

In Visual Studio 2013, you can open the same C# file twice and view them vertically side-by-side by opening the C# file, selecting the menu [Window] --> [New Window] and then selecting [Window] --> [New Vertical Tab Group]. However, for *.cshtml MVC View files, this does not work. The [Window] --> [New Window] menu item is grayed out. To enable [Window] --> [New Window] menu item for *.cshtml file, you can try this registry hack.

  1. Close Visual Studio 2013 if currently open.
  2. Use RegEdit and go to
    [HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0_Config\Languages\Language Services\HTMLX] .
  3. Find "Single Code Window Only" entry. 
  4. Change its value from 1 to 0.
  5. Start Visual Studio.
Now you should be able to open a *.cshtml file, select [New Window] from the [Window] menu to open another editor window of the same *.cshtml file, right-click on the the new editor window's tab and select [New Vertical Tab Group] to create side-by-side editor view of the same file. Changes you make on one editor window will instantly appear on the other editor window of the same file. 


Monday, November 11, 2013

Login prompt keeps coming when developing Intranet MVC4 Website on IIS Express

I created a MVC 4 project using Visual Studio 2012 on Windows 7 Computer that is a standalone and not a member of an Active Directory domain. I selected the intranet application template for the MVC4 application in Visual Studio 2012, successfully created initial aplication with no error and adjusted project property settings as the initial ReadMe.txt file showed (i.e., Anonymous Authentication = Disabled, Windows Authentication = Enabled).

However, when running the website using IIS Express, the Login Prompt keeps coming up. I thought this nuisance was due to the fact that my computer was not a member of any domain and therefore, the browser is not treating my request as intranet traffic. When I enter my local Windows user name and password, the IIS Express lets me in and I see my MVC4 website loaded in IE properly. Still, having to enter my credential each time I press Ctrl + F5 is a nuisance to take care of for my productivity.


Workaround: 
  1. Run IE. Go to [Tools] --> [Internet Options] menu. Select [Security] tab.
  2. Choose [Trusted Sites] and click the [Sites] button.
  3. Add "http://localhost" to your trusted website. Click [close] button.
  4. When back to the [Security] tab, make sure the [Trusted sites] is still selected. 
  5. Click [Custom level...] button while under the [Trusted sites] context. 
  6. Scroll down to "User Authentication". Select "Automatic logon with current user name and password"

Through another test, I confirmed that when you develop a intranet website using VS 2012 and IIS Express on a computer that is a member of an Active Directory domain, you do not run into this issue of unnecessary login prompt. This issue only happens when you develop on a stand-alone Windows machines.