check-vs-includes
v0.2.5
Published
Checks that your Visual Studio includes are in fine order
Downloads
94
Maintainers
Readme
CheckVSIncludes
TODO
- Write Unit tests
- Add clear usage example, also for Grunt
Using Visual Studio Web Deploy and had some nasty issues because files were not included in your project? Do you want to prevent this from ever happening again? Well I did, and because I couldn't find a generic solution to it yet - not even on Stack Overflow - I created this Node application.
How to use it
- Install Node
npm install check-vs-includes
- Add a Gulp task (see below)
- You could install the Task Runner Explorer if you don't like command line.
Gulp task
Create a 'gulpfile.js' in your project and add a task:
var checkVSIncludes = require('check-vs-includes');
...
gulp.task('check-vs-includes', function(cb) {
checkVSIncludes(['/Content/**/*.less', '/app/**/*.js']);
});
This example checks that all .js
and .less
files in the specified folders are included in your project file. Notice you can use a globs /Content/**/*.less
to specify to take all files in the directory but also all those in any subdirectory, subsubdirectory etc.
Set working directory
Optionally you can specify an options object as a second parameter with for instance an alternative working directory cwd
. You coders can check the source code on GitHub; pull requests are very welcome. The first contribution was already made, great work Thomas!
checkVSIncludes(['/less/*.less', '/js/**/*.js'], { cwd: 'myapp.web'} );
Specify explicit project file
For Node developer .nsproj are also support. The app will autodetect the .csproj
file in the specified folder, and check all the 'physical' files in the folder against this. If autodetection doesn't work, you can also specify an explicit .csproj
filename via a third parameter. For instance if there are two .cspoj files in the folder (an old backup version or something):
gulp.task('check-vs-includes', function(cb) {
checkVSIncludes('/Content/**/*.css', { }, 'MyApp.Web.csproj');
});
Notice in this example that for the first parameter instead of an array of strings you can also specify a single string.
Beware of specifying *.*
(or **/*.*
) especially if your project includes a node_modules
folder, as these can contain A LOT of files/folders and will slow down the check or even cause a 'hang'.
Grunt task
I don't know, I'm not a gruntee :P. But input is welcome!
Command line
STILL TODO Allow running check-vs-includes on the command line. Then you could run it after doing a global install. I'm yet to get better acquanted with yarg
When to use it?
When your project uses Visual Studio's Web deploy it is necessary that every file that needs to be deployed is included in Visual Studio. E.g. in the project file (.csproj file as used by VS internally). But sometimes files can be missing, for instance when there is a developer in your project who doesn't use Visual Studio as (main) IDE. You the real frontend developers often prefer Atom, Brackets, Sublime or one of those other hip editors.
But even with only Visual Studio afficionado's in your team, files can be missing due to merging the .csproj files for instance with GIT, and then lazily choosing. The project is running fine on your localhost, but after you deploy, things can go haywire. Once this happens a manager might insist to add a bullet point in your deploy scrip to check that all files are included. But if you're working on a project of any real-life size this means you'll have to manually open 100 folders or more.
What do you mean with 'includes'?
Visual Studio (VS) - Microsoft's main IDE - organizes it's files into a solution, and a solution consists of one or more projects
. As most VS developers will know all the files that are included in the project are listed in the internal .csproj file. This is simply an XML file.