如何重命名" wwwroot的"文件夹用作ASP.NET 5 Web项目Web根 [英] How to rename "wwwroot" folder used as web root in ASP.NET 5 web project

查看:318
本文介绍了如何重命名" wwwroot的"文件夹用作ASP.NET 5 Web项目Web根的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的ASP.NET项目5重命名Web根目录比的wwwroot 以外的东西。当我手动重命名该文件夹,该项目不再承认它作为Web根文件夹。该项目的属性页不允许Web根目录进行修改。有什么办法来重命名和/或重新分配ASP.NET Web根文件夹5 Web项目?

I would like to rename the web root folder in my ASP.NET 5 project to something other than wwwroot. When I manually rename that folder, the project no longer recognizes it as the web root folder. The project properties page does not allow the web root to be modified. Is there any way to rename and/or reassign the web root folder in ASP.NET 5 web projects?

推荐答案

该文档唐T挺解释你的需要的过程。他们认为有人会不能重命名的wwwroot ,但只是将使用另一个文件夹。正如你在评论中提到,你必须使用 hosting.json ,而不是 project.json 如先前建议。但是,运营事务的命令,如果要重命名的wwwroot 而不只是使用另一个文件夹。为了获得所需的结果:

The docs don't quite explain your desired process. They assume someone wouldn't rename wwwroot but would just use another folder. As you mentioned in comments, you must use hosting.json, not project.json as was previously suggested. However, the order of operations matters if you want to rename wwwroot rather than just use another folder. To get the desired result:


  1. 创建的测试文件夹(而不是重命名的wwwroot 文件夹)

  2. 添加 hosting.json 与<$ C文件$ C>根目录条目指向测试文件夹中。

  3. 如果VS不重新启动/重新打开该项目,只需重新启动VS,你应该看到的测试文件夹现在显示为根目录

  1. Create the test folder (instead of renaming wwwroot folder)
  2. Add the hosting.json file with the webroot entry pointing to the test folder.
  3. If VS doesn't restart/reopen the project, just restart VS and you should see the test folder now show up as the webroot.

在这一点上,你可以从的wwwroot 移动内容测试如果还没发生。

At that point, you can move contents from wwwroot to test if that hasn't already happened.

这篇关于如何重命名&QUOT; wwwroot的&QUOT;文件夹用作ASP.NET 5 Web项目Web根的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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