Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I fix a Corrupted csproj file?

I'm in a group working on a project, and was about to Rebase my branch with the new updates from master-branch using git. When rebase started, it suddenly breaks down and gives me this error message:

The project file could not be loaded. Name cannot 
begin with the '<' character, hexadecimal value 0x3C.
Line 173, position 2.

The "csproj" file seems to be corrupted. How can i fix this? The problem looks like this:

  <ItemGroup>
    <Compile Include="App_Start\BundleConfig.cs" />
    <Compile Include="App_Start\FilterConfig.cs" />
    <Compile Include="App_Start\IdentityConfig.cs" />
    <Compile Include="App_Start\RouteConfig.cs" />
    <Compile Include="App_Start\Startup.Auth.cs" />
    <Compile Include="App_Start\WebApiConfig.cs" />
    <Compile Include="Controllers\AccountController.cs" />
    <Compile Include="Controllers\CategoryController.cs" />
<<<<<<< HEAD
    <Compile Include="Controllers\GalleryController.cs" />
=======
    <Compile Include="Controllers\CheckoutController.cs" />
>>>>>>> Checkout Works. something wrong with Authorization. No need be logged
    <Compile Include="Controllers\HomeController.cs" />
    <Compile Include="Controllers\ManageController.cs" />
    <Compile Include="Controllers\PhotoController.cs" />
    <Compile Include="Controllers\ShoppingCartController.cs" />
    <Compile Include="Controllers\StoreController.cs" />
    <Compile Include="Controllers\StoreManagerController.cs" />
    <Compile Include="Global.asax.cs">
      <DependentUpon>Global.asax</DependentUpon>
    </Compile>
like image 325
Chrisaboo Avatar asked May 23 '15 16:05

Chrisaboo


People also ask

How do I fix Csproj?

First you have to navigate to the project's node in Solution Explorer. Then you have to right-click > Unload the project. Then you have to right-click > Edit the csproj file. Then you have to find the offending line in the csproj file and modify or delete it.

What program opens Csproj files?

CSPROJ files are are meant to be opened and edited in Microsoft Visual Studio (Windows, Mac) as part of Visual Studio projects.

What is Csproj file in Visual Studio?

When you create and build solutions in Visual Studio, Visual Studio uses MSBuild to build each project in your solution. Every Visual Studio project includes an MSBuild project file, with a file extension that reflects the type of project—for example, a C# project (. csproj), a Visual Basic.NET project (.

How do I open a VS Csproj file?

Start from a project If your program code is already in a Visual Studio project, open the project. To do so, you can double-click or tap on the . csproj file in Windows File Explorer, or choose Open a project in Visual Studio, browse to find the . csproj file, and select the file.


2 Answers

Just delete below type of text's in csproj file

***<<<<<<<<<<<<<<<

---------Mine

'>>>>>>>>>>>>>>>>>>>***

And reload project again it will work.

like image 131
nagaraj Avatar answered Sep 21 '22 00:09

nagaraj


I agree Chrisaboo. The problem is in the project file. Whenever you update your solution in Visual Studio, there is a possibility of a merge conflict. You can resolve this by comparing your project file with the previous version and eliminating the differences in a text editor or the version control tool. This resolved the issue for me.

It is recommended to update the project on a folder level in Visual Studio rather than the solution level.

like image 22
shreyamsh Avatar answered Sep 19 '22 00:09

shreyamsh