// Builds the EmbedAsResource files. If any localized resources are found then builds the satellite assemblies // and sets @projectItems to a cloned collection minus such resource files. private BuildResult BuildResources(DotNetProjectConfiguration configuration, ref ProjectItemCollection projectItems, IProgressMonitor monitor) { string resgen = configuration.TargetRuntime.GetToolPath(configuration.TargetFramework, "resgen"); ExecutionEnvironment env = configuration.TargetRuntime.GetToolsExecutionEnvironment(configuration.TargetFramework); bool cloned = false; Dictionary <string, string> resourcesByCulture = new Dictionary <string, string> (); foreach (ProjectFile finfo in projectItems.GetAll <ProjectFile> ()) { if (finfo.Subtype == Subtype.Directory || finfo.BuildAction != BuildAction.EmbeddedResource) { continue; } string fname = finfo.Name; string resourceId; CompilerError ce = GetResourceId(configuration.IntermediateOutputDirectory.Combine(finfo.ResourceId), env, finfo, ref fname, resgen, out resourceId, monitor); if (ce != null) { CompilerResults cr = new CompilerResults(new TempFileCollection()); cr.Errors.Add(ce); return(new BuildResult(cr, String.Empty)); } string culture = DotNetProject.GetResourceCulture(finfo.Name); if (culture == null) { continue; } string cmd = String.Empty; if (resourcesByCulture.ContainsKey(culture)) { cmd = resourcesByCulture [culture]; } cmd = String.Format("{0} \"/embed:{1},{2}\"", cmd, fname, resourceId); resourcesByCulture [culture] = cmd; if (!cloned) { // Clone only if required ProjectItemCollection items = new ProjectItemCollection(); items.AddRange(projectItems); projectItems = items; cloned = true; } projectItems.Remove(finfo); } string al = configuration.TargetRuntime.GetToolPath(configuration.TargetFramework, "al"); CompilerError err = GenerateSatelliteAssemblies(resourcesByCulture, configuration.OutputDirectory, al, Path.GetFileName(configuration.OutputAssembly), monitor); if (err != null) { CompilerResults cr = new CompilerResults(new TempFileCollection()); cr.Errors.Add(err); return(new BuildResult(cr, String.Empty)); } return(null); }