当前位置: 首页 > news >正文

给宝宝做衣服网站好能建商城

给宝宝做衣服网站好,能建商城,共享主机Wordpress迁移到vps,傻瓜建网站每次发布 dotnet core 应用都会觉得发布文件太大#xff0c;而如果使用极限压缩#xff0c;用 CoreRT 能让发布的控制台文件到 5KB 左右#xff0c;不需要带框架就能在其他设备运行这是微软 MichalStrehovsky 大佬#xff0c;也就是 CoreRT 项目开发者给的方法在开始写代码… 每次发布 dotnet core 应用都会觉得发布文件太大而如果使用极限压缩用 CoreRT 能让发布的控制台文件到 5KB 左右不需要带框架就能在其他设备运行这是微软 MichalStrehovsky 大佬也就是 CoreRT 项目开发者给的方法在开始写代码之前需要定义一些基础的类因为不包含任何运行环境所以基础的 object 这些都需要重新定义这里的代码放在 github 我也在本文最后贴出代码现在输出控制台的代码不是原先的 Console.WriteLine 而是通过底层方法unsafe class Program {[DllImport(api-ms-win-core-processenvironment-l1-1-0)]static extern IntPtr GetStdHandle(int nStdHandle);[DllImport(api-ms-win-core-console-l1-1-0)]static extern IntPtr WriteConsoleW(IntPtr hConsole, void* lpBuffer, int charsToWrite, out int charsWritten, void* reserved);static int Main(){string hello Hello world!;fixed (char* c hello){int charsWritten;WriteConsoleW(GetStdHandle(-11), c, hello.Length, out charsWritten, null);}return 42;} } 最难的是如何编译这个文件编译需要先使用 csc 编译为 IL 代码然后通过 ilcompiler 编译为obj文件然后通过 link 编译为运行文件从开始菜单找到 x64 Native Tools Command Prompt for VS 2019 然后进入上面代码所在文件夹执行下面代码编译csc /debug:embedded /noconfig /nostdlib /runtimemetadataversion:v4.0.30319 zerosharp.cs /out:zerosharp.ilexe /langversion:latest /unsafe 编译完成可以看到 zerosharp.ilexe 文件然后通过 ilcompiler 将这个文件编译为 zerosharp.map 和 zerosharp.obj 文件在自己的 NuGet 缓存文件里面找到 runtime.win-x64.microsoft.dotnet.ilcompiler 库可以在资源管理器地址输入下面代码找到缓存文件%appdata%..\..\..\.nuget\packages\runtime.win-x64.microsoft.dotnet.ilcompiler 找到里面的最新版本在文件夹里面的 tools 文件夹可以找到 ilc.exe 文件如在我电脑的的文件是c:\Users\lindexi\.nuget\packages\runtime.win-x64.microsoft.dotnet.ilcompiler\1.0.0-alpha-27606-05\tools\ilc.exe 记下这个路径接下来将使用这个工具编译c:\Users\lindexi\.nuget\packages\runtime.win-x64.microsoft.dotnet.ilcompiler\1.0.0-alpha-27606-05\tools\ilc.exe zerosharp.ilexe -o zerosharp.obj --systemmodule zerosharp --map zerosharp.map -O 然后用 link 连接link /subsystem:console zerosharp.obj /entry:__managed__Main kernel32.lib /merge:.modules.pdata /incremental:no 执行上面代码就可以编译 zerosharp.exe 文件这个文件只有5KB可以将这个程序放在其他设备运行下面是所有代码using System; using System.Runtime.InteropServices;#region A couple very basic things namespace System {public class Object { IntPtr m_pEEType; }public struct Void { }public struct Boolean { }public struct Char { }public struct SByte { }public struct Byte { }public struct Int16 { }public struct UInt16 { }public struct Int32 { }public struct UInt32 { }public struct Int64 { }public struct UInt64 { }public struct IntPtr { }public struct UIntPtr { }public struct Single { }public struct Double { }public abstract class ValueType { }public abstract class Enum : ValueType { }public struct NullableT where T : struct { }public sealed class String { public readonly int Length; }public abstract class Array { }public abstract class Delegate { }public abstract class MulticastDelegate : Delegate { }public struct RuntimeTypeHandle { }public struct RuntimeMethodHandle { }public struct RuntimeFieldHandle { }public class Attribute { }namespace Runtime.CompilerServices{public class RuntimeHelpers{public static unsafe int OffsetToStringData sizeof(IntPtr) sizeof(int);}} } namespace System.Runtime.InteropServices {public sealed class DllImportAttribute : Attribute{public DllImportAttribute(string dllName) { }} } #endregion#region Things needed by ILC namespace System {namespace Runtime{internal sealed class RuntimeExportAttribute : Attribute{public RuntimeExportAttribute(string entry) { }}}class ArrayT : Array { } }namespace Internal.Runtime.CompilerHelpers {using System.Runtime;class StartupCodeHelpers{[RuntimeExport(RhpReversePInvoke2)]static void RhpReversePInvoke2() { }[RuntimeExport(RhpReversePInvokeReturn2)]static void RhpReversePInvokeReturn2() { }[System.Runtime.RuntimeExport(__fail_fast)]static void FailFast() { while (true) ; }[System.Runtime.RuntimeExport(RhpPInvoke)]static void RphPinvoke() { }[System.Runtime.RuntimeExport(RhpPInvokeReturn)]static void RphPinvokeReturn() { }} } #endregionunsafe class Program {[DllImport(api-ms-win-core-processenvironment-l1-1-0)]static extern IntPtr GetStdHandle(int nStdHandle);[DllImport(api-ms-win-core-console-l1-1-0)]static extern IntPtr WriteConsoleW(IntPtr hConsole, void* lpBuffer, int charsToWrite, out int charsWritten, void* reserved);static int Main(){string hello Hello world!;fixed (char* c hello){int charsWritten;WriteConsoleW(GetStdHandle(-11), c, hello.Length, out charsWritten, null);}return 42;} } 本文会经常更新请阅读原文 https://blog.lindexi.com/post/C-%E6%9E%81%E9%99%90%E5%8E%8B%E7%BC%A9-dotnet-core-%E6%8E%A7%E5%88%B6%E5%8F%B0%E5%8F%91%E5%B8%83%E6%96%87%E4%BB%B6.html 以避免陈旧错误知识的误导同时有更好的阅读体验。
http://www.pierceye.com/news/982814/

