node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »



npm version build status Dependency Status npm downloads

Gulp plugin for modifying C# assembly info files.


$ npm install gulp-dotnet-assembly-info --save


Simply pass in an object containing the attibutes and their replacements. The replacement can be a value or a function. A function is passed the value specified in the original assembly info file and returns the replacement value. The convention for attribute names is the name without the Assembly prefix and camel cased. So an attribute name of fileVersion will be converted to AssemblyFileVersion. The files can simply be replaced by piping them to the same location (.pipe(gulp.dest('.'))) or to a new location.

var gulp = require('gulp'),
    assemblyInfo = require('gulp-dotnet-assembly-info');
gulp.task('assemblyInfo', function() {
            title: 'Planet Express Website',
            description: 'Shipping and tracking website.', 
            configuration: 'Release', 
            company: 'Planet Express', 
            product: 'Planet Express Website', 
            copyright: 'Copyright 3002 © Planet Express', 
            trademark: 'Planet Express', 
            culture: 'div-MV',
            version: function(value) { return value + '.2345'; },
            fileVersion: function(value) { return ''; },

You can also use the plugin to read the data from assembly info file:

var gulp = require('gulp'),
     fs = require('fs'),
    assemblyInfo = require('gulp-dotnet-assembly-info');
gulp.task('readAssemblyInfo', function () {
    var assemblyInfoFileContents = fs.readFileSync('./properties/AssemblyInfo.cs', "utf8");
    var assembly = assemblyInfo.getAssemblyMetadata(assemblyInfoFileContents);
    console.log("Current version is: " + assembly.AssemblyVersion);


Thanks to Diego Luces for adding VB.NET support.


MIT License