Search code examples
c#.net-assembly

Set description for programmatically generated assembly in C#


How can I set assembly description?

I'm generating assembly programmatically

CodeDomProvider.CreateProvider("C#").CompileAssemblyFromFile(parameters, files);

But i don't know where are assembly properties. is there any way to set these?


Solution

  • CompileAssemblyFromFile takes an array of files. Include AssemblyInfo.cs file with required attributes, like

    [assembly: AssemblyTitle("My Assembly Name")]
    [assembly: AssemblyDescription("")]
    [assembly: Guid("594dd732-1e7d-4981-ada3-efb341e5f918")]
    [assembly: AssemblyVersion("1.0.0.0")]
    [assembly: AssemblyFileVersion("1.0.0.0")]
    [assembly: ComVisible(false)]
    

    AssemblyInfo.cs is a file, which added by Visual Studio to any project by default. You can name it whatever you want, but i suggest to stick with this convention.