dotnet / upgrade-assistant

A tool to assist developers in upgrading .NET Framework applications to .NET 6 and beyond
MIT License
1.11k stars 162 forks source link

Losing csproj references upon transition to SDK #1610

Open Toastedcranium opened 3 weeks ago

Toastedcranium commented 3 weeks ago

I noticed that when I convert from .net framework 4.8.1 to the SDK framework style, I lose lots of information within the csproj that affects the files in my project. It removes all embedded resources and compile items in itemgroups. Some of my files are Windows Forms and pre-SDK, I can edit the form in designer style, but after converting them, the files convert to normal .cs files and lose their design feature for all forms in the project. The .resx still exists under the file. When I add back in the itemgroup to add the embedded resource and subtype, the file type changes back to designer, but cannot be modified under the designer feature in visual studio.

Am I converting them incorrectly? Or is there something else I am missing?

Abdragiz commented 3 weeks ago

It removes all embedded resources and compile items in itemgroups.

In SDK-style projects some files are included by default. https://learn.microsoft.com/en-us/dotnet/core/project-sdk/overview#default-includes-and-excludes

Can't say anything about problems with designer.

Toastedcranium commented 2 weeks ago

Image Not sure what I can share from the project, but once I convert to SDK, assembly references that previously worked just fine and were static references (not compiled from another project), they are broken and I have to re-add them manually.

The old .csproj for the project does not have a hintpath for the missing references in there, but right clicking on the reference and going to properties, there is a path field filled out for the reference to the correct spot.

For the designer/forms, the fix was to change the inheritance to Form and back to whichever class it inherited from and it fixed it.