Added support for variable replacement in transformed files#318
Open
gthvidsten wants to merge 1 commit into
Open
Added support for variable replacement in transformed files#318gthvidsten wants to merge 1 commit into
gthvidsten wants to merge 1 commit into
Conversation
…to verify this new behaviour.
Author
|
@microsoft-github-policy-service agree |
Author
|
@ttstanley Any comments or questions? Would be nice to have this :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Rationale
For a solution with many projects, where each project can have multiple
.configfiles, and each.configfile can have several transforms (one per developer) it can quickly become very hard to maintain.Using "variable replacement" the transform files can be changed to have only one file for the developer environments.
Each developer can then create a
Directory.Build.targetsat the root of the solution, and having this file in.gitignoreso that the developers don't overwrite each others changes.Alternatively there can be a common
Directory.Build.targetsthat imports another target file where the imported file is ignored in git.An example of
Directory.Build.targetscan be found in theWebApplicationandConsoleApp, but the gist of it is:The advantage of this is that MSBuild properties can be expanded into this
<ItemGroup>, while they cannot be expanded into a Task.The transform file can then include
$(VariableKey)which will be replaced withVariableValueduring the transform.