diff options
author | Matt Ward <matt.ward@xamarin.com> | 2016-07-07 13:50:49 +0300 |
---|---|---|
committer | Matt Ward <matt.ward@xamarin.com> | 2016-07-07 14:08:07 +0300 |
commit | 87de170307458cb8facc72c0959fc8441a89a484 (patch) | |
tree | 6b28d9ededd5efad7c4df7eee971c05a509d442a /main/src/addins/TextTemplating | |
parent | 778abd044a420fc3c993873153e632843582af34 (diff) |
[T4] Fix unit test failing on Windows
On Windows using a full path when creating an AssemblyName throws a
FileLoadException - 'The given assembly name or codebase was invalid.'
When resolving assembly references if the path is a full path then
the DummyTemplateGenerator now just returns the path. Fixing this then
caused the template code generation to fail with two compiler errors:
warning CS2023: Ignoring /noconfig option because it was specified in
a response file
error CS1703: An assembly with the same identity 'System,
Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' has
already been imported. Try removing one of the duplicate references.
By removing the .dll part from the assembly reference the System.dll
is now correctly resolved so no duplicate System assembly is added.
This fixes the compiler errors.
Diffstat (limited to 'main/src/addins/TextTemplating')
-rw-r--r-- | main/src/addins/TextTemplating/Mono.TextTemplating.Tests/DummyTemplateGenerator.cs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/main/src/addins/TextTemplating/Mono.TextTemplating.Tests/DummyTemplateGenerator.cs b/main/src/addins/TextTemplating/Mono.TextTemplating.Tests/DummyTemplateGenerator.cs index 6ddd9d9a41..a90c9a8ecd 100644 --- a/main/src/addins/TextTemplating/Mono.TextTemplating.Tests/DummyTemplateGenerator.cs +++ b/main/src/addins/TextTemplating/Mono.TextTemplating.Tests/DummyTemplateGenerator.cs @@ -32,6 +32,12 @@ namespace Mono.TextTemplating.Tests { 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 |