I am creating a Windows Forms project in Visual Studio 2022. The methods for my main form, GUI, are declared in a separate file GUI.Methods.cs via using the partial keyword.
GUI.Methods.cs
/*
* Methods for the primary form GUI class.
*/
namespace SpaceLogs13
{
partial class GUI
{
private void AdjustFilePathDisplay()
{
// (code here)
}
/*
(many other methods)
*/
}
}
However, VS started interpreting GUI.Methods.cs as being a separate form and marking it as such.
The code in that file is still available, of course, but double-clicking it in the Solution Explorer brings up the design editor, which is not only annoying by itself, but also creates a GUI.Methods.resx file (seen in the screenshot), which causes an exception when trying to run the project and has to be manually removed.
I would really prefer if this issue could be fixed.
Searching for solutions, I found this question. However, removing the SubType tag for this file in SpaceLogs13.csproj.user, as the answers suggest, is only a temporary fix: VS just makes it into a form again after reopening the project, which the OP of that question has also stated in a comment.