wapl tool and resource files

Topics: User Forum
Nov 5, 2006 at 2:20 AM
Hi Graham, me again :) I've started to try and localize the text for my framework assembly. I created a resource file called CommonResources.resx and another called CommonResources.es.resx. They exist under the Properties folder. The default resource file is included just fine. I see the 'es' directory (under bin) after my normal compile of the library, but the WAPL tool doesn't look like it includes it in the merge over to the wapl directory. I haven’t spent much time understanding the WAPL tool piece yet, is this a difficult change? Thanks for any information!

Coordinator
Nov 6, 2006 at 11:52 AM
Hi Fritz, I've not used resource files in any of my projects, so I'm not too up on them. I tried adding one to the test project for WAPL and it appeared to still be in the partial assembly and the final merged assembly (checked them using .Net Reflector).
Nov 6, 2006 at 3:25 PM
Hi, Graham. I do get the default language resource file just fine. It's the additional languages I'm not getting. So if I have CommonResources.resx, it shows up just fine in the partial assembly and is part of the merged assembly under wapl...everything's good there. If I have additional languages such as CommonResources.es.resx and CommonResources.fr.resx, they appear under separate folders under the bin directory after the normal class library build, but they are not moved over to the wapl directory as part of the merge tool build. I copied them over manually and renamed the files (since they were still named 'partial'), but I'm guessing the internal module name (or whatever it's called) might need to change as well. I will try to play with it to see if I can get it to work. Thanks!
Mar 30, 2007 at 7:36 AM
Hi Fritz,

Did you ever get this working? I am doing something similar and cannot get it to work. More specifically, I am marking files as embedded resources but they are not carried over to the final assembly... just in the partial assembly. If you have any pointers that would be cool.

Thanks,


Chris
Apr 20, 2007 at 1:35 PM
Hi.
I have library compile problem.
Whenever i add "App_LocalResources"(empty or with some file) dir to my WAPL project i get compile error from WAPL.EXE tool:

foreach (String userControlVirtualPath in userControlVirtualPaths)
clientBuildManager.CompileFile(userControlVirtualPath); <----- Object reference not set to an instance of an object

----------------
Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
at System.Web.Compilation.BuildManager.CompileCodeDirectory(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories)
at System.Web.Compilation.BuildManager.EnsureFirstTimeDirectoryInit(VirtualPath virtualDir)
at System.Web.Compilation.BuildManager.GetBuildResultFromCacheInternal(String cacheKey, Boolean keyFromVPP, VirtualPath virtualPath, Int64 hashCode)
at System.Web.Compilation.BuildManager.GetVPathBuildResultFromCacheInternal(VirtualPath virtualPath)
at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile)
at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile)
at System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean noAssert)
at System.Web.Compilation.BuildManager.GetCompiledType(VirtualPath virtualPath)
at System.Web.Compilation.BuildManager.GetCompiledType(VirtualPath virtualPath, ClientBuildManagerCallback callback)
at System.Web.Compilation.BuildManagerHost.GetCompiledTypeAndAssemblyName(VirtualPath virtualPath, ClientBuildManagerCallback callback)
at System.Web.Compilation.BuildManagerHost.GetCompiledTypeAndAssemblyName(VirtualPath virtualPath, ClientBuildManagerCallback callback)
at System.Web.Compilation.ClientBuildManager.CompileFile(String virtualPath)
at InSite.WebApplicationProjectUserControlLibraryTool.Program.Main(String[] args) in D:\Coding\My Projects\WAPL\WAPL Tool\Program.cs:line 125


Thnx.
F.
Dec 19, 2007 at 6:30 AM
I am having the exact same problem as Feryt, any news? Basically the tool crashes if you try to add any resources (global or local) to the web application library. This is a shame, because other than that it is exactly what we were looking for and it offers functionality that appears to be still sorely missing in Visual Studio 2008. However, to make full use of wapl we do need resources, as we are based in Europe and our applications must be multilingual.

I masked the problem by putting a try catch around the offending line in the foreground application:
{"foreach (String userControlVirtualPath in userControlVirtualPaths)
try
{
clientBuildManager.CompileFile(userControlVirtualPath);
}
catch { }"}

However, other than proving that this is the point where the error is raised, there is no benefit: now if I add resources to my WAPL assembly, the caller just gets missing objects. This shows that the background compilation still crashes and now produces an incomplete assembly.

To reproduce the problem
In the demo solution, rightclick "WAPL Test Library" project, select Add > Add ASP.NET Folder > App_LocalResources
This will make the WAPL tool always crash. Remove the folder and it starts working again. App_GlobalResources does not crash with empty folder, but will crash as well if you add some resources in it. Basically I do not see a method to compile resources into a WAPL assembly.