[0.75] Update templates to calculate rnwPath for *.sln files #13612
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR backports #13572 to 0.75.
Description
Visual Studio solution files cannot use variables in paths to the various project files, and up until now the paths to RNW projects assumed a simple app repo, and were hardcoded to
..\node_modules\react-native-windows\
.This PR changes the templates for both new and old architecture projects to instead inject the calculated actual path to the RNW package.
Note: Node does not "see" symlinks, only their resolved path. So if you're getting RNW via a symlink (say through yarn link) the sln file will hardcode the resolved path at the time of creation.
Type of Change
Why
Some user feedback has indicated that the hardcoded paths did not work for monorepos which may have multiple packages depending on RNW.
What
See above.
Screenshots
N/A
Testing
Verified that the path is now generated.
Changelog
Should this change be included in the release notes: yes
[0.75] Update templates to calculate rnwPath for *.sln files
Microsoft Reviewers: Open in CodeFlow