diff --git a/src/Main/StartUp/Project/StartUp.csproj b/src/Main/StartUp/Project/StartUp.csproj
index 1135c9f0a4..2cbaded8da 100644
--- a/src/Main/StartUp/Project/StartUp.csproj
+++ b/src/Main/StartUp/Project/StartUp.csproj
@@ -73,6 +73,7 @@
Configuration\GlobalAssemblyInfo.template
+
\ No newline at end of file
diff --git a/src/Main/StartUp/Project/SharpDevelop.exe.config b/src/Main/StartUp/Project/app.template.config
similarity index 75%
rename from src/Main/StartUp/Project/SharpDevelop.exe.config
rename to src/Main/StartUp/Project/app.template.config
index 7df7a9efc2..e0962764a1 100644
--- a/src/Main/StartUp/Project/SharpDevelop.exe.config
+++ b/src/Main/StartUp/Project/app.template.config
@@ -3,22 +3,30 @@
+
-
+
-
+
-
+
-
+
diff --git a/src/Tools/UpdateAssemblyInfo/Main.cs b/src/Tools/UpdateAssemblyInfo/Main.cs
index 0497a33582..43d0d68425 100644
--- a/src/Tools/UpdateAssemblyInfo/Main.cs
+++ b/src/Tools/UpdateAssemblyInfo/Main.cs
@@ -17,10 +17,10 @@ namespace UpdateAssemblyInfo
// Updates the version numbers in the assembly information.
class MainClass
{
- static Regex AssemblyVersion = new Regex(@"AssemblyVersion\(.*\)]");
- static Regex BindingRedirect = new Regex(@"");
const string templateFile = "Main/GlobalAssemblyInfo.template";
const string globalAssemblyInfo = "Main/GlobalAssemblyInfo.cs";
+ const string configTemplateFile = "Main/StartUp/Project/app.template.config";
+ const string configFile = "Main/StartUp/Project/SharpDevelop.exe.config";
public static int Main(string[] args)
{
@@ -38,7 +38,7 @@ namespace UpdateAssemblyInfo
RetrieveRevisionNumber();
string versionNumber = GetMajorVersion() + "." + revisionNumber;
UpdateStartup();
- SetVersionInfo("Main/StartUp/Project/SharpDevelop.exe.config", BindingRedirect, "");
+ UpdateRedirectionConfig(versionNumber);
return 0;
} catch (Exception ex) {
Console.WriteLine(ex);
@@ -67,6 +67,29 @@ namespace UpdateAssemblyInfo
}
}
+ static Regex BindingRedirect = new Regex(@"");
+
+ static void UpdateRedirectionConfig(string fullVersionNumber)
+ {
+ string content;
+ using (StreamReader r = new StreamReader(configTemplateFile)) {
+ content = r.ReadToEnd();
+ }
+ content = content.Replace("$INSERTVERSION$", fullVersionNumber);
+ if (File.Exists(configFile)) {
+ using (StreamReader r = new StreamReader(configFile)) {
+ if (r.ReadToEnd() == content) {
+ // nothing changed, do not overwrite file to prevent recompilation
+ // every time.
+ return;
+ }
+ }
+ }
+ using (StreamWriter w = new StreamWriter(configFile, false, Encoding.UTF8)) {
+ w.Write(content);
+ }
+ }
+
static string GetMajorVersion()
{
string version = "?";