Skip to content

mikeobrien/gulp-dotnet-assembly-info

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gulp-dotnet-assembly-info

npm version build status Dependency Status npm downloads

Gulp plugin for modifying C# assembly info files.

Install

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

Usage

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() {
    gulp.src('**/AssemblyInfo.cs')
        .pipe(assemblyInfo({
            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 '2.0.3.2345'; },
            ...
        }))
        .pipe(gulp.dest('.'));
});

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);
    
});

Props

Thanks to Diego Luces for adding VB.NET support.

License

MIT License

About

Gulp plugin for modifying C# assembly info files.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published