Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Add support for framework-dependent apphost #3888

Merged
merged 3 commits into from Mar 27, 2018

Conversation

steveharter
Copy link
Member

@steveharter steveharter commented Mar 23, 2018

New functionality for the apphost (<myapp>.exe) including:

  1. Ability to have an apphost use the shared framework by specifying the framework information in the runtimeconfig.json
  2. Ability to have a non-default location for the shared framework via new %DOTNET_ROOT% environment variable. This environment variable is only used by apphost. The default locations otherwise are %ProgramFiles% (Windows), /usr/share/dotnet (Unix), /usr/local/share/dotnet (OSX)
  3. Ability for an apphost to be renamed. Note, the exe still contains the original assembly name, so that does not need to (and cannot) be renamed.
  4. Ability for an apphost to specify (through a simple runtimeconfig.json file) where the application files are located (e.g. app.dll, .runtimeconfig.json, deps.json, other dependencies). This works with self-contained as well, meaning all of the self-contained files including the runtime do not need to be located next to the exe anymore.

Fixes https://github.com/dotnet/core-setup/issues/3720

Additional documentation will be provided describing the new functionality and runtimeconfig.json format.

Note for Windows Wow64 support (x86 on 64-bit), the default location is %ProgramFiles(x86)% and the new environment variable is %DOTNET_ROOT(x86)%

Automated tests are limited until we get tooling support.

The apphost now uses the casablanca json parser for startupconfig.json. I may work on removing that dependency and using simple file I\O instead to save on exe size (details pending)

cc @wli3

@steveharter steveharter added * NO MERGE * The PR is not ready for merge yet (see discussion for detailed reasons) and removed * NO MERGE * The PR is not ready for merge yet (see discussion for detailed reasons) labels Mar 23, 2018
pal::char_t* program_files_dir;
if (pal::is_running_in_wow64())
{
program_files_dir = _X("ProgramFiles(x86)");

This comment was marked as spam.

@eerhardt
Copy link
Member

(fyi may need to re-target to the release branch)

That's not the process. The process is get the code checked into master, and then port the change to the release branch.

SetStartupConfigJson(startupConfigPath, relativeNewPath);

// TODO: Use FS.Chmod when build utility project is converted to csproj.
// See https://github.com/NuGet/Home/issues/4424

This comment was marked as spam.

This comment was marked as spam.

}

[Fact]
public void Running_Publish_Output_Standalone_EXE_With_Startupconfig_Succeeds()

This comment was marked as spam.

This comment was marked as spam.

@@ -223,6 +226,8 @@ namespace pal
bool load_library(const string_t* path, dll_t* dll);
proc_t get_symbol(dll_t library, const char* name);
void unload_library(dll_t library);

bool is_running_in_wow64();

This comment was marked as spam.

This comment was marked as spam.

init->host_info.host_path = input->host_info_host_path;
init->host_info.dotnet_root = input->host_info_dotnet_root;
init->host_info.app_path = input->host_info_app_path;
// For the backwards compat case, this will be later initialized with argv[0]

This comment was marked as spam.

This comment was marked as spam.

known_opts.push_back({ _X("--runtimeconfig"), _X("<path>"), _X("Path to <application>.runtimeconfig.json file") });
known_opts.push_back({ _X("--depsfile"), _X("<path>"), _X("Path to <application>.deps.json file")});
known_opts.push_back({ _X("--runtimeconfig"), _X("<path>"), _X("Path to <application>.runtimeconfig.json file")});
known_opts.push_back({ _X("--dotnet-path"), _X("<path>"), _X("Path to the installed Shared Framework to use to run the application.")});

This comment was marked as spam.

This comment was marked as spam.

known_opts.push_back({ _X("--fx-version"), _X("<version>"), _X("Version of the installed Shared Framework to use to run the application.") });
known_opts.push_back({ _X("--roll-forward-on-no-candidate-fx"), _X(""), _X("Roll forward on no candidate shared framework is enabled") });
known_opts.push_back({ _X("--additional-deps"), _X("<path>"), _X("Path to additonal deps.json file") });
// If mode=host_mode_t::apphost, these are only used when the app is framework-dependent.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

// These settings are only valid for framework-dependent apps
if (is_framework_dependent)
{
fx_version_specified = get_last_known_arg(opts, opts_fx_version, _X(""));

This comment was marked as spam.

This comment was marked as spam.

}

// No FX resolution for mixed apps
if (mode == host_mode_t::split_fx)

This comment was marked as spam.

This comment was marked as spam.

}

trace::error(_X("A fatal error occurred, the required library %s could not be found at [%s]"), LIBFXR_NAME, own_dir.c_str());

This comment was marked as spam.

This comment was marked as spam.

@wli3 wli3 mentioned this pull request Mar 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants