diff options
Diffstat (limited to 'Software/Visual_Studio/Tango.CodeGeneration')
3 files changed, 28 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Tango.CodeGeneration/CustomResolver.cs b/Software/Visual_Studio/Tango.CodeGeneration/CustomResolver.cs new file mode 100644 index 000000000..ee1acccae --- /dev/null +++ b/Software/Visual_Studio/Tango.CodeGeneration/CustomResolver.cs @@ -0,0 +1,20 @@ +using RazorEngine.Compilation; +using RazorEngine.Compilation.ReferenceResolver; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.CodeGeneration +{ + internal class CustomResolver : IReferenceResolver + { + public IEnumerable<CompilerReference> GetReferences(TypeContext context, IEnumerable<CompilerReference> includeAssemblies) + { + return new UseCurrentAssembliesReferenceResolver() + .GetReferences(context, includeAssemblies) + .Where(f => !f.GetFile().EndsWith(".winmd")); + } + } +} diff --git a/Software/Visual_Studio/Tango.CodeGeneration/Helper.cs b/Software/Visual_Studio/Tango.CodeGeneration/Helper.cs index dfbc893ee..af617fe3e 100644 --- a/Software/Visual_Studio/Tango.CodeGeneration/Helper.cs +++ b/Software/Visual_Studio/Tango.CodeGeneration/Helper.cs @@ -1,4 +1,5 @@ using RazorEngine; +using RazorEngine.Configuration; using RazorEngine.Templating; using System; using System.Collections.Generic; @@ -15,6 +16,12 @@ namespace Tango.CodeGeneration /// </summary> public static class Helper { + static Helper() + { + var config = new TemplateServiceConfiguration { Debug = true, ReferenceResolver = new CustomResolver() }; + Engine.Razor = RazorEngineService.Create(config); + } + /// <summary> /// Gets a code template by the code object type. /// </summary> diff --git a/Software/Visual_Studio/Tango.CodeGeneration/Tango.CodeGeneration.csproj b/Software/Visual_Studio/Tango.CodeGeneration/Tango.CodeGeneration.csproj index db77d9f20..ff83f8ce4 100644 --- a/Software/Visual_Studio/Tango.CodeGeneration/Tango.CodeGeneration.csproj +++ b/Software/Visual_Studio/Tango.CodeGeneration/Tango.CodeGeneration.csproj @@ -63,6 +63,7 @@ <Compile Include="Class.cs" /> <Compile Include="CodeFile.cs" /> <Compile Include="CodeObject.cs" /> + <Compile Include="CustomResolver.cs" /> <Compile Include="DpProperty.cs" /> <Compile Include="EntityCodeFileJavaExtension.cs" /> <Compile Include="EntityCodeFileJava.cs" /> |
