public static void RequireEmbeddedResource(this IResourceRegistry registry, string assemblyName, string resourceName)
        {
            var shortAssemblyName = assemblyName.ToShortAssemblyName();

            if (!AssmanConfiguration.Current.Assemblies.Contains(shortAssemblyName))
            {
                throw new InvalidOperationException(@"Cannot include embedded resource because the assembly has not been configured in the Assman.config.  If you would like to embed a resource from the assembly '"
                                                    + assemblyName + "' then please add it to the <assemblies> list.");
            }
            var embeddedResourceVirtualPath = EmbeddedResource.GetVirtualPath(shortAssemblyName, resourceName);

            registry.Require(embeddedResourceVirtualPath);
        }
Exemple #2
0
        private static IEnumerable <string> GetEmbeddedResourceUrls(IResourceRegistry registry, string assemblyName, string resourceName)
        {
            string shortAssemblyName = assemblyName.ToShortAssemblyName();
            string virtualPath       = EmbeddedResource.GetVirtualPath(shortAssemblyName, resourceName);
            IEnumerable <string> resolvedUrls;

            if (!registry.TryResolvePath(virtualPath, out resolvedUrls))
            {
                throw new InvalidOperationException(
                          @"Cannot include embedded resource because it has not been configured in the Assman.config to be consolidated anywhere.
					Please add an include rule that matches the path 'assembly://"                     +
                          assemblyName + "/" + resourceName + "'.");
            }
            if (!AssmanConfiguration.Current.Assemblies.Contains(shortAssemblyName))
            {
                throw new InvalidOperationException(@"Cannot include embedded resource because the assembly has not been configured in the Assman.config.  If you would like to embed a resource from the assembly '"
                                                    + assemblyName + "' then please add it to the <assemblies> list.");
            }

            return(resolvedUrls);
        }