Azure Active Directory, the advanced logo

Iterating Group memberships using Claims in .NET Core

Another case, where there’s plenty of documentation, but it just doesn’t seem to be comprehensive enough or just doesn’t apply for any of the cases that I have – for whatever reason. Maybe my cases are wrong, or I’m just bad at googling, but I’ve struggled to find a good page documenting this. Perfect case for another blog post about the topic, then – perhaps someone else will find it useful! This post answers the question: How to get Claims for a user in .NET…Continue reading Iterating Group memberships using Claims in .NET Core

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?)”

.NET Core fundamentals in one picture.

How to use UriHelper or NavigationManager in .NET Core 3.0 & Blazor?

Just a quick piece of documentation, as this piece of code has changed in different versions of .NET Core 3.0 so far a few times. Need to have things like this written down somewhere! UriHelper / NavigationManager with .NET Core 3.0 Both of these helper libraries do essentially the same thing: navigate/browse/redirect the user to a different address, component, page or view in or by your web app. What you normally use this library for is exactly the same in all versions I’ve worked with,…Continue reading How to use UriHelper or NavigationManager in .NET Core 3.0 & Blazor?

A simple graphical explanation of Blazor's effect on the web development landscape.

HttpClient in Blazor

Blazor is a new (ish) framework for building web UIs with C#. It either uses SignalR to manage connections between your client-side and server-side code, or even compiles directly to WebAssembly, in both cases cutting out the need to write any pesky JavaScript yourself – pretty neat, if you ask me! However, developing your web apps with Blazor is a bit different from using ASP.NET MVC, for example. Other people have written great introductions to the tech, so I’ll stick to the problem at hand:…Continue reading HttpClient in Blazor

.NET Core fundamentals in one picture.

How to add creator/modified info to all of your EF models at once in .NET Core

This is a tip that should often be the first thing you do in your projects with database backend, no matter which technology you use: Add some basic info about modified and created times, and the user information – so that if something happens, everyone will know who to blame 😉 There’s a lot of great blog articles describing how to do this in .NET Framework, but not that many for .NET Core. It’s very similar, but not the same. I learned that by copy-pasting…Continue reading How to add creator/modified info to all of your EF models at once in .NET Core

GitHub thread about the error - and long and winding discussion about the topic.

How to resolve build failing with .NET Core 3 and Microsoft.AspNetCore.Mvc.Versioning

Building a proof-of-concept on .NET Core 3.0 preview 7 I ran into issues when developing web APIs. This release is production-ready (according to Microsoft -see below), but every now and then you run into really unintuitive and sometimes surprising issues. Go LiveNET Core 3.0 Preview 7 is supported by Microsoft and can be used in production. We strongly recommend that you test your app running on Preview 7 before deploying Preview 7 into production. If you find an issue with .NET Core 3.0, please file…Continue reading How to resolve build failing with .NET Core 3 and Microsoft.AspNetCore.Mvc.Versioning

.NET Core fundamentals in one picture.

How to fix Microsoft.AspNetCore.Mvc.TagHelpers not being rendered!

Ha – another one, that ended up being a simple fix, but since nobody actually explains it well, took me an hour to figure out. This post ended up being another example of my “I’m going to document every single fix, that took me more than 10 minutes to figure out, since that’ll help me (and others) the next time the same issue arises.” blogging strategy. Snappy name, right? Never was my strongest suit! Anyway, I ended up banging my head to the wall. Hopefully…Continue reading How to fix Microsoft.AspNetCore.Mvc.TagHelpers not being rendered!

.NET logo

How to get current user in ASP.NET Core?

This post describes how to get the currently logged in user using ASP.NET Core. This is compared with how it’s done in .NET Framework. Background In .NET Core, a lot of things are done a bit differently. That’s what I’ve been learning building more and more stuff with it, instead of good old .NET Framework. The learning curve is definitely there, but it’s not that bad – most of the things work in a similar fashion, but a huge number of details are different. In…Continue reading How to get current user in ASP.NET Core?

entity-framework-logo

EntityFramework Core – Update-Database error “The EntityFramework package is not installed”

Another weird, but simple issue I ran into when building a simple .NET Core application. I was just minding my own business, crafting since bits of code into something remotely functional, while I ran into an issue. While trying to apply my changes to the database using .NET Core Entity Framework, executing Update-Database simply failed with the following error: The EntityFramework package is not installed You might also encounter this version of the error: The EntityFramework package is not installed on project [projectname here]. This…Continue reading EntityFramework Core – Update-Database error “The EntityFramework package is not installed”

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

Let's fix all the problems!

Fixing “An assembly specified in the application dependencies manifest [projectname].deps.json was not found”

This post describes one nobrainerish fix to the error “An assembly specified in the application dependencies manifest [projectname].deps.json was not found.” I ran into this while running Update-Database for my ASP.NET Core web project, that’s using EntityFrameworkCore 2.1.1. I hadn’t seen this one before, but the error was quite interesting: Error: An assembly specified in the application dependencies manifest (Koskila.[projectname].AzureFunctions.deps.json) was not found: package: ‘Koskila.[projectname].AzureFunctions’, version: ‘1.0.0’ path: ‘Koskila.[projectname].AzureFunctions.dll’ Well that’s a weird one coming from an update-database command! Posts Related to “Fixing “An assembly…Continue reading Fixing “An assembly specified in the application dependencies manifest [projectname].deps.json was not found”

Meanwhile on Google Plus...

Google Plus is shutting down – fix your .NET OAuth flow!

Google is shutting down their Facebook killer, Google+. While I’m sure there’s at least 10 end users that are sad to see the ill-fated not-that-social-medium go, the implications for Software Developers actually could be far more far-reaching. A lot of implementations of Google’s OAuth seem to rely on Google Plus’s APIs to get gather information about the user. When Google Plus goes down, so will the APIs. Their apparently unsafe implementation seems to be a major reason Google’s hastening the shutdown anyway. This means that…Continue reading Google Plus is shutting down – fix your .NET OAuth flow!