Well, @jessehouwing 's certainly worked for me! So that fix stays nicely in my .csproj
file :).... Only, I just double-checked and it looks as if that nice snippet disappeared somewhere in the last month due to a merge of another developer or something.. (true story)
NPM alternative
Anyway, I would like to mention the NPM module check-vs-includes I created for this. It is especially convenient for dev's that have Node installed (and if you don't then you probably should :) ).
I run the check manually before each deploy, instead of on every build. But it is less likely to disappear (unnoticed) from your .csproj file due to a merge.
The main advantage however of using this NPM package, is that besides checking for Build Action NONE it also checks for files that are NOT included in your project at all. Because that can also lead to (subtle but nasty) bugs when you use Visual Studio's Web Deploy. And missing includes are actually pretty likely if:
1) you have 1 non VS developers in your team, or
2) due to merges of the .csproj file (which often has merge issues).
Check the NPM page for instructions. But below a simple example, which assumes you use Node and Gulp:
Simple example
Install the Node module
npm i check-vs-includes
Add a task to your gulpfile.js
:
var checkVSIncludes = require('check-vs-includes');
...
gulp.task('checkVSIncludes', function() {
checkVSIncludes(['/Views/**/*.cshtml', '/app/**/*.js']);
});
- Run the check in your project folder (e.g. where your
.csproj
file is)
gulp checkVSIncludes
Condition="'@(Filtered)'!=''"
to<Warning
- warning was issued all the time, even with no incorrect files – Interflow