A few times when I copy-paste *.cshtml
files, Visual Studio for some reason sets Build Action
on these files to be \"None\":
You could extend the .csproj
with a small snippet that will generate a warning when an item in the "None" group has the extension .cshtml
. The snippet would be:
If you see other build actions (like EmbeddedResource
), you can add them to the Filtered item definition.
If you want more advanced detection you need to actually parse the project files for any item that fits this Xpath //ItemGroup/*[not(self::Content)]/@Include
Instead of
you can also use
You'll need to manually put one of these snippets in your project file: