[c#] How to edit .csproj file

When I am compiling my .csproj file using .NET Framework 4.0 MSBUILD.EXE file, I am getting an error: "lable01" not found in the current context of "website01.csproj".

Actually, I need to add every ASP.NET page with its code-behind file's reference. I've done it, it's working fine, but the above error is pending.

I hope it means that I need to add form name "LABLE01" in that .csproj file, but I do not know the syntax. Anybody please do provide me with the syntax to add form name in .csproj file.

This question is related to c# asp.net .net csproj

The answer is


Here is my option to Edit the project file without the need to Unload the project:

  1. Open Solution Explorer and switch to folder view: enter image description here

  2. Navigate to the Project which you want to edit inside the Solution folders and right-click on it.

  3. Choose Open from the Context Menu. enter image description here

That is it!

You will see the *.csproj file opened inside Visual Studio Editor.
After you can switch back to a Solution/Project view (see step 1).

enter image description here


For Visual Studio-version: 8.1.5,

  1. Right click on the project folder.
  2. Click "Tools", then "Edit File".

in vs 2019 Version 16.8.2 right click on you project name and click on "Edit Project File" enter image description here


For JetBrains Rider:

First Option

  1. Unload Project
  2. Double click the unloaded project

Second option:

  1. Click on the project
  2. Press F4

That's it!


Sorry, most efficient way with out stuffing your proj file is.

  1. right click the file.
  2. goto properties
  3. where Build Action option is set it to NONE.
  4. Do a build (yes you may get build error if you do even better)
  5. go back to properties of that file
  6. set Build Action option is set it back to Compile.
  7. rebuild.

  8. Congratulate your self for being smarter than everyone else and not ****ing you project. For me this exercise took under 10 seconds. Where as manually trying to input the compile... line into the csproj not only can render your project unusable but it is also impossible to maintain on large scale application. Better to keep source version control software to do the updates. If you need to cross merge branches then doing the above is amazing :).


Since the question is not directly mentioning Visual Studio, I will post how to do this in JetBrains Rider.

From context menu

  1. Right-click your project
  2. Go to edit
  3. Edit '{project-name.csproj}'

enter image description here

With shortcut

  1. Select project
  2. Press F4

You can right click the project file, select "Unload project" then you can open the file directly for editing by selecting "Edit project name.csproj".

You will have to load the project back after you have saved your changes in order for it to compile.

See How to: Unload and Reload Projects on MSDN.


Since project files are XML files, you can also simply edit them using any text editor that supports Unicode (notepad, notepad++ etc...)

However, I would be very reluctant to edit these files by hand - use the Solution explorer for this if at all possible. If you have errors and you know how to fix them manually, go ahead, but be aware that you can completely ruin the project file if you don't know exactly what you are doing.


There is an easier way so you don't have to unload the project. Just install this tool called EditProj in Visual Studio:
https://marketplace.visualstudio.com/items?itemName=EdMunoz.EditProj

Then right click edit you will have a new menu item Edit Project File :)
enter image description here


It is a built-in option .Net core and .Net standard projects


Examples related to c#

How can I convert this one line of ActionScript to C#? Microsoft Advertising SDK doesn't deliverer ads How to use a global array in C#? How to correctly write async method? C# - insert values from file into two arrays Uploading into folder in FTP? Are these methods thread safe? dotnet ef not found in .NET Core 3 HTTP Error 500.30 - ANCM In-Process Start Failure Best way to "push" into C# array

Examples related to asp.net

RegisterStartupScript from code behind not working when Update Panel is used You must add a reference to assembly 'netstandard, Version=2.0.0.0 No authenticationScheme was specified, and there was no DefaultChallengeScheme found with default authentification and custom authorization How to use log4net in Asp.net core 2.0 Visual Studio 2017 error: Unable to start program, An operation is not legal in the current state How to create roles in ASP.NET Core and assign them to users? How to handle Uncaught (in promise) DOMException: The play() request was interrupted by a call to pause() ASP.NET Core Web API Authentication Could not load file or assembly 'CrystalDecisions.ReportAppServer.CommLayer, Version=13.0.2000.0 WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for jquery

Examples related to .net

You must add a reference to assembly 'netstandard, Version=2.0.0.0 How to use Bootstrap 4 in ASP.NET Core No authenticationScheme was specified, and there was no DefaultChallengeScheme found with default authentification and custom authorization .net Core 2.0 - Package was restored using .NetFramework 4.6.1 instead of target framework .netCore 2.0. The package may not be fully compatible Update .NET web service to use TLS 1.2 EF Core add-migration Build Failed What is the difference between .NET Core and .NET Standard Class Library project types? Visual Studio 2017 - Could not load file or assembly 'System.Runtime, Version=4.1.0.0' or one of its dependencies Nuget connection attempt failed "Unable to load the service index for source" Token based authentication in Web API without any user interface

Examples related to csproj

How to edit .csproj file