我正在使用ILMerge从包含1个exe和2个资源dll的项目中创建单个程序集应用程序:
这是一个简单的测试项目,有1个表单(Form1.cs),所以没什么特别的.我的目标是使用工作资源管理器创建一个单独的程序集应用程序(我已阅读ILMerge和本地化资源程序集以及单程序集多语言Windows窗体部署(ILMerge和附属程序集/本地化) - 可能吗?有关如何执行的信息这个).
编译项目后,我使用以下命令行参数运行ILMerge:
ilmerge /log:test.txt /target:winexe /copyattrs /allowdup /out:test_merged.exe
"C:\projectdir\bin\Debug\test.exe" "C:\projectdir\bin\Debug\fr-FR\test.resources.dll"
"C:\projectdir\bin\Debug\nl-BE\test.resources.dll"
Run Code Online (Sandbox Code Playgroud)
如果我使用Reflector检查合并程序集的内容,我在资源树节点下看到以下内容:
而不是fr-FR和nl-BE资源,我有2倍的fr-FR资源.这是因为资源dll的名称相同吗?结果是我只能在运行时获取fr-FR资源.
有任何想法吗 ?
更新(日志文件内容):(注意:二进制文件以"loc_"为前缀,为了清楚起见,我在之前的帖子中将它们删除了)
ILMerge version 2.10.526.0
Copyright (C) Microsoft Corporation 2004-2006. All rights reserved.
ILMerge /log:loc_test.txt /target:winexe /copyattrs /allowdup /out:loc_test_merged.exe c:\Users\<user>\Documents\Visual Studio 2008\Projects\loc_test\loc_test\bin\Debug\loc_test.exe C:\Users\<user>\Documents\Visual Studio 2008\Projects\loc_test\loc_test\bin\Debug\fr-FR\loc_test.resources.dll C:\Users\<user>\Documents\Visual Studio 2008\Projects\loc_test\loc_test\bin\Debug\nl-BE\loc_test.resources.dll
Set platform to 'v2', using directory 'C:\Windows\Microsoft.NET\Framework\v2.0.50727\..\v2.0.50727' for mscorlib.dll
Running on Microsoft (R) .NET Framework …Run Code Online (Sandbox Code Playgroud) 任何人都可以解释为什么这个小应用程序的内存使用量不断增加?
static class Program
{
private static System.Timers.Timer _TestTimer;
[STAThread]
static void Main()
{
_TestTimer = new System.Timers.Timer();
_TestTimer.Interval = 30;
_TestTimer.Elapsed += new System.Timers.ElapsedEventHandler(_TestTimer_Elapsed);
_TestTimer.Enabled = true;
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
static void _TestTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
string test = "tick";
Trace.WriteLine(test);
test = null;
}
}
Run Code Online (Sandbox Code Playgroud)
谢谢!Pika81