Cannot add source code files to a Windows Forms application?

Viewed 87

I'm trying add some code from another project into the windows form application project by copying and pasting a folder. (the folder contains some .cs files). However, I cannot see the project in the solution explorer and I cannot use any of those codes. This copy-paste process works for C# console application but it doesn't work for windows form applications.

How can I add the codes into the project?

1 Answers

Most probably because you're using .NET Framework VS .NET Core:

On these, additionally to copying files, you must include them in the project with Add Existing Item:

enter image description here

On these, copying files to directory will be sufficient:

enter image description here

In short, they use a newer, improved format of .csproj.

Related