node-csproj-utils
Based on node-add-content-file-to-project, this node module will offer several utility functions for VS csproj files.
npm install node-csproj-utils
ensure a file is referenced in the project
The project file will only be changed if the file is not already referenced, if changed Visual Studio will prompt you to reload your project file.
var csprojUtils = require('node-csproj-utils'); csprojUtils.ensureInItemGroup('/path/to/file.csproj', '/app/images/some-image.png' { index: 1, type: 'Content' });
A reference to '/app/images/some-image.png' is added to the given csproj file. If an index is given, the reference will be added to the n+1'th item-group node. If not found a new itemgroup is created. A node of type is created, default is Noone.