Trying to use nant to build and link resource files into final product

U

urban.john

Here are my steps:

create resource files from resx files:

<echo message="CREATING RESOURCE FILES FROM RESGEN EN" />
<resgen todir="product\resources_en" verbose="true">
<resources>
<include name="${AppName}\**.en.resx" />
<include name="${AppName}\Global.asax.resx" />
</resources>
</resgen>

use AL to build a DLL that holds the *.en.resource and *.es.resource

<echo message="ALINKING en/GTPCardWeb.resources.dll" />
<al output="product/en/GTPCardWeb.resources.dll" target="lib">
<sources>
<include name="product/resources_en/*.resources" />
</sources>
</al>

here is the csc compiler build

<csc target="library" output="product\${AppName}.dll"
debug="${debug}">
<sources>
<include name="${AppName}\**\*.cs" />
<include name="${AppName}\**\Global.aspx.cs" />
</sources>
<references>
<include name="product\GTPLIB.dll"/>
<include name="System.Data.OracleClient.dll"/>
<include name="product\Infragistics.WebUI.Misc.v5.2.dll"/>
<include name="product\Infragistics.WebUI.Shared.v5.2.dll"/>
<include
name="product\Infragistics.WebUI.UltraWebGrid.v5.2.dll"/>
<include
name="product\Infragistics.WebUI.UltraWebNavigator.v5.2.dll"/>
<include
name="product\Infragistics.WebUI.UltraWebTab.v5.2.dll"/>
<include
name="product\Infragistics.WebUI.WebDataInput.v5.2.dll"/>
<include
name="product\Infragistics.WebUI.WebDateChooser.v5.2.dll"/>
</references>
</resources -->
<resources dynamicprefix="true">
<include name="GTPCard/**/*.resx" />
</resources>
</csc>

These nant target creates nice resource files inside the
${AppName}.dll. However when I run the App, I get this:

Could not find any resources appropriate for the specified culture (or
the neutral culture) in the given assembly. Make sure
"MyApp.ASPXPage.resources" was correctly embedded or linked into
assembly "MyApp". baseName: MyApp.ASPXPage locationInfo: <null>
resource file name: MyApp.ASPXPage.resources assembly: MyApp,
Version=1.0.2300.17395, Culture=neutral, PublicKeyToken=null

The ONLY way I can get this to work is to take the
bin/en/MyApp.resource.dll and bin/es/MyApp.resource.dll generated from
the VS 2003 build and place them appropriately into my ant built
/MyApp/bin/en and /MyApp/bin/es directories and all of my problems go
away. My question.. Is there a way to generate these
bin/en/MyApp.resource.dll correctly such that IIS doesn't barf at
runtime? I attempted to build these with AL (see above) and I moved
them into the appropriate ant built directory.
 
U

urban.john

I figured it out. My nant build file is correct. My problem was in the
ResourceManager call of my aspx.cs file and the namespace for the
aspx.cs. I cleaned up the name space to reflect the directory the aspx
lives in, change the ResourceManager accordingly and it worked:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top