Add version # to DLL on build

* Split VersionInfo from AssemblyInfo so we can ignore changes and let the build handle
* Ignore VersionInfo
* Install/configure assemblyinfo grunt task
* Ignore compiler warning about bad version number format (.NET vs SemVer)
This commit is contained in:
Tom Fulton
2014-02-22 00:32:37 -07:00
parent ed6068230e
commit cd2bd8c562
6 changed files with 27 additions and 9 deletions
+1
View File
@@ -23,6 +23,7 @@ pkg/*.zip
[Bb]in/
[Oo]bj/
[Pp]ackages/
VersionInfo.cs
*.aps
*.bak
+18 -3
View File
@@ -5,6 +5,7 @@ module.exports = function(grunt) {
dest: 'dist',
package_dir: 'pkg',
package_temp_dir: '<%= package_dir %>/tmp/',
csProj: 'app/Umbraco/Umbraco.Archetype/Archetype.Umbraco.csproj',
watch: {
@@ -161,16 +162,28 @@ module.exports = function(grunt) {
package_artifacts: ['pkg/*.zip', 'pkg/*.nupkg'],
},
assemblyinfo: {
options: {
files: ['<%= csProj %>'],
filename: 'VersionInfo.cs',
info: {
version: '<%= (pkgMeta.version.indexOf("-") ? pkgMeta.version.substring(0, pkgMeta.version.indexOf("-")) : pkgMeta.version) %>',
fileVersion: '<%= pkgMeta.version %>'
}
}
},
msbuild: {
dev: {
src: ['app/Umbraco/Umbraco.Archetype/Archetype.Umbraco.csproj'],
src: ["<%= csProj %>"],
options: {
projectConfiguration: 'Debug',
targets: ['Clean', 'Rebuild'],
stdout: true,
maxCpuCount: 4,
buildParameters: {
WarningLevel: 2
WarningLevel: 2,
NoWarn: 1607,
},
verbosity: 'quiet'
}
@@ -190,6 +203,7 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-template');
grunt.loadNpmTasks('grunt-touch');
grunt.loadNpmTasks('grunt-msbuild');
grunt.loadNpmTasks('grunt-dotnet-assembly-info');
grunt.loadTasks('tasks');
@@ -200,6 +214,7 @@ module.exports = function(grunt) {
grunt.registerTask('deploy', ['default', 'copy:deploy', 'touchwebconfigifenabled']);
grunt.registerTask('css:build', ['less']);
grunt.registerTask('js:build', ['concat']);
grunt.registerTask('default', ['clean', 'css:build', 'js:build', 'copy:build', 'msbuild:dev']);
grunt.registerTask('cs:build', ['assemblyinfo', 'msbuild:dev']);
grunt.registerTask('default', ['clean', 'css:build', 'js:build', 'copy:build', 'cs:build']);
};
@@ -228,6 +228,7 @@
<Compile Include="Models\Fieldset.cs" />
<Compile Include="Models\Property.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\VersionInfo.cs" />
<Compile Include="PropertyConverters\ArchetypeValueConverter.cs" />
</ItemGroup>
<ItemGroup>
@@ -11,8 +11,4 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("E37E94F9-C7BA-4B54-B7E1-64419B3DBA0B")]
[assembly: AssemblyVersion("0.1.0.0")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0-alpha")]
[assembly: Guid("E37E94F9-C7BA-4B54-B7E1-64419B3DBA0B")]
@@ -0,0 +1,4 @@
using System.Reflection;
[assembly: AssemblyVersion("0.0.0.0")]
[assembly: AssemblyFileVersion("0.0.0.0")]
+2 -1
View File
@@ -20,7 +20,8 @@
"grunt-template": "~0.2.2",
"grunt-touch": "~0.1.0",
"fs-extra": "~0.8.1",
"grunt-msbuild": "~0.1.9"
"grunt-msbuild": "~0.1.9",
"grunt-dotnet-assembly-info": "~1.0.9"
},
"repository": {
"type": "git",