相关文章:

  • 柳州网站建设工作室基金会网站开发方案
  • 龙海网站建设微网站如何建设
  • 手机视频网站怎么做贵阳专业做网站
  • 网站建设题库vps上的网站运行太慢
  • 化妆品网站优化沧州网站制作公司
  • 专业优定软件网站建设上海seo服务
  • 网站充值怎么做的c2c平台的产品类型
  • 阿里去要企业网站建设方案书手机设计房子的软件3d下载
  • 凡科网站登录入轻博客网站开发
  • wordpress微信机器人订阅号性价比高seo网站优化
  • 网站建设全网推广亚马逊seo搜索什么意思
  • 做网站_你的出路在哪里android app for wordpress
  • 代刷网网站建设成都建立网站
  • 建设网站的费用预算商城网站制作
  • 北京网络法庭2018年企业网站优化如何做
  • asp.net做网站的步骤网站维护的作用
  • 网站制作前期所需要准备wordpress邮箱配置文件
  • 网站建设网站排名怎么做赣州专业做网站
  • 吉林电商网站建设价格做网站需要每年都缴费吗
  • 怎样用dede搭建网站域名网址
  • 做网站编辑有前途怎么样才算是一个网站页面
  • 建设鲜花网站前的市场分析网店设计理念
  • 网站建设优化服务公司wordpress非代码方式添加备案号
  • asp网站安装到空间教育网站平面设计
  • 快速设计一个网站网站h标签
  • 怎么做百度联盟网站前端面试题
  • 电子商务网站建设的基本要求wordpress提问
  • 论坛网站制作费用wordpress如何调用html代码
  • 打码兔怎么和网站做接口重庆网站建设找承越
  • 做海报的网站什么编辑器微楼书网站建设