Example #1
0
        public void Execute(GeneratorExecutionContext context)
        {
            DependenciesInitializer.Init(context);

            // No initialization required for this one
            //if (!Process.GetCurrentProcess().ProcessName.Equals("devenv", StringComparison.OrdinalIgnoreCase))
            {
                // Debugger.Launch();
            }

            var gen = new XamlCodeGeneration(context);

            if (PlatformHelper.IsValidPlatform(context))
            {
                var genereratedTrees = gen.Generate();

                foreach (var tree in genereratedTrees)
                {
                    context.AddSource(tree.Key, tree.Value);

                    // Uncomment to output the generated files to a separate folder
                    // var intermediatePath = context.GetMSBuildPropertyValue("IntermediateOutputPath");
                    // var path = Path.Combine(intermediatePath, "generated");
                    // Directory.CreateDirectory(path);
                    // File.WriteAllText(Path.Combine(path, tree.Key), tree.Value);
                }
            }
        }
Example #2
0
        public override void Execute(SourceGeneratorContext context)
        {
            var gen = new XamlCodeGeneration(
                context.Compilation,
                context.GetProjectInstance(),
                context.Project
                );

            if (PlatformHelper.IsValidPlatform(context))
            {
                var genereratedTrees = gen.Generate();

                foreach (var tree in genereratedTrees)
                {
                    context.AddCompilationUnit(tree.Key, tree.Value);
                }
            }
        }
Example #3
0
        public void Execute(GeneratorExecutionContext context)
        {
            // No initialization required for this one
            //if (!Process.GetCurrentProcess().ProcessName.Equals("devenv", StringComparison.OrdinalIgnoreCase))
            //{
            //	Debugger.Launch();
            //}

            if (PlatformHelper.IsValidPlatform(context))
            {
                var gen = new XamlCodeGeneration(context);
                var genereratedTrees = gen.Generate();

                foreach (var tree in genereratedTrees)
                {
                    context.AddSource(tree.Key, tree.Value);
                }
            }
        }