1

I've finished my APP builder using Codedom, now I want to implement Assembly info change feature before compile. So when client open .exe file (codedom file not compiled one) he get 5-6 Text Boxes, and then when user fill them up and click build info from those boxes is used to fill Assembly info in AssemblyInfo.cs of file I'm compiling.

Here's example of what I tried to use: Form:

 using (ResourceWriter w = new ResourceWriter("res.resources"))
        {
            w.AddResource("AssemblyTitle", AssemblyTitle.Text);
            w.AddResource("AssemblyDescription", AssemblyDescription.Text);
            w.AddResource("AssemblyCompany", AssemblyCompany.Text);
            w.AddResource("AssemblyProduct", AssemblyProduct.Text);
            w.AddResource("AssemblyCopyright", AssemblyCopyright.Text);
            w.AddResource("AssemblyVersion", AssemblyVersion.Text);
            w.AddResource("FileName", FileName.Text);
            w.Generate();
        }
        if (CodeDom.Compile(FileName.Text + ".exe", new[] { source1, source2, source3, source4}, null, "res.resources"))
        {
            File.Delete("res.resources");
            MessageBox.Show("Done");

        }
    }

Assemblyinfo.cs:

private static void Main()
    {
        ResourceManager resourceManager = new ResourceManager("res", Assembly.GetExecutingAssembly());
        string Title = resourceManager.GetString("AssemblyTitle");
        string Description = resourceManager.GetString("AssemblyDescription");
        string Company = resourceManager.GetString("AssemblyCompany");
        string Product = resourceManager.GetString("AssemblyProduct");
        string Copyright = resourceManager.GetString("AssemblyCopyright");
        string Version = resourceManager.GetString("AssemblyVersion");


        [assembly: AssemblyTitle(Title)]
        [assembly: AssemblyDescription(Description)]
        [assembly: AssemblyConfiguration("")]
        [assembly: AssemblyCompany(Company)]
        [assembly: AssemblyProduct(Product)]
        [assembly: AssemblyCopyright(Copyright)]
        [assembly: AssemblyTrademark("")]
        [assembly: AssemblyCulture("")]


        [assembly: AssemblyVersion(Version)]
        [assembly: AssemblyFileVersion("0.74")]
    }

If anyone have any idea how to do this please write

EDIT: Debug:

Error: Expected class, delegate, enum, interface, or struct
6
Error: Expected class, delegate, enum, interface, or struct
8
Error: Assembly and module attributes must precede all other elements defined in a file except        using clauses and extern alias declarations
17
Error: Assembly and module attributes must precede all other elements defined in a file except using clauses and extern alias declarations
18
Error: Assembly and module attributes must precede all other elements defined in a file except using clauses and extern alias declarations
19
Error: Assembly and module attributes must precede all other elements defined in a file except   using clauses and extern alias declarations
20
Error: Assembly and module attributes must precede all other elements defined in a file except using clauses and extern alias declarations
21
Error: Assembly and module attributes must precede all other elements defined in a file except using clauses and extern alias declarations
22
Error: Assembly and module attributes must precede all other elements defined in a file except using clauses and extern alias declarations
23
Error: Assembly and module attributes must precede all other elements defined in a file except using clauses and extern alias declarations
24
Error: Assembly and module attributes must precede all other elements defined in a file except using clauses and extern alias declarations
26
Error: Assembly and module attributes must precede all other elements defined in a file except using clauses and extern alias declarations
29
Error: Assembly and module attributes must precede all other elements defined in a file except using clauses and extern alias declarations
31
Error: Assembly and module attributes must precede all other elements defined in a file except using clauses and extern alias declarations
32
Error: Type or namespace definition, or end-of-file expected
33
mikroxxx
  • 11
  • 3
  • Unlike forum sites, we don't use "Thanks", or "Any help appreciated", or signatures on [so]. See "[Should 'Hi', 'thanks,' taglines, and salutations be removed from posts?](http://meta.stackexchange.com/questions/2950/should-hi-thanks-taglines-and-salutations-be-removed-from-posts). – John Saunders Dec 08 '14 at 23:37
  • Please don't just ask us to solve the problem for you. Show us how _you_ tried to solve the problem yourself, then show us _exactly_ what the result was, and tell us why you feel it didn't work. See "[What Have You Tried?](http://whathaveyoutried.com/)" for an excellent article that you _really need to read_. – John Saunders Dec 08 '14 at 23:47
  • I have written the code I tried to use. – mikroxxx Dec 08 '14 at 23:49
  • And what was the result of using t his code? – John Saunders Dec 08 '14 at 23:51
  • This is Debug: Error: Expected class, delegate, enum, interface, or struct 6 Error: Expected class, delegate, enum, interface, or struct 8 Error: Assembly and module attributes must precede all other elements defined in a file except using clauses and extern alias declarations (this error multiple times , cannot post it in comment //too long) 32 Error: Type or namespace definition, or end-of-file expected 33 The thread 0x2d4 has exited with code 259 (0x103). – mikroxxx Dec 08 '14 at 23:55
  • You can add extra information about your problem by editing your own question. (And to make it easy for people to see what was the original question and what was the added info, it's nice to write "Edit:" at the start of the added material.) Thanks. – RenniePet Dec 09 '14 at 00:10
  • Does that look like any AssemblyInfo.cs you have ever seen? – John Saunders Dec 09 '14 at 00:23
  • No it does not, but I don't know how to take data from textbox and put it in asseblyinfo. – mikroxxx Dec 09 '14 at 00:37

0 Answers0