diff options
author | David Karlaš <david.karlas@xamarin.com> | 2016-07-14 18:01:58 +0300 |
---|---|---|
committer | David Karlaš <david.karlas@xamarin.com> | 2016-07-14 18:03:18 +0300 |
commit | 5bd85d1cfef7cc34ff7a0b27114d098bde89c362 (patch) | |
tree | 9aa62d1108d235efef9f3300c4203389d5e6f725 /main/src/addins/TextTemplating | |
parent | e5f0129e45fc5a96893e25f578fc25a8f446c1a5 (diff) |
Bug 42558 - Broken System reference causes compilation failure
Diffstat (limited to 'main/src/addins/TextTemplating')
4 files changed, 4 insertions, 55 deletions
diff --git a/main/src/addins/TextTemplating/Mono.TextTemplating.Tests/DummyTemplateGenerator.cs b/main/src/addins/TextTemplating/Mono.TextTemplating.Tests/DummyTemplateGenerator.cs deleted file mode 100644 index a90c9a8ecd..0000000000 --- a/main/src/addins/TextTemplating/Mono.TextTemplating.Tests/DummyTemplateGenerator.cs +++ /dev/null @@ -1,50 +0,0 @@ -// -// DummyTemplateGenerator.cs -// -// Author: -// David Karlaš <david.karlas@xamarin.com> -// -// Copyright (c) 2016 Xamarin, Inc (http://www.xamarin.com) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -using System; -using System.Reflection; - -namespace Mono.TextTemplating.Tests -{ - public class DummyTemplateGenerator : TemplateGenerator - { - protected override string ResolveAssemblyReference (string assemblyReference) - { - if (System.IO.Path.IsPathRooted (assemblyReference)) - return assemblyReference; - - if (assemblyReference.EndsWith (".dll", StringComparison.OrdinalIgnoreCase)) - assemblyReference = assemblyReference.Remove (assemblyReference.Length - 4); - - var assemblyName = new AssemblyName (assemblyReference).Name; - if (assemblyName == typeof (Uri).Assembly.GetName ().Name) - return typeof (Uri).Assembly.Location;//System.dll - else if (assemblyName == typeof (System.Linq.Enumerable).Assembly.GetName ().Name) - return typeof (System.Linq.Enumerable).Assembly.Location;//System.Core.dll - return base.ResolveAssemblyReference (assemblyReference); - } - } -} - diff --git a/main/src/addins/TextTemplating/Mono.TextTemplating.Tests/GenerationTests.cs b/main/src/addins/TextTemplating/Mono.TextTemplating.Tests/GenerationTests.cs index fb26f8d23d..fec5b2ebc5 100644 --- a/main/src/addins/TextTemplating/Mono.TextTemplating.Tests/GenerationTests.cs +++ b/main/src/addins/TextTemplating/Mono.TextTemplating.Tests/GenerationTests.cs @@ -40,7 +40,7 @@ namespace Mono.TextTemplating.Tests [Test] public void TemplateGeneratorTest () { - var gen = new DummyTemplateGenerator (); + var gen = new TemplateGenerator (); string tmp = null; gen.ProcessTemplate (null, "<#@ template language=\"C#\" #>", ref tmp, out tmp); Assert.AreEqual (0, gen.Errors.Count, "ProcessTemplate"); @@ -49,7 +49,7 @@ namespace Mono.TextTemplating.Tests [Test] public void ImportReferencesTest () { - var gen = new DummyTemplateGenerator (); + var gen = new TemplateGenerator (); string tmp = null; gen.ProcessTemplate (null, "<#@ assembly name=\"System.dll\" #>\n<#@ assembly name=\"System.Core.dll\" #>", ref tmp, out tmp); Assert.AreEqual (0, gen.Errors.Count, "ImportReferencesTest"); diff --git a/main/src/addins/TextTemplating/Mono.TextTemplating.Tests/Mono.TextTemplating.Tests.csproj b/main/src/addins/TextTemplating/Mono.TextTemplating.Tests/Mono.TextTemplating.Tests.csproj index 6cf7db406b..ed523be4cf 100644 --- a/main/src/addins/TextTemplating/Mono.TextTemplating.Tests/Mono.TextTemplating.Tests.csproj +++ b/main/src/addins/TextTemplating/Mono.TextTemplating.Tests/Mono.TextTemplating.Tests.csproj @@ -44,7 +44,6 @@ <Compile Include="GenerateIndentedClassCodeTests.cs" /> <Compile Include="TextTemplatingSessionTests.cs" /> <Compile Include="EngineTests.cs" /> - <Compile Include="DummyTemplateGenerator.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\Mono.TextTemplating\Mono.TextTemplating.csproj"> diff --git a/main/src/addins/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/TemplateGenerator.cs b/main/src/addins/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/TemplateGenerator.cs index 8bf749d932..bb793a7a53 100644 --- a/main/src/addins/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/TemplateGenerator.cs +++ b/main/src/addins/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/TemplateGenerator.cs @@ -207,8 +207,8 @@ namespace Mono.TextTemplating } var assemblyName = new AssemblyName(assemblyReference); - if (assemblyName.Version != null) - return assemblyReference; + if (assemblyName.Version != null)//Load via GAC and return full path + return Assembly.Load (assemblyName).Location; if (!assemblyReference.EndsWith (".dll", StringComparison.OrdinalIgnoreCase) && !assemblyReference.EndsWith (".exe", StringComparison.OrdinalIgnoreCase))
return assemblyReference + ".dll"; |