Skip to main content
Associate II
June 22, 2026
Solved

TouchGFX 4.26.0 and Visual Studio XML diff

  • June 22, 2026
  • 6 replies
  • 106 views

TouchGFX version: 4.26.0

Visual Studio version: 18.6.3

When TouchGFX generates or updates the “TouchGFX/simulator/msvs/Application.vcxproj” file it creates lines with

<ClCompile Include="path/to/some/file.cpp"/>

but Visual Studio updates the lines to 

<ClCompile Include="path/to/some/file.cpp" />

. Notice the extra space. This means that in version control sometimes commits will be added without the space and sometimes with the space. This overcomplicates merges and causes merge requests. Please update the XML library or fix the output to be consistent with Visual Studio.

Best answer by Aron Hoogeveen

Note: this is a re-post of my previous post but then with proper markup and a small fix as stated in the previous comment.

Below solution is more of a work-around, but it should fix the Application.vcxproj git struggles until there is a proper fix implemented in TouchGFX Designer.


This work-around needs Python on your Path Environment Variable.

  1. Create the file  touchgfx_post_generate_target_patches.py in the TouchGFX project folder (same folder as the somethingsomething.touchgfx file) and add the following content
    """
    All the patches that are needed for sane version control.
    """
    from pathlib import Path


    def patch_application_vcxproj():
    """ Converts '/>' to ' />' in Application.vcxproj.
    """
    p = Path('./simulator/msvs/Application.vcxproj')

    new = ''
    with p.open('r') as f:
    original = f.read()
    new = original.replace('/>', ' />')
    # remove last newline
    new = new[:-1]

    with p.open('w') as f:
    f.write(new)


    if __name__ == '__main__':
    print('PATCH: patching Application.vcxproj')
    patch_application_vcxproj()
  2. In TouchGFX Designer, go to Config → Build → Post Generate Target Command and set the following target command: touchgfx update_project && python touchgfx_post_generate_target_patches.py


Known issues:

  • on rare occasions the script cannot write to the file and will fail the Generate Code action. Just re-generate or optionally add a small delay to the script.

6 replies

Associate II
June 22, 2026

Suggestion to add the following tags to the system:

  • version control
  • git
  • Visual Studio
Andrew Neil
Super User
June 22, 2026

Suggestion to add the following tags to the system:

​​​​​​

By “the system” - do you mean this forum?

If so, Please raise that as a separate topic in the ‘Feedback’ forum

 

Edit:

It’s now been done - see:

 

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
ferro
Lead
June 23, 2026

ST did not know how to reproduce that error 2y ago. Maybe this time. 

“Application.vcxproj.filters” file is altered by GfxDesigner as well. I learned to remember to ‘Revert’ in Git.

 

 

 

 

Associate II
June 24, 2026

Steps to reproduce:

  1. Start a new project
  2. Generate sources and open the project with Visual Studio (Application.sln).
  3. Right click in Solution Explorer on “Application” and select “Properties”.
  4. Change some property that has effect on “Application.vcxproj” (e.g. change C++ language standard) and apply the changes.
  5. Build → Build Application
  6. Open `Application.vcxproj` to verify the tags have a space before the closing bracket
Osman SOYKURT
ST Technical Moderator
July 2, 2026

Hello ​@ferro and ​@Aron Hoogeveen ,

I’ve been able to reproduce the issue, and I’ll forward it to our technical team for review.

Unfortunately, I don’t have a solid workaround to recommend at the moment. As a temporary mitigation, you could consider ignoring whitespace-only changes in Git, for example with:

bash

git diff -w
# or
git diff --ignore-all-space

That said, this approach can be risky if you have intentionally introduced whitespace changes elsewhere in the project, since those would also be hidden.

ST Software Developer | TouchGFX
ferro
Lead
July 2, 2026

Thanks for the git suggestions ​@Osman SOYKURT , will definitely try if they fit into my workflow. Maybe to add into .gitignore for a specific project/metadata files.

Associate II
July 3, 2026

I’ve opted for a small patch script that always runs as a “Post Generate Target Command”. It may or may not fully cover the differences between the TouchGFX and the Visual Studio XML version, but we now have no problem with the diff anymore.

Post Generate Target Command: `touchgfx update_project && python touchgfx_post_generate_target_patches.py`

touchgfx_post_generate_target_patches.py:

```python
"""
All the patches that are needed for sane version control.
"""
import os
import os.path
import sys
import re
import shutil
from pathlib import Path
 

# other patches…

def patch_application_vcxproj():
    """ Converts '"/>' to '" />' in Application.vcxproj.
    """
    p = Path('./simulator/msvs/Application.vcxproj')

    new = ''
    with p.open('r') as f:
        original = f.read()
        new = original.replace('"/>', '" />')
        # remove last newline
        new = new[:-1]

    with p.open('w') as f:
        f.write(new)


if __name__ == '__main__':
    print('PATCH: patching .cproject')
    patch_cproject()
    print('PATCH: patching Application.vcxproj')
    patch_application_vcxproj()
 

```

Andrew Neil
Super User
July 6, 2026

This forum doesn’t support Markdown - Please see:

it does also support Python

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Associate II
July 6, 2026

That’s a bummer. I’ll use the WYSIWYG next time (not allowed to edit the post).

P.S. the link you provided redirects to the following post for me.

 

Aron HoogeveenAuthorBest answer
Associate II
July 15, 2026

Note: this is a re-post of my previous post but then with proper markup and a small fix as stated in the previous comment.

Below solution is more of a work-around, but it should fix the Application.vcxproj git struggles until there is a proper fix implemented in TouchGFX Designer.


This work-around needs Python on your Path Environment Variable.

  1. Create the file  touchgfx_post_generate_target_patches.py in the TouchGFX project folder (same folder as the somethingsomething.touchgfx file) and add the following content
    """
    All the patches that are needed for sane version control.
    """
    from pathlib import Path


    def patch_application_vcxproj():
    """ Converts '/>' to ' />' in Application.vcxproj.
    """
    p = Path('./simulator/msvs/Application.vcxproj')

    new = ''
    with p.open('r') as f:
    original = f.read()
    new = original.replace('/>', ' />')
    # remove last newline
    new = new[:-1]

    with p.open('w') as f:
    f.write(new)


    if __name__ == '__main__':
    print('PATCH: patching Application.vcxproj')
    patch_application_vcxproj()
  2. In TouchGFX Designer, go to Config → Build → Post Generate Target Command and set the following target command: touchgfx update_project && python touchgfx_post_generate_target_patches.py


Known issues:

  • on rare occasions the script cannot write to the file and will fail the Generate Code action. Just re-generate or optionally add a small delay to the script.