From 0ba3d35537d01b0c5c643a6653591e438dd0d46d Mon Sep 17 00:00:00 2001 From: Inga Lovinde <52715130+inga-lovinde@users.noreply.github.com> Date: Mon, 24 Aug 2015 09:10:59 +0300 Subject: [PATCH] Workaround for CS1730 caused by complex AssemblyInfo.cs --- BuildServer/lib/tasks/dotnetrewrite.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/BuildServer/lib/tasks/dotnetrewrite.js b/BuildServer/lib/tasks/dotnetrewrite.js index a50f44a..20ad2cc 100644 --- a/BuildServer/lib/tasks/dotnetrewrite.js +++ b/BuildServer/lib/tasks/dotnetrewrite.js @@ -5,6 +5,14 @@ var async = require('async'); var glob = require('glob'); var settings = require('../../settings'); +var addAssemblyAttribute = function (content, attribute) { + var regex = /\[\s*assembly/; + if (regex.test(content)) { + return content.replace(regex, attribute + "\r\n[assembly"); + } + return content + attribute + "\r\n"; +} + module.exports = function (params, processor) { return { process: function () { @@ -49,9 +57,9 @@ module.exports = function (params, processor) { return "InternalsVisibleTo(\"" + p1 + ",PublicKey=" + settings.codeSigningPublicKey + "\")"; } ); - content += "[assembly: AssemblyKeyFileAttribute(\"" + settings.codeSigningKeyFile + "\")]\r\n" + content = addAssemblyAttribute(content, "[assembly: AssemblyKeyFileAttribute(\"" + settings.codeSigningKeyFile + "\")]\r\n"); } - content += "[assembly: AssemblyInformationalVersion(\"" + version + "\")]\r\n"; + content = addAssemblyAttribute(content, "[assembly: AssemblyInformationalVersion(\"" + version + "\")]"); return cb(null, content); }, fs.writeFile.bind(null, processor.context.exported + "/" + file)