Scenario One: How to compile an item that supports multiple language switching
The <!--transform the format of the resource file (the necessary steps to compile the resource file)--> <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/> <!--compiling a string resource file (Simplified Chinese)--> <al o utput= "${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> <!--compiling string resource file (US English)--> <al output= "${build.dir}\bin\en-us\${nant.project.name}.resources.dll" target= "Lib" culture= "en-US" > <sou RCEs basedir= "${build.dir}\bin\En-US "> <includes name=" ${nant.project.name}. Resourcetext.en-us.resources "/> </sources> </al> <!--compiling ${nant.project.name} main project-
-> <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 failonemp Ty= "true" > <includes name= "**\*.cs/> <includes name=". \commonassemblyinfo.cs "/> </sources> <resources basedir=" ${build.dir}\bin "> <includes nam E= "${nant.project.name}. Resourcetext.resources "/> </resources> </csc>
Scenario two: How to compile a project with a picture resource
You do not need to use (and should not use) <resgen> tags when the name of the resource filename is exactly the same as those vs.net automatically generated resource file names.
You should use the <resources> tag, compiled by the compile task to execute the compilation of the resource file at compile time.
Here is an example:
<target name= "Build" >
<echo message= "compiling ${nant.project.name} project/> <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>