Visual Studio logo

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

Reading Time: 2 minutes. This post was most recently updated on October 9th, 2018.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.  Problem Especially while installing a new dev machine, and building your project for the first time, you may end up getting the following exception: Could not load file or assembly ‘<assemblyname>’ or one of its dependencies. An attempt was made to load a program with an incorrect format. No fear, though, as this is usually easily fixed. In quite […]

Sequence contains more than one element

Launching a new debugger instance from code in Visual Studio

Reading Time: 2 minutes. This post was most recently updated on October 9th, 2018.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 […]

IIS8

Exception of type ‘System.OutOfMemoryException’ was thrown.

Reading Time: 3 minutes. This post was most recently updated on October 28th, 2018.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 ASP.NET MVC with 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 context) +45 System.Web.Optimization.BundleResolver.GetBundleContents(String virtualPath) +166 System.Web.Optimization.AssetManager.DeterminePathsToRender(IEnumerable`1 assets) +205 System.Web.Optimization.AssetManager.RenderExplicit(String tagFormat, String[] […]

Typescript & React.JS

Fixed: Cannot use JSX unless the ‘–jsx’ flag is provided

Reading Time: 2 minutes. This post was most recently updated on October 9th, 2018.This blog post is about fixing issues related to building a project with TypeScript files. Basically, if your jsx or tsx -files are not getting built to js-files (which is what the browser understands) in Visual Studio’s build, this post might solve the issue for you. Description While converting a project using React.js to TypeScript (and, hence, to use .ts and .tsx files instead of .js and .jsx) I stumbled upon this error: Cannot use JSX unless the ‘–jsx’ flag is provided The project would not build a .tsx-file with ReactDOM.render(…) […]

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

Reading Time: 2 minutes. This post was most recently updated on October 9th, 2018.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 2012, 2013, 2015 and 2017”:Getting Connect-MsolService […]

Too long deployment path

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.

Reading Time: 3 minutes. This post was most recently updated on October 9th, 2018.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 […]