如何获得bin文件夹中的ASP.NET 1.0的核心 [英] How to get bin folder in ASP.NET Core 1.0

查看:90
本文介绍了如何获得bin文件夹中的ASP.NET 1.0的核心的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用asp.net 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 1.0核心应用程序的bin文件夹路径。

Can anyone please know how we can get the bin folder path for asp.net core 1.0 application.

推荐答案

那么,bin文件夹确实存在,但它被移动到文件夹的文物旁边的解决方案文件。由于ASP.NET核心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科斯托夫获得应用程序的路径。然后使用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.

public Startup(IHostingEnvironment env, IApplicationEnvironment appenv)
{
    string sAppPath = appenv.ApplicationBasePath;
    string sRootPath = Path.GetFullPath(Path.Combine(sAppPath, @"..\..\"));
    string sBinFolderPath = @"artifacts\bin\" + appenv.ApplicationName;
    string sBinPath = Path.Combine(sRootPath, sBinFolderPath);
}

这篇关于如何获得bin文件夹中的ASP.NET 1.0的核心的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