54

I just deployed an asp.net mvc 3 web application to AppHarbor but it failed:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(3932,5): error MSB3541: Files has invalid value "<<<<<<< HEAD". Illegal characters in path. [D:\temp\q5cmde4m.uk1\input\MyProject\MyProject.csproj]

This happened after I opened the project with Visual Studio 2012 (the application was created with VS2010).

mosquito87
  • 4,270
  • 11
  • 46
  • 77
  • 3
    Just FYI; this looks like the annotations git leaves from an incomplete merge. `<<<<<<<< HEAD` indicates the section where the current file's differing content is. – bright-star May 21 '15 at 01:00

6 Answers6

143

Try to search the entire solution for the value and remove it from where it occurs, and then delete the obj folder from your project. When you build again it should work.

The obj folders are hidden in Visual Studio. You can see them with a file explorer.

Razvan
  • 3,017
  • 1
  • 26
  • 35
  • 8
    wow ... I came across this and thought for sure it wouldn't work, it's so random. Not sure why this happened, but deleting the obj folder from my project directory did the trick :-/ – Joel Martinez Jan 10 '14 at 20:39
  • 4
    Some explanation would be that the `<<<<< – Razvan May 08 '14 at 10:45
  • 7
    Deleting the _obj_ folder solved the freaking problem – Allen Linatoc May 20 '15 at 05:28
  • Searching returned no results. I could not find any instance of this text in any file or path. Deleting the obj folder resolved it for me, no more error. Obj is regenerated at the next build once you delete. All good. – gleichdanke Oct 10 '16 at 12:39
  • @Razvan Curiously the my Obj is in .gitignore, and definitely not checked in. I had a slightly different symptom, but your answer worked. In my case building the individual projects worked fine, but cleaning the solution would fail! Deleting the obj folder cleared this up. – Daniel James Bryars Oct 29 '19 at 06:19
  • @DanielJamesBryars I haven't been working on VS projects for a long time so I'm not able to investigate. If it would be to guess, it could be that the `obj` is still in the repository (added in `.gitignore` at a later point) and maybe one of your coleagues or the IDE has force-added it's changes. – Razvan Nov 13 '19 at 13:13
  • I got this nonsensical "illegal characters in path" error as well, and it wouldn't tell me where the characters were. Searching didn't find them. This project did NOT come from git. Deleting the obj folder fixed it as well! – Mmm Dec 06 '19 at 17:41
57

Delete the obj folder within your project and it will fix the issue.

Sohil Bhayani
  • 571
  • 4
  • 2
5

though it is very old question but I would like to add an answer here. when you work with multiple developer in visual studio you should git ignore obj folder, .suo,.sln etc which is only holding the visual studio information user based.

refer to this SO question

Community
  • 1
  • 1
Iftikhar Ali Ansari
  • 1,650
  • 1
  • 17
  • 27
1

Ok this might be helpful to someone else.

in my case my .vbproj file and some form files somehow had the last lines of its code truncated, I fixed this by restoring this missing part of the code (around the last 10 lines were missing) from a previous backup of the same project.

The other files got corrupted in a simillar way and were fixed by restoring the missing parts of the files from the backed up ones on a text editor (notepad)

After getting this the project loaded without issue.

0

Delete both obj and bin folder it will fix the issue, which in my cas its been done and it was causing when create pull request from remote repository !!

Ishwor Khanal
  • 1,312
  • 18
  • 30
0

Yes, it is about merging conflicts. Usually Visual Studio highlights most of the errors with file paths. However, it does miss some files. All you have to do is REMOVE the "obj" an "bin" folder from your solution.

If you are in Visual Studio, you have to select "Show All/Hidden files" as "obj" folder is hidden, and then delete it.

You can also delete it by going to your directory where your project is stored e.g C:/Users/username/source/repos/project/ (can be different in your case).

Nimantha
  • 6,405
  • 6
  • 28
  • 69