Skip to content

Update GetTextTransformExePath() to be more 'correct' #7

@jrdodds

Description

@jrdodds

Multiple versions of Visual Studio can be installed side by side and there may additionally be copies of TextTransform.exe outside of a Visual Studio installation.

There should probably be a const string for "TextTransform.exe" (instead of repeating the text).

If a value is provided for TextTransformPath, that should be tested before spending time and space getting environment variables and creating an array of strings.

The PATH should be tested. If some flavor of a "Developer Command Prompt for VS 20NN" is being used or a version of VsDevCmd.bat has otherwise been run, then texttransform will be in the PATH.

On Windows the where command can be used to test - e.g. where /q texttransform.exe will have an exit code of 0 if the tool is found. (The task project is currently .Net Framework and Windows only.)

If TextTransformPath is not provided and texttransform is not in the PATH, then the brute force approach of checking lots of possible locations can be done.

In the string array of candidate paths, newer versions of Visual Studio should come before older versions. If VS2017 and VS2022 are both installed, the current code will find the older VS2017 version.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions