Skip to content

Fix WIX7009 error using StandardDirectory in Windows Service installer documentation #47592

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jul 25, 2025

The WiX Toolset configuration in the Windows Service installer documentation was causing a WIX7009 error when users tried to build the installer project. The error occurred because WiX Toolset v4 introduced virtual symbols that conflict with the traditional TARGETDIR symbol.

Error details:

WIX7009	The Directory symbol 'TARGETDIR' conflicts with a virtual symbol. Use the 'override' access modifier to override the virtual symbol or use a different Id to avoid the conflict. Referenced from wixstd.wixlib

Solution:
Replaced the legacy TARGETDIR Directory structure with WiX v4's modern StandardDirectory approach:

<!-- Before -->
<Directory Id="TARGETDIR" Name="SourceDir">
    <Directory Id="ProgramFiles64Folder">
        <!-- nested directories -->
    </Directory>
</Directory>

<!-- After -->
<StandardDirectory Id="ProgramFiles64Folder">
    <!-- nested directories -->
</StandardDirectory>

This approach:

  • Uses WiX v4's built-in StandardDirectory elements instead of legacy Directory nesting
  • Avoids the virtual symbol conflict entirely (no need for override attributes)
  • Follows WiX Toolset v4 best practices and is more future-proof
  • Simplifies the directory structure while maintaining all functionality

Fixes #42363.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.


Internal previews

📄 File 🔗 Preview link
docs/core/extensions/windows-service-with-installer.md docs/core/extensions/windows-service-with-installer

Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] WIX7009 The Directory symbol 'TARGETDIR' conflicts with a virtual symbol. Use the 'override' access modifier to override the virtual symbol or use a different Id to avoid the conflict. Referenced from wixstd.wixlib Fix WIX7009 error in Windows Service installer documentation Jul 26, 2025
Copilot finished work on behalf of gewarren July 26, 2025 00:02
@Copilot Copilot AI requested a review from gewarren July 26, 2025 00:02
@gewarren gewarren marked this pull request as ready for review July 27, 2025 03:12
@gewarren gewarren requested review from IEvangelist and a team as code owners July 27, 2025 03:12
@gewarren
Copy link
Contributor

@IEvangelist The fix that Copilot suggests is different to the fix in the issue that uses a different ID to avoid conflict. Do you have a preference?

Copy link
Contributor Author

Copilot AI commented Jul 27, 2025

@IEvangelist The fix that Copilot suggests is different to the fix in the issue that uses a different ID to avoid conflict. Do you have a preference?

I can implement either approach:

Current fix (commit b3f995e): Adds override="true" to TARGETDIR - follows the error message recommendation exactly.

Issue suggestion: Replace TARGETDIR/Directory structure with <StandardDirectory Id="ProgramFiles64Folder"> - uses WiX v4's modern approach and avoids the virtual symbol entirely.

Both fix the WIX7009 error. The StandardDirectory approach is more modern and future-proof. Which would you prefer @IEvangelist?

@Copilot Copilot AI requested a review from gewarren July 27, 2025 03:18
Copilot finished work on behalf of gewarren July 27, 2025 03:18
@gewarren
Copy link
Contributor

gewarren commented Aug 5, 2025

@copilot please use the StandardDirectory solution instead.

Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Aug 5, 2025

@copilot please use the StandardDirectory solution instead.

Implemented the StandardDirectory solution as requested. Replaced <Directory Id="TARGETDIR" Name="SourceDir" override="true"> with <StandardDirectory Id="ProgramFiles64Folder">, which uses WiX v4's modern approach and avoids the virtual symbol conflict entirely. This is more future-proof than the override attribute approach.

Changes in commit 35a3bed.

@Copilot Copilot AI changed the title Fix WIX7009 error in Windows Service installer documentation Fix WIX7009 error using StandardDirectory in Windows Service installer documentation Aug 5, 2025
Copilot finished work on behalf of gewarren August 5, 2025 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WIX7009 The Directory symbol 'TARGETDIR' conflicts with a virtual symbol. Use the 'override' access modifier to override the virtual symbol or use a different Id to avoid the conflict. Referenced from wixstd.wixlib
2 participants