i've noticed a bug that seems to have been introduced with this change.
now, if no prefix is specified for the resources, the resources have a "."
prefixing the name.  this breaks any resources that were never scoped with a
prefix previously, specifically ProjectHelp.xslt used in NAnt.Console.

i've attached a snippet of code that seems to fix the problem.  it now only
tries to prepend the prefix is the prefix is non-empty.

hope this helps,

--b


----- Original Message -----
From: "Ian MacLean" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, September 05, 2002 6:19 PM
Subject: [nant-dev] Compilers and resources


> I've checked in changes to compiler base so that it handles resources a
> bit more nicely. this means that the following build fragment :
>
>  <csc target="exe" output="${outputname}.exe" debug="${debug}">
>             <sources>
>                 <includes name="Form2.cs"/>
>                 <includes name="AssemblyInfo.cs"/>
>             </sources>
>             <resources prefix="testWinApp">
>                 <includes name="Form2.resx"/>
>                 <includes name="SomeFile.xml"/>
>             </resources>
>  </csc>
>
> will work as expected. So the resx file will be automatically compiled
> into a .resources file and that file will be embedded into the target
> executable. SomeFile.xml will just be embedded as a file resource.
>
> Ian
>
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by: OSDN - Tired of that same old
> cell phone?  Get a new here for FREE!
> https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
> _______________________________________________
> Nant-developers mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/nant-developers
>
// Resx args
foreach (string fileName in Resources.ResxFiles.FileNames ) {
    string prefix = GetFormNamespace(fileName); // try and get it from matching form
    if (prefix == "")
        prefix = Resources.Prefix;                        
    string actualFileName = Path.GetFileNameWithoutExtension(fileName);
    string tmpResourcePath = Path.ChangeExtension( fileName, "resources" );
    string manifestResourceName = Path.GetFileName(tmpResourcePath);
    if(prefix != "")
      manifestResourceName = manifestResourceName.Replace(actualFileName, prefix + "." 
+ actualFileName );
    string resourceoption = tmpResourcePath + "," + manifestResourceName;    
    WriteOption(writer, "resource", resourceoption);          
}

// other resources
foreach (string fileName in Resources.NonResxFiles.FileNames ) {                       
                                                                                 
    string actualFileName = Path.GetFileNameWithoutExtension(fileName);                
                                                                  
    string manifestResourceName = Path.GetFileName(fileName);
    if(Resources.Prefix != "")
      manifestResourceName = manifestResourceName.Replace(actualFileName, 
Resources.Prefix + "." + actualFileName );
    string resourceoption = fileName + "," + manifestResourceName;                     
                                                                                       
       
    WriteOption(writer, "resource", resourceoption);     
}

Reply via email to