skip to Main Content

I’ve got a C# project that I started 4 or 5 months ago. I started it on Visual Studio 2022 and the project uses C# and Windows Forms.

I worked on it a little bit and left it. Now I’ve come back to it. I wanted to continue coding, but I stumbled upon the problem where I see this error:

feature default interface implementation is not available in c# 7.3

I found I’ve been using an older .NET 4.8 version. I changed the target framework in my .csproj file by adding <TargetFramework>net8.0</TargetFramework> and also <LangVersion>latest</LangVersion>, as well as removing the older TargetFramework.

Then I had a problem with "duplicate compile items", so I added <EnableDefaultCompileItems>false<EnableDefaultCompileItems> and <EnableDefaultEmbeddedResourceItems>false<EnableDefaultEmbeddedResourceItems>.

Now, I no longer get that problem, but sadly I have other issues I can’t resolve.

Firstly, I get these two messages:

The file does not support code parsing or generation because it is not contained within a project that supports this code

I also have almost 200 errors that all look like this:

The type or namespace does not exist in the namespace (are you missing an assembly reference)

(I’ve seen this link, but my framework is indeed 8.0).

The type name could not be found in the namespace. This type has been forwarded to assembly… Consider adding a reference to that assembly.

All the problems seem to be related to Forms, since all the errors I’ve clicked so far point me to a line like this:

private System.Windows.Forms.DataGridViewTextBoxColumn totalSpacesDataGridViewTextBoxColumn;

I assume it has something to do with the 2 messages that are telling me I have a problem with 2 of the forms. I also tried to add references, but that didn’t work.

Does anyone know how to fix this?

Realistically, it’s not that much of a problem to start the project again, but I don’t want to do the forms all over again, since it took some time.

2

Answers


  1. I upgraded my framework applications using the .NET Upgrade Assistant. Worked very well for my WPF apps and class libraries. Decently for a Forms project I tried.

    Login or Signup to reply.
  2. .NET 4.8 and .NET 8 have many design differences, particularly in API and runtime. While .NET 8 remains compatible with many .NET Framework features, differences in runtime, APIs, and tools may necessitate adjustments. Microsoft offers tools and documentation to assist with migration, but careful planning and testing are essential.

    The following can help you understand API differences and resolve compatibility issues of project migration to .NET 8:

    https://learn.microsoft.com/en-us/dotnet/api/

    https://learn.microsoft.com/en-us/dotnet/desktop/winforms/migration/?view=netdesktop-8.0

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search