• 大小: 0.14M
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2020-12-26
  • 语言: C#
  • 标签:

资源简介

把C#程序(含多个Dll)合并成一个Exe的超简单方

public static void Attach() { var currentDomain = AppDomain.CurrentDomain;

 currentDomain.AssemblyResolve = (s, e) => ResolveAssembly(e.Name);}public static Assembly ResolveAssembly(string assemblyName{ if (nullCache.ContainsKey(assemblyName)){ return null; }


资源截图

代码片段和文件信息

using System.Reflection;

public class ClassToTest
{
    static ClassToTest()
    {
        CosturaUtility.Initialize();
    }

    public string Simple() => ClassToReference.Simple();

    public string InternationalFoo() => ClassToReference.InternationalFoo();

    public string SimplePreembed() => ClassToReferencePreembedded.SimplePreembed();

    public string Exe() => ExeClassToReference.Exe();

    public void ThrowException()
    {
        ClassToReference.ThrowException();
    }

    public Assembly GetReferencedAssembly() => typeof(ClassToReference).Assembly;
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-06-04 04:41  Costura-master\
     文件         466  2017-06-04 04:41  Costura-master\.gitattributes
     文件        4961  2017-06-04 04:41  Costura-master\.gitignore
     文件          43  2017-06-04 04:41  Costura-master\GitVersionConfig.yaml
     目录           0  2017-06-04 04:41  Costura-master\Icons\
     文件          72  2017-06-04 04:41  Costura-master\Icons\Merge Icon - NounProject.url
     文件         797  2017-06-04 04:41  Costura-master\Icons\noun_project_256.svg
     文件        1518  2017-06-04 04:41  Costura-master\Icons\package_icon.png
     文件        7231  2017-06-04 04:41  Costura-master\README.md
     文件         417  2017-06-04 04:41  Costura-master\appveyor.yml
     文件        1088  2017-06-04 04:41  Costura-master\license.txt
     目录           0  2017-06-04 04:41  Costura-master\src\
     目录           0  2017-06-04 04:41  Costura-master\src\AssemblyToProcess\
     文件        3036  2017-06-04 04:41  Costura-master\src\AssemblyToProcess\AssemblyToProcess.csproj
     文件         579  2017-06-04 04:41  Costura-master\src\AssemblyToProcess\ClassToTest.cs
     目录           0  2017-06-04 04:41  Costura-master\src\AssemblyToReference\
     文件        2800  2017-06-04 04:41  Costura-master\src\AssemblyToReference\AssemblyToReference.csproj
     文件         285  2017-06-04 04:41  Costura-master\src\AssemblyToReference\ClassToReference.cs
     文件        3044  2017-06-04 04:41  Costura-master\src\AssemblyToReference\strings.Designer.cs
     文件        5776  2017-06-04 04:41  Costura-master\src\AssemblyToReference\strings.de.resx
     文件        5776  2017-06-04 04:41  Costura-master\src\AssemblyToReference\strings.fr.resx
     文件        5776  2017-06-04 04:41  Costura-master\src\AssemblyToReference\strings.resx
     目录           0  2017-06-04 04:41  Costura-master\src\AssemblyToReference35\
     文件        2358  2017-06-04 04:41  Costura-master\src\AssemblyToReference35\AssemblyToReference35.csproj
     文件         287  2017-06-04 04:41  Costura-master\src\AssemblyToReference35\ClassToReference.cs
     文件        3048  2017-06-04 04:41  Costura-master\src\AssemblyToReference35\strings.Designer.cs
     文件        5776  2017-06-04 04:41  Costura-master\src\AssemblyToReference35\strings.de.resx
     文件        5776  2017-06-04 04:41  Costura-master\src\AssemblyToReference35\strings.fr.resx
     文件        5776  2017-06-04 04:41  Costura-master\src\AssemblyToReference35\strings.resx
     目录           0  2017-06-04 04:41  Costura-master\src\AssemblyToReferenceMixed\
     文件        6407  2017-06-04 04:41  Costura-master\src\AssemblyToReferenceMixed\AssemblyToReferenceMixed.vcxproj
............此处省略112个文件信息

评论

共有 条评论

相关资源