Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

asp.net mvc publish doesn't overwrite cshtml files

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.

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)

like image 630
user441058 Avatar asked Feb 29 '12 21:02

user441058


2 Answers

Have you set the Copy to Output Directory to Copy Always?

I use Build Action = Content too.

like image 53
MikeT Avatar answered Sep 23 '22 10:09

MikeT


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

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.

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

like image 20
Tomas Voracek Avatar answered Sep 25 '22 10:09

Tomas Voracek