Skip to content

Analyzers prototyping - properly inject bootstrap location into tests #9729

@JanKrivanek

Description

@JanKrivanek

Context

#9380

Goals

Tha sample unit test works properly regardless of the curent target FW and configuration and regardless of how/where we place our bootstrap binaries.
Current code:

// TODO: use proper way of passing the bootsrtrap location: https://github.com/dotnet/msbuild/issues/9729
string basePath = PathToCurrentlyRunningMsBuildExe.Substring(0, PathToCurrentlyRunningMsBuildExe.IndexOf(@"artifacts\bin", StringComparison.InvariantCultureIgnoreCase));
#if NET
string pathToExecutable = EnvironmentProvider.GetDotnetExePath();
msbuildParameters = Path.Combine(basePath, @"artifacts\bin\bootstrap\net8.0\MSBuild\msbuild.dll") + " " + msbuildParameters;
#else
string pathToExecutable =
Path.Combine(basePath, @"artifacts\bin\bootstrap\net472\MSBuild\Current\Bin\amd64\msbuild.exe");
#endif

Proper way - the bootstrap location from the build script is passed via property into the compiled test binary and hence proper location is used

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions