public MSBuildForwardingApp(IEnumerable <string> argsToForward) { if (Telemetry.CurrentSessionId != null) { try { Type loggerType = typeof(MSBuildLogger); argsToForward = argsToForward .Concat(new[] { $"/Logger:{loggerType.FullName},{loggerType.GetTypeInfo().Assembly.Location}" }); } catch (Exception) { // Exceptions during telemetry shouldn't cause anything else to fail } } _forwardingApp = new ForwardingApp( GetMSBuildExePath(), _msbuildRequiredParameters.Concat(argsToForward.Select(Escape)), environmentVariables: _msbuildRequiredEnvironmentVariables); }
public MSBuildForwardingApp(IEnumerable <string> argsToForward) { _forwardingApp = new ForwardingApp( GetMSBuildExePath(), argsToForward, environmentVariables: GetEnvironmentVariables()); }
public MSBuildForwardingApp(IEnumerable <string> argsToForward) { _forwardingApp = new ForwardingApp( GetMSBuildExePath(), _msbuildRequiredParameters.Concat(argsToForward), environmentVariables: _msbuildRequiredEnvironmentVariables); }
private void AddProject(string slnPath, string csprojPath) { List<string> args = new List<string>() { "sln", slnPath, "add", csprojPath, }; var dotnetPath = Path.Combine(AppContext.BaseDirectory, "dotnet.dll"); var addCommand = new ForwardingApp(dotnetPath, args); addCommand.Execute(); }
public MSBuildForwardingApp(IEnumerable <string> argsToForward) { if (Telemetry.CurrentSessionId != null) { Type loggerType = typeof(MSBuildLogger); argsToForward = argsToForward.Concat(new[] { $"\"/Logger:{loggerType.FullName},{loggerType.GetTypeInfo().Assembly.Location};{Telemetry.CurrentSessionId}\"" }); } _forwardingApp = new ForwardingApp( GetMSBuildExePath(), _msbuildRequiredParameters.Concat(argsToForward), environmentVariables: _msbuildRequiredEnvironmentVariables); }
private void RunDotnetSlnCommand(string slnPath, string projPath, string commandName) { var args = new List <string>() { "sln", slnPath, commandName, projPath, }; var dotnetPath = Path.Combine(AppContext.BaseDirectory, "dotnet.dll"); var command = new ForwardingApp(dotnetPath, args); command.Execute(); }
private string[] GetArgsForMSBuild(Func <bool> sentinelExists, out Telemetry telemetry) { telemetry = new Telemetry(new MockNuGetCacheSentinel(sentinelExists)); MSBuildForwardingApp msBuildForwardingApp = new MSBuildForwardingApp(Enumerable.Empty <string>()); FieldInfo forwardingAppFieldInfo = msBuildForwardingApp .GetType() .GetField("_forwardingApp", BindingFlags.Instance | BindingFlags.NonPublic); ForwardingApp forwardingApp = forwardingAppFieldInfo?.GetValue(msBuildForwardingApp) as ForwardingApp; FieldInfo allArgsFieldinfo = forwardingApp? .GetType() .GetField("_allArgs", BindingFlags.Instance | BindingFlags.NonPublic); return(allArgsFieldinfo?.GetValue(forwardingApp) as string[]); }
public NuGetForwardingApp(IEnumerable <string> argsToForward) { _forwardingApp = new ForwardingApp( GetNuGetExePath(), argsToForward); }