.netstandard 2.0中AppDomain.CurrentDomain.SetupInformation.PrivateBinPath的替代方案是什么
答案 0 :(得分:0)
您似乎正在寻找IHostingEnvironment
,这里的文档指南:https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.hosting.ihostingenvironment?view=aspnetcore-2.2
答案 1 :(得分:0)
实际上,我正在搜索包含代码的程序集的路径:
我找到了我认为可以满足我需要的功能
public static string AssemblyDirectory
{
get
{
string codeBase = Assembly.GetExecutingAssembly().CodeBase;
UriBuilder uri = new UriBuilder(codeBase);
string path = Uri.UnescapeDataString(uri.Path);
return Path.GetDirectoryName(path);
}
}