corehost deps path override
When running tools that load their target projects in-process [e.g. test runners like xUnit] we need to allow for the deps file [coming from the project] to be separated from the tool [coming from a Nuget package].
corehost.exe --tpaFile:"{deps path}" "{dllPath}" {other args}
/cc @schellap @anurse
Peter, is it needed in coreconsole mode also, since in that mode any args have to be forwarded to the target exe?
I had planned to include it there, but can make it corehost mode only if that's preferable. Let me know.
Even in coreconsole mode we trim the first arg since it's the app name. This code behaves similarly, conditionally removing the next argument:
if(args.app_argc > 0)
{
auto depsfile_candidate = pal::string_t(args.app_argv[0]);
if (depsfile_candidate.length() > DEPS_ARG_PREFIX_LEN && depsfile_candidate.substr(0, DEPS_ARG_PREFIX_LEN).compare(DEPS_ARG_PREFIX) == 0)
{
args.deps_path = depsfile_candidate.substr(DEPS_ARG_PREFIX_LEN, depsfile_candidate.length() - DEPS_ARG_PREFIX_LEN);
if (!pal::realpath(&args.deps_path))
{
trace::error(_X("Failed to locate deps file: %s"), args.deps_path.c_str());
return false;
}
args.app_argc = args.app_argc - 1;
args.app_argv = &args.app_argv[1];
}
}
expanded code sample to make it more obvious.