Example #1
0
        static void AssemblyAdd(
            this D.CodeCompileUnit unit, string name, string value)
        {
            var type        = "global::System.Reflection." + name;
            var declaration = new D.CodeAttributeDeclaration(type);
            var expression  = new D.CodePrimitiveExpression(value);

            declaration.Arguments.Add(new D.CodeAttributeArgument(expression));
            unit.AssemblyCustomAttributes.Add(declaration);
        }
Example #2
0
 static void Create(string dir, string name, string version)
 {
     var unit = new D.CodeCompileUnit();
     unit.AssemblyAdd("AssemblyCompany", Company);
     unit.AssemblyAdd("AssemblyCopyright", "Copyright © " + Company);
     unit.AssemblyAdd("AssemblyVersion", version);
     unit.AssemblyAdd("AssemblyFileVersion", version);
     unit.AssemblyAdd("AssemblyInformationalVersion", version);
     unit.AssemblyAdd("AssemblyProduct", name);
     unit.AssemblyAdd("AssemblyTitle", name);
     var fileName = IO.Path.Combine(dir, "_info.cs");
     using (var writer = new IO.StreamWriter(fileName))
     {
         var provider = new C.CSharpCodeProvider();
         var options = new D.Compiler.CodeGeneratorOptions();
         provider.GenerateCodeFromCompileUnit(unit, writer, options);
     }
 }
Example #3
0
        static void Create(string dir, string name, string version)
        {
            var unit = new D.CodeCompileUnit();

            unit.AssemblyAdd("AssemblyCompany", Company);
            unit.AssemblyAdd("AssemblyCopyright", "Copyright © " + Company);
            unit.AssemblyAdd("AssemblyVersion", version);
            unit.AssemblyAdd("AssemblyFileVersion", version);
            unit.AssemblyAdd("AssemblyInformationalVersion", version);
            unit.AssemblyAdd("AssemblyProduct", name);
            unit.AssemblyAdd("AssemblyTitle", name);
            var fileName = IO.Path.Combine(dir, "_info.cs");

            using (var writer = new IO.StreamWriter(fileName))
            {
                var provider = new C.CSharpCodeProvider();
                var options  = new D.Compiler.CodeGeneratorOptions();
                provider.GenerateCodeFromCompileUnit(unit, writer, options);
            }
        }