Browse Source

Use template file for SharpDevelop.exe.config to prevent Subversion conflicts.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1146 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
8b127a3434
  1. 1
      src/Main/StartUp/Project/StartUp.csproj
  2. 16
      src/Main/StartUp/Project/app.template.config
  3. 29
      src/Tools/UpdateAssemblyInfo/Main.cs

1
src/Main/StartUp/Project/StartUp.csproj

@ -73,6 +73,7 @@ @@ -73,6 +73,7 @@
<Content Include="..\..\GlobalAssemblyInfo.template">
<Link>Configuration\GlobalAssemblyInfo.template</Link>
</Content>
<Content Include="app.template.config" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
</Project>

16
src/Main/StartUp/Project/SharpDevelop.exe.config → src/Main/StartUp/Project/app.template.config

@ -3,22 +3,30 @@ @@ -3,22 +3,30 @@
<section name="log4net" type="System.Configuration.IgnoreSectionHandler" />
</configSections>
<runtime>
<!--
WARNING!
This file is automatically generated and will be overwritten every time SharpDevelop is compiled.
Change the template file "app.template.config" instead!
-->
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="ICSharpCode.Core" publicKeyToken="f829da5c02be14ee" culture="neutral"/>
<bindingRedirect oldVersion="2.0.0.1" newVersion="2.1.0.1143"/>
<bindingRedirect oldVersion="2.1.0.1-$INSERTVERSION$" newVersion="$INSERTVERSION$"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="ICSharpCode.SharpDevelop" publicKeyToken="f829da5c02be14ee" culture="neutral"/>
<bindingRedirect oldVersion="2.0.0.1" newVersion="2.1.0.1143"/>
<bindingRedirect oldVersion="2.1.0.1-$INSERTVERSION$" newVersion="$INSERTVERSION$"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="ICSharpCode.TextEditor" publicKeyToken="4d61825e8dd49f1a" culture="neutral"/>
<bindingRedirect oldVersion="2.0.0.1" newVersion="2.1.0.1143"/>
<bindingRedirect oldVersion="2.1.0.1-$INSERTVERSION$" newVersion="$INSERTVERSION$"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="ICSharpCode.NRefactory" publicKeyToken="efe927acf176eea2" culture="neutral"/>
<bindingRedirect oldVersion="2.0.0.1" newVersion="2.1.0.1143"/>
<bindingRedirect oldVersion="2.1.0.1-$INSERTVERSION$" newVersion="$INSERTVERSION$"/>
</dependentAssembly>
</assemblyBinding>
</runtime>

29
src/Tools/UpdateAssemblyInfo/Main.cs

@ -17,10 +17,10 @@ namespace UpdateAssemblyInfo @@ -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(@"<bindingRedirect oldVersion=""2.0.0.1"" newVersion=""[\d\.]+""/>");
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 @@ -38,7 +38,7 @@ namespace UpdateAssemblyInfo
RetrieveRevisionNumber();
string versionNumber = GetMajorVersion() + "." + revisionNumber;
UpdateStartup();
SetVersionInfo("Main/StartUp/Project/SharpDevelop.exe.config", BindingRedirect, "<bindingRedirect oldVersion=\"2.0.0.1\" newVersion=\"" + versionNumber + "\"/>");
UpdateRedirectionConfig(versionNumber);
return 0;
} catch (Exception ex) {
Console.WriteLine(ex);
@ -67,6 +67,29 @@ namespace UpdateAssemblyInfo @@ -67,6 +67,29 @@ namespace UpdateAssemblyInfo
}
}
static Regex BindingRedirect = new Regex(@"<bindingRedirect oldVersion=""2.0.0.1"" newVersion=""[\d\.]+""/>");
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 = "?";

Loading…
Cancel
Save