Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make working directory used by ProcessRunner configurable #233

Closed
siegfriedpammer opened this issue Aug 16, 2023 · 3 comments
Closed

Make working directory used by ProcessRunner configurable #233

siegfriedpammer opened this issue Aug 16, 2023 · 3 comments
Labels
General Enhancement New feature or request

Comments

@siegfriedpammer
Copy link
Contributor

siegfriedpammer commented Aug 16, 2023

Some things like detection of the current .NET version from global.json depend on the working directory of the msbuild call. Currently it is not possible to explicitly set the working directory of the msbuild invocation inside the Buildalyzer build.

Proposed API:

   public class EnvironmentOptions
    {
...
        public string WorkingDirectory { get; set; }
...
    }

(and also pass it to class BuildEnvironment of course)

and change

https://github.com/daveaglick/Buildalyzer/blob/5b732a8ce572efbba077dd08871fb609c69f94ce/src/Buildalyzer/ProjectAnalyzer.cs#L167

to

 using (ProcessRunner processRunner = new ProcessRunner(fileName, arguments, buildEnvironment.WorkingDirectory ?? Path.GetDirectoryName(ProjectFile.Path), GetEffectiveEnvironmentVariables(buildEnvironment), Manager.LoggerFactory)) 

What do you think?

@Corniel
Copy link
Contributor

Corniel commented Aug 16, 2023

As a user of this lib, I did never needed it (yet), but only seems fair that is configurable.

@daveaglick daveaglick added the General Enhancement New feature or request label Sep 1, 2023
@daveaglick
Copy link
Collaborator

Good suggestion, especially since a lot of MS Build functionality depends on having a correct working directory and different scenarios may change that.

daveaglick added a commit that referenced this issue Dec 19, 2023
@daveaglick
Copy link
Collaborator

This is now implemented and will go out with the 6.0.1 release. Thanks for the suggestion!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
General Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants