惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V2EX - 技术
V2EX - 技术
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
Threat Research - Cisco Blogs
T
The Exploit Database - CXSecurity.com
S
Schneier on Security
S
Securelist
P
Privacy & Cybersecurity Law Blog
Scott Helme
Scott Helme
T
Threatpost
C
Cybersecurity and Infrastructure Security Agency CISA
L
LINUX DO - 热门话题
Cyberwarzone
Cyberwarzone
Cisco Talos Blog
Cisco Talos Blog
量子位
博客园 - Franky
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Latest news
Latest news
T
Troy Hunt's Blog
N
News | PayPal Newsroom
Google Online Security Blog
Google Online Security Blog
Apple Machine Learning Research
Apple Machine Learning Research
N
Netflix TechBlog - Medium
小众软件
小众软件
P
Palo Alto Networks Blog
Spread Privacy
Spread Privacy
C
Cyber Attacks, Cyber Crime and Cyber Security
C
Check Point Blog
aimingoo的专栏
aimingoo的专栏
WordPress大学
WordPress大学
L
Lohrmann on Cybersecurity
L
LINUX DO - 最新话题
D
Darknet – Hacking Tools, Hacker News & Cyber Security
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
The Last Watchdog
The Last Watchdog
S
Security @ Cisco Blogs
P
Privacy International News Feed
Last Week in AI
Last Week in AI
Microsoft Security Blog
Microsoft Security Blog
T
Tailwind CSS Blog
博客园_首页
云风的 BLOG
云风的 BLOG
V
Vulnerabilities – Threatpost
D
DataBreaches.Net
Recent Announcements
Recent Announcements
酷 壳 – CoolShell
酷 壳 – CoolShell
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
罗磊的独立博客
Engineering at Meta
Engineering at Meta
Forbes - Security
Forbes - Security
T
Tenable Blog

博客园 - 良村

元数据驱动开发 - 面向对象编程思想的补充 用ANTLR实现表达式词法和语法分析器 我的开源项目分享-基于SharpBrowser二次开发的定制浏览器,过程中填坑无数 AI是什么 现阶段AI编程无法取代程序员 用zrender实现工作流图形化设计(附范例代码) 特殊字符
导致的Javascript脚本异常 不同寻常的浏览器请求无响应错误 进销存管理中对红冲处理的误区 进销存管理中负库存产生的原因以及对应措施 打造自己的Html文本编辑控件 探讨对Web控件的异常处理 看了一篇不错的文章 - 使用 UTF-8 对 XML 文档进行编码 Ajax学习笔记(2) - 一定要用XML吗? Ajax 学习笔记(1) ASP.NET控件编写日记-当心“用过的控件”! ASP.NET控件编写心得总结- 以后会写详细一点 CodeDom.CodeArrayCreateExpression不能生成多维数组的创建表达式 网址收藏 C#实现Singleton的两种方法的比较 发现Maxthon(myIE2)浏览器处理javascript脚本时的奇怪现象 - 良村 - 博客园 页面缓冲与Asp.Net的性能优化(设置Page.Buffer属性) 如何使用AdminScripts脚本创建虚拟目录 采用HttpModules来重写URLs(实践篇)
用NAnt编译带有资源文件(*.resx,*.bmp,*.gif等)的C#项目
良村 · 2004-12-09 · via 博客园 - 良村

情况一:如何编译支持多语言切换的项目

    <!--
    转换资源文件的格式(编译资源文件的必要步骤)
    -->
    <resgen input="ResourceText.resx" output="${nant.project.name}.ResourceText.resources" todir="${build.dir}\bin" />
    <resgen input="ResourceText.zh-CHS.resx" output="${nant.project.name}.ResourceText.zh-CHS.resources" todir="${build.dir}\bin\zh-CHS" />
    <resgen input="ResourceText.en-US.resx" output="${nant.project.name}.ResourceText.en-US.resources" todir="${build.dir}\bin\en-US" />
    <!--
    编译字符串资源文件(简体中文)
    -->
    <al output="${build.dir}\bin\zh-CHS\${nant.project.name}.resources.dll" target="lib" culture="zh-CHS">
      <sources basedir="${build.dir}\bin\zh-CHS">
        <includes name="${nant.project.name}.ResourceText.zh-CHS.resources" />
      </sources>
    </al>
    <!--
    编译字符串资源文件(美国英语)
    -->
    <al output="${build.dir}\bin\en-US\${nant.project.name}.resources.dll" target="lib" culture="en-US">
      <sources basedir="${build.dir}\bin\en-US">
        <includes name="${nant.project.name}.ResourceText.en-US.resources" />
      </sources>
    </al>

    <!--
    编译${nant.project.name}主项目
    -->
    <csc
    warnaserror="true"
    debug="${build.debug}"
    doc="${build.dir}\bin\${nant.project.name}.xml"
    output="${build.dir}\bin\${nant.project.name}.exe"
    target="winexe" win32icon="App.ico">
    <sources failonempty="true">
      <includes name="**\*.cs" />
      <includes name="..\CommonAssemblyInfo.cs" />
    </sources>
    <resources basedir="${build.dir}\bin">
      <includes name="${nant.project.name}.ResourceText.resources" />
    </resources>
    </csc>

情况二:如何编译带有图片资源的项目

当资源文件名的命名方式刚好与那些VS.NET自动生成的资源文件名相同时,你不需要使用(也不应该使用) <resgen>标签。

你应该使用<resources>标签,由编译任务在编译时执行对资源文件的编译。
下面是一个范例:

  <target name="build">
    <echo message="编译${nant.project.name}项目" />
    <csc
    warnaserror="true"
    debug="${build.debug}"
    doc="${build.dir}\bin\${nant.project.name}.xml"
    output="${build.dir}\bin\${nant.project.name}.dll"
    target="library">
    <sources failonempty="true">
      <includes name="**\*.cs" />
      <includes name="..\CommonAssemblyInfo.cs" />
    </sources>
    <resources basedir="." prefix="${nant.project.name}" dynamicprefix="true">
      <includes name="Arrows\*.gif" />
      <includes name="CheckBoxes\*.bmp" />
      <includes name="RadioButtons\*.gif" />
    </resources>
    </csc>
  </target>