Skip to content

Conversation

@konard
Copy link
Member

@konard konard commented Sep 13, 2025

Summary

  • Fixed the AddNet5Support script to prevent it from updating C# to C++ translator paths
  • The script was using overly broad regex patterns that replaced ALL occurrences of netcoreapp3.0, including CSharpToCppTranslator executable paths
  • Made regex patterns more specific to only target <TargetFramework> and <TargetFrameworks> XML elements

Problem

The original script used this pattern:

's/netcoreapp3\.0/netcoreapp3.1/g'

This would incorrectly change:

<Exec Command="..\..\CSharpToCppTranslator\bin\$(Configuration)\netcoreapp3.0\CSharpToCppTranslator.exe" />

To:

<Exec Command="..\..\CSharpToCppTranslator\bin\$(Configuration)\netcoreapp3.1\CSharpToCppTranslator.exe" />

Solution

Now uses specific patterns:

's/<TargetFramework>netcoreapp3\.0<\/TargetFramework>/<TargetFramework>netcoreapp3.1<\/TargetFramework>/g'
's/netcoreapp3\.0\([;<]\)/netcoreapp3.1\1/g' 
's/netcoreapp3\.0<\/TargetFrameworks/netcoreapp3.1<\/TargetFrameworks/g'

This preserves CSharpToCppTranslator paths while properly updating project target frameworks.

Test plan

  • Tested with sample .csproj file containing CSharpToCppTranslator references
  • Verified that only TargetFramework elements are updated
  • Confirmed that CSharpToCppTranslator paths remain unchanged
  • Verified script handles multiple target frameworks with semicolon separators

🤖 Generated with Claude Code


Resolves #5

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

Issue: #5
@konard konard self-assigned this Sep 13, 2025
The script was using overly broad regex patterns that replaced all occurrences
of netcoreapp3.0 with netcoreapp3.1, including CSharpToCppTranslator paths.

Fixed by making the regex patterns more specific to only target:
- <TargetFramework> XML elements
- Target frameworks within <TargetFrameworks> elements (handling semicolon separators)

This preserves CSharpToCppTranslator executable paths and Condition attributes
while still properly updating project target frameworks as intended.

Fixes #5

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

Co-Authored-By: Claude <noreply@anthropic.com>
@konard konard changed the title [WIP] Fix AddNet5Support script Fix AddNet5Support script to not update C# to C++ translator paths Sep 13, 2025
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>'
@konard konard marked this pull request as ready for review September 13, 2025 07:47
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.

Fix AddNet5Support script

2 participants