ASP.NET MVC发布不会覆盖CSHTML文件 [英] asp.net mvc publish doesn't overwrite cshtml files

查看:92
本文介绍了ASP.NET MVC发布不会覆盖CSHTML文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在定期发布我的网站,没有太多麻烦.但是今天我注意到,它不会用新版本覆盖现有的.cshtml剃刀文件.我发布,查看该文件夹,然后看到文件仍然过时.如果删除文件然后发布,它将把新版本放在那里.但是,如果文件已经存在,它将不会覆盖它,并且我的生产网站已经过时.我尝试执行发布前删除文件"选项,但它给我带来了无法删除文件夹的访问错误.我尝试删除整个文件夹,但随后丢失了.svn文件夹,因此无法识别版本控制.

I've been publishing my site regularly without too much trouble. But today I noticed that it won't overwrite existing .cshtml razor files with the new versions. I publish, look at the folder, and see the files are still out of date. If I delete the file and then publish, it will put the new version there. But if the file already exists it won't overwrite it and my production website is out of date. I tried doing the option 'delete files before publishing' but it gives me an access error that it can't delete folders. I tried deleting the entire folder but then I lose my .svn folders and it won't recognize version control.

是否有一种方法可以强制发布命令用最新版本覆盖我的.cshtml文件? (注意:dll文件会被覆盖)

Is there a way to force the Publish command to overwrite my .cshtml files with the latest version? (note: the dll files get overwritten fine)

推荐答案

似乎在文件上设置了只读"属性,因此它们不能被覆盖.检查"VS输出"窗口中是否有错误迹象.

Seems like Read-Only attribute is set on files, so they can't be overwritten. Check VS Output window for signs of errors.

建议:尝试在源代码管理中不包括生成的文件(这也意味着包含已发布文件的文件夹). VCS工具通常倾向于锁定其工作的文件.

Advice: Try to NOT include generated files (this also means folder with published files) in source control. VCS tools usually tend to lock-up files they work on.

在Test/Prod服务器上具有.svn文件也不是一个好主意.

Having .svn files on Test/Prod server is also not a good idea.

这篇关于ASP.NET MVC发布不会覆盖CSHTML文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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