Blazor blazing away some geeks.

How to fix “The type or namespace name ‘Services’ does not exist in the namespace ‘Microsoft.AspNetCore.Components’ (are you missing an assembly reference?)”

Just resolved a random issue that’s difficult enough to google, that I think it’s worth documenting! These seem to be popping up whenever you work with anything that’s fairly fresh out of oven… This particular case revolves around Visual Studio being incredibly obnoxious, and starting to throw a ton of errors on code that worked five minutes prior. In my case, the error happened after updates to Visual Studio. Always fun. Symptoms The errors started popping up in Visual Studio. Basically, I just started getting…Continue reading How to fix “The type or namespace name ‘Services’ does not exist in the namespace ‘Microsoft.AspNetCore.Components’ (are you missing an assembly reference?)”

ASP.NET Core web app home page

Resolving the Version conflicts for a downgraded .NET Core 2.1/2.2 web app project

I ran into compatibility issues with .NET Core 2.2 on my Azure Functions projects, so I downgraded my whole solution (an Azure Functions project, a helpers library and a web application project) to 2.1, and got rid of that particular nuisance. This introduced a few new issues, though – namely, I started getting this error whenever trying to restore nuget packages or build the project: NU1107 Version conflict detected for Microsoft.AspNetCore.Razor.Language. Install/reference Microsoft.AspNetCore.Razor.Language 2.2.0 directly to project [projectname] to resolve this issue. [projectname] -> Microsoft.VisualStudio.Web.CodeGeneration.Design…Continue reading Resolving the Version conflicts for a downgraded .NET Core 2.1/2.2 web app project

Sequence contains more than one element

Easiest way to debug Seed-method in Code-first migrations in Entity Framework

This post describes the easiest way to debug the issues that may stop your Seed-method in Configuration.cs from going through. This problem concerns typically your ASP.NET MVC projects, either on .NET Framework or .NET Core – the same basic idea should work for both situations. The solution here shows you, how you can get a little bit more information out of the process, without attaching the debugger (there’s another blog post for that: How to launch the visual studio debugger from code/) Description Entity Framework’s…Continue reading Easiest way to debug Seed-method in Code-first migrations in Entity Framework

Visual Studio logo

Fixing the “Could not load file or assembly … or one of its dependencies” error

This post describes how to fix the “Could not load file or assembly ‘[assemblyname]’ or one of its dependencies. An attempt was made to load a program with an incorrect format.” error.  The solution described in this post shows you how to resolve the issue when you’re deploying from Visual Studio, but get the error “Could not load file or assembly or one of its dependencies” when deploying to IIS or when opening your website after the deployment. Problem Especially while installing a new dev…Continue reading Fixing the “Could not load file or assembly … or one of its dependencies” error

Applying Entity Framework’s Code-First Migrations against a Database in Azure by running Update-Database

This post describes how to run Entity Framework’s code-first migrations against a database located in the Windows Azure. This is done by running Update-Database commandlet with suitable switches, see below. The problem and symptoms Okay, so you’re developing your MVC+EF cool web app with a database in Azure, and you’re using code-first migrations. Cool! What’s nice with code-first-migrations is the fact they are run automatically even in the cloud the next time your app is running (as long as you publish your app with that…Continue reading Applying Entity Framework’s Code-First Migrations against a Database in Azure by running Update-Database

IIS8

Exception of type ‘System.OutOfMemoryException’ was thrown.

This post describes one of the more no-brainerish ways of fixing a ‘System.OutOfMemoryException’ exceptions being thrown in your ASP.Net MVC application using C# and Entity Framework. Problem While developing a web project, for example an ASP.NET MVC web application which is using EF, sometimes when handling a lot of data or complex entities on your dev machine, you encounter this error: OutOfMemoryException: Exception of type ‘System.OutOfMemoryException’ was thrown.] System.Text.StringBuilder.ToString() +35 System.IO.StreamReader.ReadToEnd() +123 System.Web.Optimization.BundleFile.ApplyTransforms() +74 System.Web.Optimization.DefaultBundleBuilder.BuildBundleContent(Bundle bundle, BundleContext context, IEnumerable`1 files) +472 System.Web.Optimization.Bundle.GenerateBundleResponse(BundleContext context) +127 System.Web.Optimization.Bundle.GetBundleResponse(BundleContext…Continue reading Exception of type ‘System.OutOfMemoryException’ was thrown.

Visual Studio settings for "Track my active file in Solution Explorer" - a really useful setting to have enabled, if you ask me!

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

This quick post describes how to get the Solution Explorer to actually track your currently open file. For some reason, this extremely useful feature is disabled by default in Visual Studio. Enabling it helps you to better conserve your context, and see which part of your solution you’re in, while you’re developing a complex piece of software. Give it a try, in case you haven’t already! It’s great and extremely useful! :) Posts Related to “Tip: Scroll Solution Explorer to current file in Visual Studio…Continue reading Tip: Scroll Solution Explorer to current file in Visual Studio 2012, 2013, 2015 and 2017

Azure SQL Error

Fixing error “Cannot open server – – requested by the login. Client with IP address – – is not allowed to access the server.” in Azure deployments from Visual Studio

This article explains how to work your way around the exception ‘Cannot open server – requested by login…’ The issue is caused by Azure’s firewall logic, that might sometimes appear a little bit overzealous for simple development workloads, and might stop you from accessing your databases from your development machine. But just as everything else in Azure, the firewall exists for a reason, and working with it just requires a couple of extra clicks, is all. :) Symptoms Typically, you encounter this issue, when trying…Continue reading Fixing error “Cannot open server – – requested by the login. Client with IP address – – is not allowed to access the server.” in Azure deployments from Visual Studio

SharePoint project properties

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

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. Solution The Design view requires connection to the SharePoint…Continue reading Visual Studio 2010 fails to show the design view of an aspx-page

Too long deployment path

Fixing 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.”

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 encounter this issue at least when trying to package/publish a SharePoint solution, web site or an Azure Webjob. Symptoms Visual Studio throws the following error when packaging a SharePoint solution to a .wsp file, OR when deploying or publishing your…Continue reading Fixing 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.”

Visual Studio's Attach to Process -dialog

Attaching the Visual Studio debugger to the right IIS worker process

Every now and then comes the time when you’d actually need to debug something, and then you’ll likely be using your Visual Studio to attach the debugger to one or more processes. Using CKSDev to attach to all IIS worker processes (w3wp.exe), or if you don’t use CKSDev, just pressing ctrl+p and selecting the processes from the list, is often a good enough solution. However, sometimes that makes your dev box sluggish, or maybe catches exceptions from code you’re not wishing to debug at the…Continue reading Attaching the Visual Studio debugger to the right IIS worker process