mac 中的文件路径问题
File path issue in mac
nopCommerce 版本:4.1
我在 mac os 上使用 nopCommerce 4.1 版,在 visual studio 上使用 mac,当我 运行 这个解决方案时,我在创建路径时出错。
Plugin 'Must be assigned to customer role'. Could not load file or
assembly
'/Users/alireza/Desktop/NopCommerce/Presentation/Nop.Web/Plugins\bin/Nop.Plugin.DiscountRules.CustomerRoles.dll'.
The system cannot find the file specified.\n\nCould not load file or
assembly
'/Users/alireza/Desktop/NopCommerce/Presentation/Nop.Web/Plugins\bin/Nop.Plugin.DiscountRules.CustomerRoles.dll'.
The system cannot find the file specified.\n\n
我自己找到了解决方案:
path = Environment.OSVersion.Platform == PlatformID.Win32NT
? path.Replace("~/", string.Empty).TrimStart('/').Replace('/', '\')
: path.Replace("~/", string.Empty).TrimStart('/');
在文件opCommerce_4.10_Source/Libraries/Nop.Core/Infrastructure/NopFileProvider.cs
替换下面的函数
public virtual string MapPath(string path)
使用以下代码:
public virtual string MapPath(string path)
{
// path = path.Replace("~/", string.Empty).TrimStart('/').Replace('/', '\');
path = Environment.OSVersion.Platform == PlatformID.Win32NT
? path.Replace("~/", string.Empty).TrimStart('/').Replace('/', '\')
: path.Replace("~/", string.Empty).TrimStart('/');
return Path.Combine(BaseDirectory ?? string.Empty, path);
}
nopCommerce 版本:4.1 我在 mac os 上使用 nopCommerce 4.1 版,在 visual studio 上使用 mac,当我 运行 这个解决方案时,我在创建路径时出错。
Plugin 'Must be assigned to customer role'. Could not load file or assembly '/Users/alireza/Desktop/NopCommerce/Presentation/Nop.Web/Plugins\bin/Nop.Plugin.DiscountRules.CustomerRoles.dll'. The system cannot find the file specified.\n\nCould not load file or assembly '/Users/alireza/Desktop/NopCommerce/Presentation/Nop.Web/Plugins\bin/Nop.Plugin.DiscountRules.CustomerRoles.dll'. The system cannot find the file specified.\n\n
我自己找到了解决方案:
path = Environment.OSVersion.Platform == PlatformID.Win32NT
? path.Replace("~/", string.Empty).TrimStart('/').Replace('/', '\')
: path.Replace("~/", string.Empty).TrimStart('/');
在文件opCommerce_4.10_Source/Libraries/Nop.Core/Infrastructure/NopFileProvider.cs
替换下面的函数
public virtual string MapPath(string path)
使用以下代码:
public virtual string MapPath(string path)
{
// path = path.Replace("~/", string.Empty).TrimStart('/').Replace('/', '\');
path = Environment.OSVersion.Platform == PlatformID.Win32NT
? path.Replace("~/", string.Empty).TrimStart('/').Replace('/', '\')
: path.Replace("~/", string.Empty).TrimStart('/');
return Path.Combine(BaseDirectory ?? string.Empty, path);
}