Background and motivation
The SDK uses Microsoft.Extensions.DependencyModel to create the .deps.json for an application or library. This file includes dependencies such as NuGet package assets. Currently, the path written to the file for those assets is that relative path in the NuGet package. It does not indicate the actual path on disk relative to the application.
This means that at run time, the host makes assumptions about where the file will be relative to the application. As a result, any custom relative path (for example, trying to put a dependency in a subfolder next to the app) is not respected. In order to support this, the expected path on disk also needs to be included in the .deps file.
The additional information is needed to address.
These issues are also related to a broader desire around allowing customization of app layout - anything we do there will probably require a fix for these issues.
cc @dotnet/appmodel @dsplaisted @richlander
API Proposal
namespace Microsoft.Extensions.DependencyModel;
public partial class ResourceAssembly
{
public ResourceAssembly(string path, string locale);
+ public ResourceAssembly(string path, string locale, string? localPath);
public string Locale { get; set; }
public string Path { get; set; }
+ public string? LocalPath { get; }
}
public partial class RuntimeFile
{
public RuntimeFile(string path, string? assemblyVersion, string? fileVersion);
+ public RuntimeFile(string path, string? assemblyVersion, string? fileVersion, string? localPath);
public string? AssemblyVersion { get; }
public string? FileVersion { get; }
public string Path { get; }
+ public string? LocalPath { get; }
}
API Usage
var runtimeFile = new RuntimeFile("lib/net10.0/lib.dll", "1.0.0", "1.0.0", "lib.dll");
var resourceAssembly = new ResourceAssembly("lib/net10.0/fr/lib.resources.dll", "fr", "fr/lib.resources.dll");
string? runtimeFileLocalPath = runtimeFile.LocalPath;
string? resourceAssemblyLocalPath = resourceAssembly.LocalPath;
Example from current .deps.json file:
"MyPackage/1.0.0": {
"runtime": {
"lib/net10.0/lib.dll": {
"assemblyVersion": "1.0.0",
"fileVersion": "1.0.0"
},
"resources": {
"lib/net10.0/fr/lib.resources.dll": {
"locale": "fr"
}
}
}
}
Example of .deps with additional information that this proposal would enable:
"MyPackage/1.0.0": {
"runtime": {
"lib/net10.0/lib.dll": {
"assemblyVersion": "1.0.0",
"fileVersion": "1.0.0",
"localPath": "lib.dll"
},
"resources": {
"lib/net10.0/fr/lib.resources.dll": {
"locale": "fr",
"localPath": "fr/lib.resources.dll"
}
}
}
}
Alternative Designs
No response
Risks
No response
Background and motivation
The SDK uses
Microsoft.Extensions.DependencyModelto create the.deps.jsonfor an application or library. This file includes dependencies such as NuGet package assets. Currently, the path written to the file for those assets is that relative path in the NuGet package. It does not indicate the actual path on disk relative to the application.This means that at run time, the host makes assumptions about where the file will be relative to the application. As a result, any custom relative path (for example, trying to put a dependency in a subfolder next to the app) is not respected. In order to support this, the expected path on disk also needs to be included in the .deps file.
The additional information is needed to address.
These issues are also related to a broader desire around allowing customization of app layout - anything we do there will probably require a fix for these issues.
cc @dotnet/appmodel @dsplaisted @richlander
API Proposal
namespace Microsoft.Extensions.DependencyModel; public partial class ResourceAssembly { public ResourceAssembly(string path, string locale); + public ResourceAssembly(string path, string locale, string? localPath); public string Locale { get; set; } public string Path { get; set; } + public string? LocalPath { get; } } public partial class RuntimeFile { public RuntimeFile(string path, string? assemblyVersion, string? fileVersion); + public RuntimeFile(string path, string? assemblyVersion, string? fileVersion, string? localPath); public string? AssemblyVersion { get; } public string? FileVersion { get; } public string Path { get; } + public string? LocalPath { get; } }API Usage
Example from current .deps.json file:
Example of .deps with additional information that this proposal would enable:
Alternative Designs
No response
Risks
No response