How to copy a C# project to another directory and not get an error

MicheleGmail 0 Reputation points
2026-06-30T08:54:33.4866667+00:00

When I make a copy of a working C# project and then go and try to open it in VS, I can't get the Form Designer to come up. I get this error:

The designer could not be shown for this file because none of the classes within it can be designed. The designer inspected the following classes in the file: Form1 --- The base class 'System.Windows.Forms.Form' could not be loaded. Ensure the assembly has been referenced and that all projects have been built.

What am I doing wrong?

--------
Developer technologies | Windows Forms

3 answers

Sort by: Most helpful
  1. Senthil kumar 1,285 Reputation points
    2026-06-30T10:23:12.2433333+00:00

    Hi @MicheleGmail

    first create a source form name into in your new form. for example frmtest(source) -> create new form (frmtest)

    then go to your source forms folder copy frmtest.cs, frmtest.resx, frmtest.designer.cs then go to new form folder paste the above copied files it will work without any issue.

    source and designation form name should be same.

    Thanks.

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments

  2. Nancy Vo (WICLOUD CORPORATION) 6,595 Reputation points Microsoft External Staff Moderator
    2026-06-30T09:59:08.8566667+00:00

    Hello @MicheleGmail ,

    Thanks for your question.

    You can refer to the following steps:

    1. Close Visual Studio completely: ensure the project is not open in the background to prevent Windows from locking the files.
    2. Remove cached directories: open your original project folder in File Explorer. Find and delete the following folders:
    • bin
    • obj
    • .vs (This is a hidden folder containing old user settings. You may need to check Hidden items in your Windows View tab to see it).
    1. Copy the Project: now that the temporary files are cleared, copy the entire project folder and paste it into your new desired directory.
    2. Rebuild in the new location: open the new copied folder and double-click the .sln file to launch Visual Studio.
    • Go to the top menu bar, click Build, and select Clean Solution.
    • Go back to the top menu bar, click Build, and select Rebuild Solution.
    1. Check architecture (If applicable): if your project references an external base class or library (as mentioned in your error log), ensure the platform target is compatible with the Designer. Right-click your project > Properties > Build, and ensure the Platform target is set to Any CPU rather than strictly x64.

    Once the rebuild is complete, double-click your form in the Solution Explorer

    I hope this addresses your question. If this response was helpful, please consider following the guidance to provide feedback.

    Was this answer helpful?


  3. AI answer

    2026-06-30T08:54:47.03+00:00

    The error indicates that Visual Studio can’t load the base class for the form at design time, so the Windows Forms Designer fails to open.

    For Windows Forms, this typically happens when the designer cannot load the assembly that contains the base form type. One documented cause is when the project (or an assembly containing the base form) is built targeting x64 or Itanium, while Visual Studio itself runs as a 32-bit process.

    When copying a project to another directory and reopening it, ensure:

    1. The project builds successfully in the new location.
    2. The Windows Forms project (and any assemblies that contain base form classes) are not compiled as x64/Itanium.

    To fix it:

    1. Open the copied project in Visual Studio.
    2. Open the project properties:
      • For Visual C#: go to Project → Properties → Build and set Platform target to Any CPU.
      • For Visual Basic: go to Project → Properties → Compile → Advanced Compile Options and set Target CPU to AnyCPU.
    3. Rebuild the solution.
    4. Reopen the form in the designer.

    Using AnyCPU ensures the form classes can be loaded both in Visual Studio (32-bit process) and at runtime, and prevents the “base class could not be loaded” designer error after copying the project.


    References:

    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.