zoukankan      html  css  js  c++  java
  • Assembly.GetManifestResourceStream为null

    想把某个项目的某个文件夹里面的ini文件生成的时候顺便生成为网站和服务文件夹项目

    string _path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "BorrowFormulaConfig.ini");

    if (!File.Exists(_path))
    {
    FileStream fs = null;
    Stream xmlStream = null;
    byte[] bytsXml;
    int lenByts;

    try
    {
    Assembly asmCurrent = Assembly.GetExecutingAssembly();

    xmlStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(typeof(InterestCalculation).Namespace + ".BorrowFormulaConfig.ini");
    bytsXml = new byte[xmlStream.Length];
    using (fs = File.Create(_path))
    {
    while ((lenByts = xmlStream.Read(bytsXml, 0, bytsXml.Length)) > 0)
    {
    //向文件中写信息
    fs.Write(bytsXml, 0, lenByts);
    fs.Flush();
    }
    }
    }
    finally
    {
    if (fs != null)
    fs.Close();

    if (xmlStream != null)
    xmlStream.Close();
    }
    }

    后面看到观海看云

    所以这个文件需要右键点击,在属性中选择生成操作为嵌入的资源即可。

  • 相关阅读:
    canvas之碎碎念
    canvas之动态时钟
    属性小问题
    readonly and disabled
    table
    地图热区
    子块元素在父块元素中居中
    Ajax与JS
    前端测试
    html5/css3
  • 原文地址:https://www.cnblogs.com/zhian/p/6495723.html
Copyright © 2011-2022 走看看