Asp.net mvc publish does not overwrite cshtml files

I regularly publish my site without any problems. But today I noticed that it will not overwrite existing .cshtml razor files with new versions. I publish, look at the folder and see that the files are still out of date. If I delete the file and publish it, a new version will be added there. But if the file already exists, it will not overwrite it, and my release website is out of date. I tried to make the option "delete files before publishing", but it gives me an access error that it cannot delete folders. I tried to delete the entire folder, but then I lost my .svn folders and does not recognize version control.

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

+4
source share
2 answers

It seems that the Read Only attribute is set to files, so they cannot be overwritten. Check the VS output window for errors.

Tip. Do not try to include the generated files (this also means the folder with the published files) in the original control. VCS tools tend to block the files they run on.

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

+2
source

Have you set Copy to output directory to copy always?

I also use Build Action = Content.

+3
source

Source: https://habr.com/ru/post/1399085/


All Articles