Search Unity

Generate vcproj failed XmlException

Discussion in 'External Tools' started by couetcouet88, May 5, 2018.

  1. couetcouet88


    Jun 10, 2014

    I recently installed the latest version of unity 2018 and I have trouble working with visual studio 2017.
    The visual studio project file are not created.

    I have tried to create an empty project and create a script, then when I want to open it :
    - unity display some error message in the console:
    - visual studio open but saying it could find the project

    The exception:
    XmlException: expected ';' (3B) but found '/' (2F) Line 257, position 25.
    Mono.Xml2.XmlTextReader.Expect (Int32 expected)
    SyntaxTree.VisualStudio.Unity.Bridge.ProjectFilePostprocessor.OnGeneratedCSProject (System.String path, System.String content)

    I have tried to unstall all Unity + Visual but no success.

    I will be glad if someone have an idea of how to fix the problem.


    Console details:
    Code (CSharp):
    1. XmlException: expected ';' (3B) but found '/' (2F)  Line 257, position 25.
    2. Mono.Xml2.XmlTextReader.Expect (Int32 expected)
    3. Mono.Xml2.XmlTextReader.ReadEntityReference (Boolean ignoreEntityReferences)
    4. Mono.Xml2.XmlTextReader.ReadReference (Boolean ignoreEntityReferences)
    5. Mono.Xml2.XmlTextReader.ReadText (Boolean notWhitespace)
    6. Mono.Xml2.XmlTextReader.ReadContent ()
    7. Mono.Xml2.XmlTextReader.Read ()
    8. System.Xml.XmlTextReader.Read ()
    9. Mono.Xml.XmlFilterReader.Read ()
    10. System.Xml.Linq.XElement.LoadCore (System.Xml.XmlReader r, LoadOptions options)
    11. System.Xml.Linq.XNode.ReadFrom (System.Xml.XmlReader r, LoadOptions options)
    12. System.Xml.Linq.XContainer.ReadContentFrom (System.Xml.XmlReader reader, LoadOptions options)
    13. System.Xml.Linq.XElement.LoadCore (System.Xml.XmlReader r, LoadOptions options)
    14. System.Xml.Linq.XNode.ReadFrom (System.Xml.XmlReader r, LoadOptions options)
    15. System.Xml.Linq.XContainer.ReadContentFrom (System.Xml.XmlReader reader, LoadOptions options)
    16. System.Xml.Linq.XElement.LoadCore (System.Xml.XmlReader r, LoadOptions options)
    17. System.Xml.Linq.XNode.ReadFrom (System.Xml.XmlReader r, LoadOptions options)
    18. System.Xml.Linq.XContainer.ReadContentFrom (System.Xml.XmlReader reader, LoadOptions options)
    19. System.Xml.Linq.XElement.LoadCore (System.Xml.XmlReader r, LoadOptions options)
    20. System.Xml.Linq.XNode.ReadFrom (System.Xml.XmlReader r, LoadOptions options)
    21. System.Xml.Linq.XContainer.ReadContentFrom (System.Xml.XmlReader reader, LoadOptions options)
    22. System.Xml.Linq.XDocument.ReadContent (System.Xml.XmlReader reader, LoadOptions options)
    23. System.Xml.Linq.XDocument.LoadCore (System.Xml.XmlReader reader, LoadOptions options)
    24. System.Xml.Linq.XDocument.Load (System.IO.TextReader reader, LoadOptions options)
    25. System.Xml.Linq.XDocument.Parse (System.String s, LoadOptions options)
    26. System.Xml.Linq.XDocument.Parse (System.String s)
    27. SyntaxTree.VisualStudio.Unity.Bridge.ProjectFilePostprocessor.OnGeneratedCSProject (System.String path, System.String content)
    28. System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
    29. Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    30. System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
    31. System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
    32. UnityEditor.AssetPostprocessingInternal.CallOnGeneratedCSProject (System.String path, System.String content) (at C:/buildslave/unity/build/Editor/Mono/AssetPostprocessor.cs:75)
    33. UnityEditor.VisualStudioIntegration.SolutionSynchronizer.SyncProjectFileIfNotChanged (System.String path, System.String newContents) (at C:/buildslave/unity/build/Editor/Mono/VisualStudioIntegration/SolutionSynchronizer.cs:310)
    34. UnityEditor.VisualStudioIntegration.SolutionSynchronizer.SyncProject (MonoIsland island, System.Collections.Generic.Dictionary`2 allAssetsProjectParts, UnityEditor.Scripting.Compilers.ResponseFileData responseFileData, System.Collections.Generic.List`1 allProjectIslands) (at C:/buildslave/unity/build/Editor/Mono/VisualStudioIntegration/SolutionSynchronizer.cs:303)
    35. UnityEditor.VisualStudioIntegration.SolutionSynchronizer.GenerateAndWriteSolutionAndProjects (ScriptEditor scriptEditor) (at C:/buildslave/unity/build/Editor/Mono/VisualStudioIntegration/SolutionSynchronizer.cs:234)
    36. UnityEditor.VisualStudioIntegration.SolutionSynchronizer.Sync () (at C:/buildslave/unity/build/Editor/Mono/VisualStudioIntegration/SolutionSynchronizer.cs:206)
    37. UnityEditor.VisualStudioIntegration.SolutionSynchronizer.SyncIfNeeded (IEnumerable`1 affectedFiles) (at C:/buildslave/unity/build/Editor/Mono/VisualStudioIntegration/SolutionSynchronizer.cs:185)
    38. UnityEditor.SyncVS.PostprocessSyncProject (System.String[] importedAssets, System.String[] addedAssets, System.String[] deletedAssets, System.String[] movedAssets, System.String[] movedFromAssetPaths) (at C:/buildslave/unity/build/Editor/Mono/SyncProject.cs:175)
    39. UnityEditor.AssetPostprocessingInternal.PostprocessAllAssets (System.String[] importedAssets, System.String[] addedAssets, System.String[] deletedAssets, System.String[] movedAssets, System.String[] movedFromPathAssets) (at C:/buildslave/unity/build/Editor/Mono/AssetPostprocessor.cs:31)
    40. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
  2. couetcouet88


    Jun 10, 2014

    I try to instal a previous version of unity and it work :( .

    If someone has any clue feel free

  3. couetcouet88


    Jun 10, 2014

    If finally found my problem.
    My windows user name contained a special character '&'
  4. Sabmos


    May 26, 2018
    For anyone else struggling with this...

    I had a similar problem. Turns out I had an ampersand (&) in one of folder names in the project path. The problem was fixed when I got rid of the ampersand.
    chenkopel and ankit92ios2 like this.
  5. ankit92ios2


    Jul 5, 2018
    I faced same problem. So please remove & from your folder name.
  6. kristianboy04


    Aug 25, 2018
    i had a & in my pc name now i removed it and still not working please help me
  7. shmooss


    Oct 3, 2018
    Project name or any C# File with & in its name cannot be there.
  8. remekgc


    Jan 6, 2019
    If you have "&" in your user name, follow this steps and it will fix that problem for you ;)
    Rename User Folder in Windows Step-by-step:

    • First of all change your user account name by accessing the Control panel. Click Start Menu then Control Panel.
    • On the Control Panel Windows click on user account name link
    • Type in your new user account on the box bellow your profile picture and then click on the “Change Name” Button
    • The next step would be to change your folder profile. First of all you need to create a new account with administrator rights to execute the next steps. This new account is only needed to change the folder profile name. You may remove this account after you use it to change the folder profile name. To create a new account click Manage Another Account > Create a new Account
    Type in the new account. Make sure you assign “Administrator” right for this new account.

    • Log off your computer and then log in with the newly-created account
    • Open Windows Explorer and then navigate to C:\users
    • Right click on the folder you want to rename and change it to the same name as your new user profile with which you log in to your Windows
    • At this point you have successfully renamed your Windows user folder but to avoid possible error you need to perform a registry edit. Go to registry editor by typing “Registry” (without quote) in Start Menu. Navigate to the following registry value:
    • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList .
    • Righ click on the profile list and navigate to “Find” Menu
    • Type in your old user in the search box and then hit ‘Find Next”. Navigate to the “ProfileImagePath” located on the right pane of the registry editor and click twice on it
    • Edit the registry value to rename it to your new user profile.

    • Done