This seems so rudimentary that I am slightly ashamed to ask, but here I am anyway. I have a fairly typical ASP.NET MVC4 solution. In there I have a couple of folder in the root directory where I am storing some logs and files. In particular I have one page that will list all the .xml files in this directory:
这似乎太初级了,我有点不好意思问,但无论如何,我还是在这里。我有一个相当典型的ASP。净MVC4解决方案。在那里,我在根目录中有两个文件夹,我在那里存储一些日志和文件。我有一个页面将列出这个目录中的所有.xml文件:
/ErrorLogs/
Running locally this code works like a charm:
在本地运行,这段代码非常有用:
@for (int i = 0; i < 50 && i < dir.GetFiles().Count(); i++)
{
<tr>
<td>
@dir.GetFiles()[i].LastWriteTime
</td>
<td>
<a href="@Url.Action("DeleteFile", "Home", new { area = "Admin", fileName = @dir.GetFiles()[i].FullName })"><i class="glyphicon glyphicon-remove-circle"></i></a>
</td>
</tr>
}
Once I deploy the application (Windows Server 2008, IIS 7), I get an error when I navigate to the page. Presumably because when I navigate to the folder on the server in inetpub/wwwroot/mysite the folders are not there.
一旦我部署了应用程序(Windows Server 2008, IIS 7),当我导航到页面时就会出现错误。大概是因为当我导航到inetpub/wwwroot/mysite服务器上的文件夹时,文件夹不在那里。
In the properties of the folder in VS I only see 'Folder Name' and 'Namespace Provider' in there.
在VS文件夹的属性中,我只看到“文件夹名”和“名称空间提供者”。
How can I get the folder to copy over when I deploy?
如何在部署时复制文件夹?
1 个解决方案
#1
1
Assuming this folder is in the MVC project and not the solution you could add a file to the project within the folder and set the Build Action property to Content.
假设这个文件夹在MVC项目中,而不是解决方案中,您可以在文件夹中向项目添加一个文件,并将Build Action属性设置为Content。
#1
1
Assuming this folder is in the MVC project and not the solution you could add a file to the project within the folder and set the Build Action property to Content.
假设这个文件夹在MVC项目中,而不是解决方案中,您可以在文件夹中向项目添加一个文件,并将Build Action属性设置为Content。