[英]How to rename “wwwroot” folder used as web root in ASP.NET 5 web project
I would like to rename the web root folder in my ASP.NET 5 project to something other than wwwroot
. 我想将ASP.NET 5项目中的Web根文件夹重命名为
wwwroot
以外的名称。 When I manually rename that folder, the project no longer recognizes it as the web root folder. 当我手动重命名该文件夹时,项目不再将其识别为Web根文件夹。 The project properties page does not allow the web root to be modified.
项目属性页面不允许修改Web根目录。 Is there any way to rename and/or reassign the web root folder in ASP.NET 5 web projects?
有什么方法可以在ASP.NET 5 Web项目中重命名和/或重新分配Web根文件夹?
The docs don't quite explain your desired process. 该文档并没有完全解释您所需的过程。 They assume someone wouldn't rename
wwwroot
but would just use another folder. 他们假设某人不会重命名
wwwroot
而只会使用另一个文件夹。 As you mentioned in comments, you must use hosting.json
, not project.json
as was previously suggested. 正如您在评论中提到的那样,您必须使用
hosting.json
,而不是以前建议的project.json
。 However, the order of operations matters if you want to rename wwwroot
rather than just use another folder. 但是,如果要重命名
wwwroot
而不是仅使用另一个文件夹,则操作顺序很重要。 To get the desired result: 要获得理想的结果:
test
folder (instead of renaming wwwroot
folder) test
文件夹(而不是重命名wwwroot
文件夹) hosting.json
file with the webroot
entry pointing to the test
folder. hosting.json
文件,并将其webroot
条目指向test
文件夹。 test
folder now show up as the webroot
. test
文件夹现在显示为webroot
。 At that point, you can move contents from wwwroot
to test
if that hasn't already happened. 那时,您可以将内容从
wwwroot
移到test
是否还没有发生。
You can manually rename the folder but you would need to update/create the hosting.json to specify the name of web root folder. 您可以手动重命名该文件夹,但是需要更新/创建hosting.json以指定Web根文件夹的名称。
{
"webroot": "wwwroot"
}
beware: there are changes in progress between releases that are not reflected in the official docs at the time of this post yet. 请注意:在发布之间,有些版本之间的进度变化尚未在官方文档中反映出来。 ie: check here
即: 在这里检查
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.