Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

How to prevent the error "Unable to read the project file ... The attribute "xmlns"?

Discussion in 'Editor & General Support' started by Picklefall1, Apr 2, 2013.

  1. Picklefall1

    Picklefall1

    Joined:
    Oct 24, 2012
    Posts:
    5
    How can I prevent the error "Unable to read the project file ... The attribute "xmlns" in element is unrecognized" when my Unity project reloads in Visual Studio 2010? I know how to temporarily fix this issue by editing the project's corresponding xml file and deleting out that offending attribute, but it's really annoying to have to keep doing this every time my project reloads. Here's a screenshot of the error:

    $visualstudioerrors.png

    Some details: I'm using Unity Pro 4.1.1f4 on a Windows 7 machine and Visual Studio 2010 Professional. I never had this problem until I switched my External Editor setting in Unity to MonoDevelop for debugging, and then switched back to Visual Studio. Here's the node I have to remove/edit:

    Code (csharp):
    1.  
    2.     <ProjectExtensions xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    3.     <MonoDevelop>
    4.     <Properties>
    5.     <Policies>
    6.     <TextStylePolicy EolMarker="Windows" inheritsSet="Mono" inheritsScope="text/plain" scope="text/x-csharp" />
    7.     <CSharpFormattingPolicy inheritsSet="Mono" inheritsScope="text/x-csharp" scope="text/x-csharp" />
    8.     </Policies>
    9.     </Properties>
    10.     </MonoDevelop>
    11.     </ProjectExtensions>
    12.  
    I've looked for posts about this error for a long time and I'm coming up empty. Thanks!
     
  2. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,745
    Unity 4.1.1 was retracted because of a different problem with external DLLs when building within Visual Studio and Mono Develop. It may or may not be related to the problem you're experiencing.

    Please upgrade to 4.1.2 and see if the problem still exists. If the problem haven't been fixed by 4.1.2 please file a bug and list the bug number here and I'll take a look.
     
  3. Picklefall1

    Picklefall1

    Joined:
    Oct 24, 2012
    Posts:
    5
    I upgraded to 4.1.2 just now, per your suggestion, and I'm still getting the error. I reported a bug: #535618. Thanks!
     
  4. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,745
    Solution for those who googled this thread.

    Problem was caused by read-only files, probably the visual studio solution, projects and user files. The only files that should be added to version control is those in the Assets and ProjectSettings folders. Under no circumstance should you add the solution files and Library folder to version control. As long as you use meta files and add those to version control along with your Assets and ProjectSettings everything else will be regenerated on demand.
     
    Last edited: Apr 4, 2013
  5. salat

    salat

    Joined:
    May 23, 2013
    Posts:
    3
  6. DatBear

    DatBear

    Joined:
    Feb 19, 2014
    Posts:
    1
    I'm getting this error as well. Does anyone have a solution?
     
  7. Kieran Chandler

    Kieran Chandler

    Joined:
    Sep 29, 2011
    Posts:
    116
    To fix this error open the project file in a text editor and remove the project extension nodes.

    In my case i had to remove this:


    Code (csharp):
    1. <ProjectExtensions xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    2.         <MonoDevelop>
    3.           <Properties>
    4.             <Policies>
    5.               <TextStylePolicy inheritsSet="VisualStudio" inheritsScope="text/plain" scope="text/plain" />
    6.               <CSharpFormattingPolicy IndentSwitchBody="True" AnonymousMethodBraceStyle="NextLine" PropertyBraceStyle="NextLine" PropertyGetBraceStyle="NextLine" PropertySetBraceStyle="NextLine" EventBraceStyle="NextLine" EventAddBraceStyle="NextLine" EventRemoveBraceStyle="NextLine" StatementBraceStyle="NextLine" ArrayInitializerBraceStyle="NextLine" BeforeMethodDeclarationParentheses="False" BeforeMethodCallParentheses="False" BeforeConstructorDeclarationParentheses="False" BeforeDelegateDeclarationParentheses="False" NewParentheses="False" inheritsSet="Mono" inheritsScope="text/x-csharp" scope="text/x-csharp" />
    7.             </Policies>
    8.           </Properties>
    9.         </MonoDevelop>
    10.       </ProjectExtensions>
     
  8. McAden

    McAden

    Joined:
    Mar 25, 2013
    Posts:
    5
    Kieran's solution is technically correct but only works until you add a file or close/reopen Unity - then you'll have to do it over again. Unity3D seems to be editing the csproj based upon whatever template it's already using rather than recreating it for Visual Studio. Once it goes to Monodevelop it doesn't want to go back.

    Solution: Delete the sln and csproj files completely. Unity3D will completely regenerate them anyway and it will do it from scratch and correctly for Visual Studio but only if they are deleted completely. Once you do that and it does so correctly then they'll stay correct and you won't have to redo anything or delete them again.
     
  9. eivholt

    eivholt

    Joined:
    Jul 8, 2013
    Posts:
    5
    McAden's solution worked for me.
     
  10. Koreldan

    Koreldan

    Joined:
    Jun 10, 2016
    Posts:
    2
    This worked for me too... thank you very very much :)
     
  11. okamoto_tomoyuki

    okamoto_tomoyuki

    Joined:
    Jan 20, 2015
    Posts:
    22

    I am using Unity 5.4.1f1 and MonoDevelop, but when I press the debug button I get a title error. No matter how many times csproj and sln erase, MonoDevelop will continue to display the title error.

    Update:
    I solved it myself. An error was displayed when setting Code Formatting on assembly. I fixed it when I set the Code Formatting in the project.
     
    Last edited: Dec 14, 2017