public static string GetReferenceVirtualPath(this IVirtualPathProvider virtualPathProvider, string basePath, string referenceName, string hintPath) { // Check if hint path is valid if (!string.IsNullOrEmpty(hintPath)) { if (virtualPathProvider.TryFileExists(virtualPathProvider.Combine(basePath, hintPath))) { return(hintPath); } } // Fall back to bin directory string relativePath = virtualPathProvider.Combine("bin", referenceName + ".dll"); if (virtualPathProvider.TryFileExists(virtualPathProvider.Combine(basePath, relativePath))) { return(relativePath); } return(null); }