zoukankan      html  css  js  c++  java
  • CLR Via CSharp读书笔记(2):生成、打包、部署以及管理应用程序及类型

    Ch02-1-SimpleProgram.cs

    public sealed class Program {
       public static void Main() {
          System.Console.WriteLine("Hi");
       }
    }

    Ch02-2-Minimum MSCorLib.cs

    // This project is a DLL that has the "Do not reference mscorlib.dll" option turned on
    
    namespace System {
       public class  Object { }
       public struct Byte { }
       public struct SByte { }
       public struct Int16 { }
       public struct Int32 { }
       public struct Int64 { }
       public struct UInt16 { }
       public struct UInt32 { }
       public struct UInt64 { }
       public struct IntPtr { }
       public struct UIntPtr { }
       public struct Single { }
       public struct Double { }
       public struct Char { }
       public struct Boolean { }
       public class  Type { }
       public class  ValueType { }
       public class  Enum { }
       public struct Void { }
       public class  Array { }
       public class  Exception { }
       public class  ParamArrayAttribute { }
       public struct RuntimeTypeHandle { }
       public struct RuntimeFieldHandle { }
       public class  Attribute { }
       public class  Delegate { }
       public class  MulticastDelegate { }
       public class  String { }
       public interface IDisposable { }
       public enum AttributeTargets { Assembly = 1, Class = 4, }
    
       [AttributeUsage(AttributeTargets.Class, Inherited = true)]
       public sealed class AttributeUsageAttribute : Attribute {
           public AttributeUsageAttribute(AttributeTargets validOn) { }
           public bool AllowMultiple { get; set; }
           public bool Inherited { get; set; }
       }
    }
    
    namespace System.Runtime.InteropServices {
       public class OutAttribute { }
    }
    
    namespace System.Runtime.Versioning {
       [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false, Inherited = false)]
       public sealed class TargetFrameworkAttribute : Attribute {
           public TargetFrameworkAttribute(String frameworkName) { }
           public String FrameworkDisplayName { get; set; }
       }
     }
    
    namespace System.Reflection {
       public class DefaultMemberAttribute { }
    }
    
    namespace System.Collections {
       public interface IEnumerable { }
       public interface IEnumerator { }
    }

    Ch02-3-FUT.cs

    using System;
    
    public sealed class AFrequentlyUsedType {
       public AFrequentlyUsedType() {
          Console.WriteLine("A frequently used type was constructed.");
       }
    }

    Ch02-3-RUT.cs

    using System;
    
    public sealed class ARarelyUsedType {
       public ARarelyUsedType() {
          Console.WriteLine("A rarely used type was constructed.");
       }
    }

    Ch02-3-AssemblyVersionInfo.cs

    using System.Reflection;
    
    // FileDescription version information:
    [assembly: AssemblyTitle("JeffTypes.dll")]
    
    // Comments version information:
    [assembly: AssemblyDescription("This assembly contains Jeff's types")]
    
    // CompanyName version information:
    [assembly: AssemblyCompany("Wintellect")]
    
    // ProductName version information:
    [assembly: AssemblyProduct("Wintellect (R) Jeff's Type Library")]
    
    // LegalCopyright version information:
    [assembly: AssemblyCopyright("Copyright (c) Wintellect 2010")]
    
    // LegalTrademarks version information:
    [assembly:AssemblyTrademark("JeffTypes is a registered trademark of Wintellect")]
    
    // AssemblyVersion version information:
    [assembly: AssemblyVersion("3.0.0.0")]
    
    // FILEVERSION/FileVersion version information:
    [assembly: AssemblyFileVersion("1.0.0.0")]
    
    // PRODUCTVERSION/ProductVersion version information:
    [assembly: AssemblyInformationalVersion("2.0.0.0")]
    
    // Set the Language field (discussed later in the "Culture" section)
    [assembly:AssemblyCulture("")]

    Ch02-3-BuildMultiFileLibrary.bat

    @echo off
    Rem %1="$(DevEnvDir)", %2="$(SolutionDir)", %3="$(OutDir)"
    
    rem Set all the VS environment variables
    pushd %1
    call ..\Tools\VSVars32.bat
    popd
    
    rem Change to the solution directory
    cd %2
    
    REM There are two ways to build this multi-file assembly
    REM The line below picks one of those ways
    Goto Way1
    
    :Way1
    csc /t:module  /debug:full /out:Ch02-3-RUT.netmodule Ch02-3-RUT.cs
    csc /t:library /debug:full /out:Ch02-3-MultiFileLibrary.dll /addmodule:Ch02-3-RUT.netmodule Ch02-3-FUT.cs Ch02-3-AssemblyVersionInfo.cs
    md %3
    move /Y Ch02-3-RUT.netmodule %3
    move /Y Ch02-3-RUT.pdb %3
    move /Y Ch02-3-MultiFileLibrary.dll %3
    move /Y Ch02-3-MultiFileLibrary.pdb %3
    goto Exit
    
    :Way2
    csc /t:module /debug:full /out:Ch02-3-RUT.netmodule Ch02-3-RUT.cs
    csc /t:module /debug:full /out:Ch02-3-FUT.netmodule Ch02-3-FUT.cs Ch02-3-AssemblyVersionInfo.cs
    al  /out:Ch02-3-MultiFileLibrary.dll /t:library Ch02-3-RUT.netmodule Ch02-3-FUT.netmodule
    md %3
    move /Y Ch02-3-RUT.netmodule %3
    move /Y Ch02-3-RUT.pdb %3
    move /Y Ch02-3-FUT.netmodule %3
    move /Y Ch02-3-FUT.pdb %3
    move /Y Ch02-3-MultiFileLibrary.dll %3
    move /Y Ch02-3-MultiFileLibrary.pdb %3
    goto Exit
    
    :Exit

    Ch02-4-AppUsingMultiFileLibrary.cs

    using System;
    
    public static class AppUsingMultiFileLibrary {
       public static void Main() {
          new AFrequentlyUsedType();
          new ARarelyUsedType();
       }
    }
  • 相关阅读:
    CAD开发中遇到的疑难问题整理与开发技巧
    使用jquery插件jquery.qrcode生成二维码
    小程序 跳转页面
    【已解决】Intel NUC10 拔插USB口/登录QQ/蓝牙连接等导致显示器黑屏
    element-ui表格el-table回显时默认全选数据
    设计模式
    react lib-flexible postcss-px2rem集成
    odoo 接口请求原理
    odoo 更改返回的json 格式
    git 合并两个仓库
  • 原文地址:https://www.cnblogs.com/thlzhf/p/2787249.html
Copyright © 2011-2022 走看看