Hi
I am currently learning C# with Visual C# 2010 express edition. i am having problem with compiling a whole bunch of files of a project(a project consisting 3 cs files) as f5/ctrl f5 seems faded. I can't add "add existing project" on solution explorer cause it shows empty folder where there are 3 cs files there. Plz help me.

Dani AI

Generated

Good catch by — creating a new project and adding the .cs files is the right fix when only raw source files exist and the project/solution metadata (.csproj/.sln) is missing or corrupted. A few additional, focused diagnostics and checks help cover the other common causes that keep F5/Start Debugging greyed out.

  • Confirm a project is actually loaded (opening a single .cs file does not create a runnable project). Open the .sln or .csproj rather than individual files.
  • In Solution Explorer, use “Show All Files” (or check whether files are included) and make sure each .cs file’s Properties → Build Action is set to Compile. Files left as “Content” or “None” won’t be compiled.
  • Verify Project Properties → Application → Output type is a Console or Windows application (not Class Library); a class library cannot be started with F5. Also check the Startup Project (right‑click project → Set as StartUp Project) and the Startup object if there are multiple Main methods.
  • If the project loads but won’t debug, build with Ctrl+Shift+B and inspect the Output and Error List windows for missing references or load errors — those prevent launching. If the .csproj itself won’t load (corrupt or missing), recreating the project and adding the files (the approach used) is the practical recovery path.

A minimal console entry point looks like this:

using System;

class Program
{
    static void Main(string[] args)
    {
        Console.WriteLine("App started");
    }
}

Keeping the .sln/.csproj under source control or backed up avoids repeated recreations. ’s follow-up shows the simple recreate-and-add approach often resolves the issue, while the checks above handle less obvious causes.

Recommended Answers

All 4 Replies

Hello austian88 welcome!
Is it a forms or console project or yet even something else?
Tell us how did you start to begin compiling.

Ok, to compile you need both a solution and a project.

  1. Find your code files on disk and copy them somewhere you remember
  2. Close the solution you have open
  3. File, New.. Project and choose either Winforms or Console depending on what you want to do
  4. Right click the project and Highlight "Add", on the new menu that appears, click "Existing Items"
  5. Find the code files on disk that you copied away and select all of them

The code files should now appear in your project and you should be able to compile.

Great explanation given by Ketsuekiame, it works. thanks

thanks Ketsuekiame . your advice helped a lot.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.