I am compiling and loading C# code in run-time using Roslyn. I would like to add properties/details into the resulting file. How can it be done?
I am not sure, if I understand you right: you want to compile the assembly attributes like in an AssemblyInfo.cs file at runtime into an assembly?
So I see two solutions for your issue: The first is to use the C# runtime compiler and generate the assembly from the compiled content (see example from a test below). This you can achieve with the Microsoft.CodeAnalysis.CSharp services. If you don't want to provide "source code" strings, I would recommend you use a library like AsmResolver (https://asmresolver.readthedocs.io/en/latest/) which allows you to create or modify the assembly attributes in a comfortable way.
Both is fine for experimental purposes, as long as you don't use any of those approaches for productive code. If you first need to know more about assembly attributes, here's a good place to start: https://learn.microsoft.com/en-us/dotnet/standard/assembly/set-attributes#assembly-identity-attributes
const string dllName = "Test";
var asmInfo = new StringBuilder();
asmInfo.AppendLine("using System.Reflection;");
asmInfo.AppendLine("[assembly: AssemblyTitle(\"Test\")]");
asmInfo.AppendLine("[assembly: AssemblyVersion(\"1.0\")]");
asmInfo.AppendLine("[assembly: AssemblyCopyright(\"Spinach\")]");
var syntaxTree = CSharpSyntaxTree.ParseText(asmInfo.ToString(), encoding: Encoding.Default);
var mscorlibPath = typeof(object).Assembly.Location;
var mscorlib = MetadataReference.CreateFromFile(mscorlibPath, new MetadataReferenceProperties(MetadataImageKind.Assembly));
var options = new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary);
var compilation = CSharpCompilation.Create(dllName, references: new[] { mscorlib }, syntaxTrees: new[] { syntaxTree }, options: options);
using MemoryStream dllStream = new MemoryStream();
using Stream win32ResStream = compilation.CreateDefaultWin32Resources(versionResource: true, noManifest: false, manifestContents: null, iconInIcoFormat: null);
compilation.Emit(peStream: dllStream, win32Resources: win32ResStream);
File.WriteAllBytes($"{dllName}.dll", dllStream.ToArray());