Skip to content

Fix $(SolutionDir) path issue for CSharpToCppTranslation targets#92

Open
konard wants to merge 3 commits intomainfrom
issue-59-550197da
Open

Fix $(SolutionDir) path issue for CSharpToCppTranslation targets#92
konard wants to merge 3 commits intomainfrom
issue-59-550197da

Conversation

@konard
Copy link
Member

@konard konard commented Sep 13, 2025

Summary

Fixed the issue where $(SolutionDir) didn't work correctly for the CSharpToCppTranslation MSBuild targets, resolving issue #59.

Problem

The MSBuild targets for C# to C++ translation were commented out because $(SolutionDir) wasn't resolving to the correct path. When building through the solution file in csharp/, $(SolutionDir) resolves to the csharp/ directory, but the cpp directory is located at the root level. This caused the targets to look for csharp/cpp/ instead of the actual cpp/ directory.

Solution

  • Fixed path resolution: Changed from $(SolutionDir)cpp\ to $(SolutionDir)..\cpp\ (Windows) and $(SolutionDir)../cpp/ (Unix)
  • Updated target framework: Changed condition from net5 to net8 to match current project configuration
  • Maintained safety checks: Kept the existing condition to verify SolutionDir is not empty or undefined

Testing

Verified that:

  • $(SolutionDir) resolves to /path/to/csharp/ when building through the solution
  • The fixed path $(SolutionDir)../cpp/Platform.Disposables/ correctly points to the existing cpp directory
  • Both Windows and Unix path formats are handled appropriately
  • The condition properly prevents execution when SolutionDir is undefined (when building individual projects)

Files Changed

  • csharp/Platform.Disposables/Platform.Disposables.csproj: Uncommented and fixed the CSharpToCppTranslation targets

🤖 Generated with Claude Code


Resolves #59

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: #59
@konard konard self-assigned this Sep 13, 2025
The MSBuild targets for CSharpToCppTranslation were previously commented out
because $(SolutionDir) didn't work correctly. The issue was that when building
through the solution file in csharp/, $(SolutionDir) resolves to the csharp/
directory, but the cpp directory is located at the root level.

Changes:
- Fixed Windows target to use $(SolutionDir)..\cpp\$(ProjectName)\
- Fixed Unix target to use $(SolutionDir)../cpp/$(ProjectName)/
- Updated target framework condition from net5 to net8 (current framework)
- Kept the existing condition to check SolutionDir is not empty or undefined

This allows the C# to C++ translation to work properly when building through
the solution file.

Fixes #59

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@konard konard changed the title [WIP] Investigate why didn't work this time Fix $(SolutionDir) path issue for CSharpToCppTranslation targets Sep 13, 2025
@konard konard marked this pull request as ready for review September 13, 2025 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Investigate why $(SolutionDir) didn't work this time

1 participant