Visual Studio 2010 “Publish” does not copy Razor view files

前端 未结 2 468
一整个雨季
一整个雨季 2020-12-30 01:43

When using the built-in Publish feature of Visual Studio 2010 with a web application that includes Razor views (.cshtml or .vbhtml), the publish service does not cop

2条回答
  •  南笙
    南笙 (楼主)
    2020-12-30 02:33

    (This answer is mostly if someone finds this through google etc)

    As @Ted Ballou pointed out you need to change output type to Content. This can be quite cumbersome if you, like me, have 100+ files in different subfolders.

    Especially since you can't update multiple files at once if there's a folder included in the selection.

    Instead of changing through the GUI, open the project file and modify the settings directly.

    In YourProject.csproj change items like:

    I used the following Regular Expression to replace all files:

    Search for:

    Replace with:

    Now Visual Studio should treat all your changed cshtml as Content on publish.

提交回复
热议问题