-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Programmatically resolving shared frameworks #3412
Comments
There's no such API currently. We're considering something similar here #3290 , not exactly the same, but maybe useful. @natemcmaster do you have some more details for the scenarios you mention?
Also - what would you expect the API to take as input? Some version spec, or path to |
Two examples:
For input, I can imagine two overloads being useful, one that takes a runtimeconfig.json file, and another which takes the same parameters which can be expressed in runtimeconfig.json. If I were writing this in C#, something like this readonly struct SharedFrameworkVersionSpec
{
public string Name { get; }
public string Version { get; }
}
readonly struct SharedFrameworkInstallation
{
public string Name { get; }
public string Version { get; }
public string Directory { get; }
}
enum SharedFrameworkRollForwardPolicy
{
SameMajorMinor,
SameMajor,
Any
}
SharedFrameworkInstallation[] ResolveFrameworks(SharedFrameworkVersionSpec[] frameworks, SharedFrameworkRollForwardPolicy rollForwardPolicy = SharedFrameworkRollForwardPolicy.SameMajor, bool applyPatches = true);
SharedFrameworkInstallation[] ResolveFrameworks(string runtimeConfigPath, bool loadDevConfig = true);
This was a request made in natemcmaster/DotNetCorePlugins#19. The customer wants to write a simple console tool (only depends on Microsoft.NETCore.App) which can dynamically load a component which depends on assemblies found in other shared frameworks, like AspNetCore or Windows Desktop. Given current limitations, it seems the only solution to reference all known shared frameworks for the console tool which does the loading. |
Thanks a lot @natemcmaster . I personally would be fine with:
I would be very hesitant introducing an API which takes all the input in parameters like you proposed above. The problem is that it limits our options of adding new parameters to The |
I agree, it's a non-trivial problem to solve. But I think there are some ways we could do this. IMO it's worth having an API. In the second scenario I described -- tools for hosting providers -- we may not have the runtimeconfig.json file yet. I'd like to see if we can design an API that's forward/backwards compatible and doesn't require me to serialize the API's parameters to a JSON file on disk. |
@vitek-karas similar api could be useful also for us on coverlet https://github.com/dotnet/cli/issues/12705#issuecomment-539460359 |
In 3.0 we shipped API which can sort of do it by using a file. You could use It's not very clean and the functions are not designed specifically for this usage, but it should work. The biggest downside is probably that this will actually load In any case this will only work on 3.0 and above (including the resolved frameworks, if this resolves 2.2 framework it will fail). |
Understood...thank's for info...at the moment the issue is on users that run < 3.0 |
Due to lack of recent activity, this issue has been marked as a candidate for backlog cleanup. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will undo this process. This process is part of our issue cleanup automation. |
This issue will now be closed since it had been marked |
Is there any API to programmatically resolve a shared framework's location? I found an API for resolving SDKs (
hostfxr_resolve_sdk2
), but no equivalent for shared frameworks.Scenarios
The scenarios I had in mind for this API are:
cc @vitek-karas @dagood
The text was updated successfully, but these errors were encountered: