我想在网站发布期间将另一个项目中包含的文件夹复制到发布目录中,这可能吗?
原因是我有一个项目,其中包含用于创建数据库结构的 SQL 架构文件、ASP.NET 成员资格架构以及一些针对数据库运行文件的代码。我真的不喜欢在我的网络项目中包含这些 SQL 文件,这看起来很脏。所以我想我应该将它们存储在解决方案中的其他位置。但是当我部署时,我确实需要它们在发布目录中。
I want to copy a folder that's contained in another project into the publish directory during website publish, is this possible?
The reason for this is that I have a project with the SQL schema files for creating the database structure, ASP.NET membership schema, alongside some code to run the files against the database. I don't really like having these SQL files in my web project, that just seemed dirty. So I figured I'd store them somewhere else in the solution. But when I deploy I do need them in the publish directory.
发布评论
评论(2)
为什么不将这些脚本放在
App_data
中?它将与网站的其余部分一起部署,并且无法通过客户端 Web 浏览器访问。这就是它的用途,用于存储与您的网站相关的数据,出于安全目的您不希望将这些数据存储在根目录中。Why not place these scripts in
App_data
? It will be deployed along with the rest of the website, and cannot be accessed via client web browsers. That's what it is there for, to store data associated with your website that you don't want to have in the root for security purposes.您可以包含一个用于部署的额外文件夹,其中的所有内容都可编辑发布配置文件:http://www.asp.net/mvc/tutorials/deployment/visual-studio-web-deployment/deploying-extra-files
You can include an extra folder for deployment with all its contents editing the publish profile: http://www.asp.net/mvc/tutorials/deployment/visual-studio-web-deployment/deploying-extra-files