This problem turned into a horrible time suck for me, so I really wanted to document what happened and how to resolve it because this is the second time I have dealt with this issue. As usual, things aren’t as easy as they could be. Here is the scenario:

  • You have a WPF project that you need to upgrade from full framework dot net 4.8 to that latest version of dot net (core) which at the time of writing this (05/19/2024) is dot net 8 (LTS).
  • You use the upgrade wizard as instructed, but then the damn WPF project won’t start because Microsoft hates you.

Obscure Problem

This is the error I was getting when I was trying to just run a WPF application post upgrade. This makes NO SENSE because a WPF application is NOT a Class Library as the error is insinuating.

This error reads:

A project with an Output Type of Class Library cannot be started directly.

In order to debug this project, add an executable project to this solution which references the library project. Set the executable project as the startup project.

Microsoft Visual Studio

So here is an error that ReSharper was showing me that is similar enough to the real problem. I don’t remember how this came about, but I got it while debugging/troubleshooting this infuriating time vampire of a problem:

This error reads:

The project to be run with this configuration is not present in the solution.

ReSharper – Failed to execute run configuration

Stupid solution

I genuinely detest that this is the solution to this stupid problem. I dislike how this has consistently been the solution to so many of this bizarre just out of no where problems. Believe me when I say, I avoided doing this and I tried other things before doing this and they were all a waste of time which is how I think I got the ReSharper error.

  1. After you finish doing the upgrade, don’t bother running anything. You can build your solution, but that’s it.
  2. Delete your solution.
  3. Delete your hidden .vs folder as it has references back to your solution that you just deleted.
  4. Create a new solution from scratch.
  5. Now your WPF application should launch with little to no issues.

Additional notes

  • Don’t bother attempting to rename your existing solution, it doesn’t translate well to your .vs folder – if at all.
  • I don’t think this is worth attempting at all; but if you want to port your existing solution, you can create a blank one and then just copy the innards over of the existing solution, but make sure you are not overwriting any of the newer meta data that’s usually at the top of the file.
  • When all else fails – nuke your solution file and the .vs folder.
  • I reviewed my startup configuration ad nauseum and forgot that some of that is stored in the .vs folder. So it didn’t matter how much I tinkered, I wasn’t modifying the hidden configs. The only way to overwrite them was to start fresh.

Leave a Reply

Your email address will not be published. Required fields are marked *