How to get bin folder in ASP.NET Core 1.0(如何在 ASP.NET Core 1.0 中获取 bin 文件夹)
问题描述
在 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 文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在 ASP.NET Core 1.0 中获取 bin 文件夹


基础教程推荐
- 经典 Asp 中的 ResolveUrl/Url.Content 等效项 2022-01-01
- JSON.NET 中基于属性的类型解析 2022-01-01
- 首先创建代码,多对多,关联表中的附加字段 2022-01-01
- 如何动态获取文本框中datagridview列的总和 2022-01-01
- 将事件 TextChanged 分配给表单中的所有文本框 2022-01-01
- 从 VS 2017 .NET Core 项目的发布目录中排除文件 2022-01-01
- 在 VS2010 中的 Post Build 事件中将 bin 文件复制到物 2022-01-01
- 是否可以在 asp classic 和 asp.net 之间共享会话状态 2022-01-01
- 错误“此流不支持搜索操作"在 C# 中 2022-01-01
- 全局 ASAX - 获取服务器名称 2022-01-01