在 asp.net core 1.0 中添加了很多功能.但是没有办法获得 Bin 文件夹路径.
With asp.net core 1.0 There are lots of functionality added. But there is not way to get Bin Folder path.
谁能知道我们如何获取 asp.net core 1.0 应用程序的 bin 文件夹路径.
Can anyone please know how we can get the bin folder path for asp.net core 1.0 application.
好吧,bin 文件夹确实存在,但它被移动到解决方案文件旁边的 artifacts 文件夹.由于 ASP.NET Core RC 1 编译内存中的所有内容,您会发现空的 bin 文件夹.但是如果你将生成时生成输出"选项设置为 true(右键单击项目文件 -> 属性和生成选项卡),那么你会在 bin 文件夹中找到生成的文件.
Well, the bin folder does exists but it is moved to artifacts folder next to the solution file. Since ASP.NET Core RC 1 compiles everything in memory, you will find empty bin folder. But if you set "Produce output on build" option to true (Right click Project file -> Properties and Build tab) then you will find the generated files in bin folder.
我不认为有任何直接属性可用于获取此路径,但您可以使用@Nikolay Kostov 指出的相同解决方案来获取应用程序路径.然后使用 System.IO 类跳转到 bin 文件夹.
I don't think so there is any direct property available as to get the path of this but you can use the same solution pointed out by @Nikolay Kostov to get application path. And then using System.IO classes jump to bin folder.
代码已更新至此处提到的 ASP.NET Core.
http://www.talkingdotnet.com/get-application-wwwroot-path-aspnet-core-rc2/
public Startup(IHostingEnvironment env, IApplicationEnvironment appenv)
{
string sAppPath = env.ContentRootPath;
string sRootPath = Path.GetFullPath(Path.Combine(sAppPath, @"...."));
string sBinFolderPath = @"artifactsin" + appenv.ApplicationName;
string sBinPath = Path.Combine(sRootPath, sBinFolderPath);
}
这篇关于如何在 ASP.NET Core 1.0 中获取 bin 文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!