C# 动态创建的dll没有版本号
我想知道,如何为动态创建的DLL分配版本号。我有一个为最终用户创建DLL的迷你应用程序。但目前,所有创建的DLL的版本号都是0.0.0.0 而且很难跟踪最新的一次。是否有方法为动态创建的DLL分配版本号。我试着上网搜索,但没有用 请务必提出建议。我正在使用以下代码创建DLLC# 动态创建的dll没有版本号,c#,.net,dll,C#,.net,Dll,我想知道,如何为动态创建的DLL分配版本号。我有一个为最终用户创建DLL的迷你应用程序。但目前,所有创建的DLL的版本号都是0.0.0.0 而且很难跟踪最新的一次。是否有方法为动态创建的DLL分配版本号。我试着上网搜索,但没有用 请务必提出建议。我正在使用以下代码创建DLL // Setup for compiling var provider_options = new Dictionary<string, string>
// Setup for compiling
var provider_options = new Dictionary<string, string>
{
{"CompilerVersion","v3.5"}
};
var provider = new Microsoft.CSharp.CSharpCodeProvider(provider_options);
var compiler_params = new System.CodeDom.Compiler.CompilerParameters();
string outfile = @"D:\EDUnit.dll";
compiler_params.OutputAssembly = outfile;
compiler_params.GenerateExecutable = false;
compiler_params.ReferencedAssemblies.Add("System.dll");
// Compile
var results = provider.CompileAssemblyFromSource(compiler_params, strbase)
//编译的设置
var provider\u options=新字典
{
{“compilervision”,“v3.5”}
};
var provider=new Microsoft.CSharp.CSharpCodeProvider(provider\u选项);
var compiler_params=new System.CodeDom.compiler.CompilerParameters();
字符串输出文件=@“D:\EDUnit.dll”;
编译器_params.OutputAssembly=输出文件;
编译器_params.GenerateExecutable=false;
编译器参数referencedAssembly.Add(“System.dll”);
//编撰
var results=provider.compileasemblyfromsource(编译器参数,strbase)
您需要使用反射属性将其分配给源代码文件。代码提供者将查找、提取并添加所需的元数据。按照如下方式装饰您的源类
using System.Reflection;
[assembly: AssemblyVersion("2.1.0.0")]
[assembly: AssemblyFileVersion("2.1.0.0")]
public class Your_Class{}