Launching a new debugger instance from code in Visual Studio

Sequence contains more than one element

This post describes a quick solution to launching a new Visual Studio instance for debugging the code. Where I’ve found this exceptionally useful, has been in debugging code-first migration’s (one of the ways for database initialiation in .NET) Seed-method. It is by default undebuggable, as when you are running Update-Database you can’t really use a -debug switch or anything, and there’s really no way to launch the debugger. Hence the best you can do is using -verbose to get more information.

However, if you actually want to see what is happening in the code, here’s the solution.

Continue reading

Tip: Scroll Solution Explorer to current file in Visual Studio 2012, 2013 and 2015

Visual Studio settings

I always want the Visual Studio Solution Explorer to show me the context where I work at – kind of follow me around while I jump from file to file. This behavior is built-in, but off by default, and also probably disabled after installing some new extensions. Here’s how you can re-enable it:

Tools -> Options -> Projects and Solutions -> “Track Active Item in Solution Explorer”

Visual Studio 2010 fails to show the design view of an aspx-page

SharePoint project properties

This post is about solving the issue with Visual Studio 2010 failing to show the design view of an .aspx-page. Luckily, it’s an easy and pretty classical fix.

Symptoms

While trying to view or edit an aspx-page in design mode in Visual Studio 2010, the window is just plain empty and there’s little you can do about it – selecting view markup or hitting F7 may not do anything and restarting the Visual Studio doesn’t help.

empty aspx page design view

Design view failing to open

Solution

The Design view requires connection to the SharePoint site where you’ll be deploying the solution (or rather, any site). Set the Site URL property in the project settings:

Continue reading

The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.

Too long deployment path

This post describes a few different ways of fixing the error “The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.” one can get when trying to package/publish a SharePoint solution, web site or Azure Webjob.

UPDATE 11.4.2016: I actually got this nasty exception on another occasion (Azure webjob publish), so I updated the text accordingly.

Symptoms

Visual Studio throws the following error when packaging a SharePoint solution to a .wsp file, OR when deploying or publishing your web project (for example Azure Webjob).

 

Continue reading