Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8941775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:22:38+00:00 2026-06-15T11:22:38+00:00

I have ASP.NET MVC 4 application that contains library of some simple jQuery widgets.

  • 0

I have ASP.NET MVC 4 application that contains library of some simple jQuery widgets. Now I want to allow other web applications to use that library. Instead of inserting every widget file by file on client page it would be good to load all of them as a bundle at one request. Does anybody know is it possible to do that bundle using Microsoft ASP.NET Web Optimization Framework? In other words I want to prepare some “jquery-library-1.0.0.js” file and allow other application load it.

All I can find is how to use it inside MVC application and nothing about how to prepare bundle with the static name.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T11:22:39+00:00Added an answer on June 15, 2026 at 11:22 am

    after some research I found the way how to do this – using IBundleTransform interface. It allows to get access to the bundle content and I just need to dump it to the disk in the place where I want and use it later for any other applications that want to use the library.

    public class ScriptsBundleTransform : IBundleTransform
    {
        public string ScriptsPath { get; set; }
        public string Version { get; set; }
        public string Minified { get; set; }
        public string Full { get; set; }
    
        public ScriptsBundleTransform()
        {
        }
    
        public ScriptsBundleTransform(string path, string version, string minified, string full)
        {
            ScriptsPath = path;
            Version = version;
            Minified = minified;
            Full = full;
        }
    
        public void Process(BundleContext context, BundleResponse response)
        {
            string scriptsRoot = context.HttpContext.Server.MapPath(Path.Combine(ScriptsPath, Version));
    
            if (!Directory.Exists(scriptsRoot))
                Directory.CreateDirectory(scriptsRoot);
    
            //  if minified file name specified...
            if (!string.IsNullOrEmpty(Minified))
            {
                using (TextWriter writer = File.CreateText(Path.Combine(scriptsRoot, Minified)))
                {
                    writer.Write(response.Content);
                }
            }
    
            //  if full file name specified...
            if (!string.IsNullOrEmpty(Full))
            {
                using (Stream writer = File.OpenWrite(Path.Combine(scriptsRoot, Full)))
                {
                    foreach (var file in response.Files)
                    {
                        file.VirtualFile.Open().CopyTo(writer);
                    }
                }
            }
        }
    }
    

    and after that I just need to add this transformer in the bundle config to the bundle that I want to dump to the disk:

                widgets.Transforms.Add(new ScriptsBundleTransform()
                {
                    Version = "1.0.0",
                    ScriptsPath = "~/Scripts",
                    Minified = "jquery.library.min.js",
                    Full = "jquery.library.js"
                });
    

    Even if any widget in the library will be changed, dump file will be regenerated automatically and I don’t have manually control this process.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an asp.net mvc 2.0 application that contains Areas/Modules like calendar, admin, etc...
I have an ASP.NET MVC application that has a jQuery Treeview and a jQuery
We have a ASP.NET MVC 3 application that uses unobtrusive jQuery validation. The page
I have an ASP.NET MVC 3 application that binds data to a Model. Simple
In my ASP.NET MVC application, I have a project that contains all the business
I have an ASP.NET MVC application that uses Fluent NHibernate and AutoMapper. I am
I have an Asp.Net MVC application that works in the vs.net development web server.
I have a ASP.NET MVC application that runs in both IIS 6 and 7.
We have an asp.net mvc application that we would like to integrate a FileSystemWatcher
I have an ASP.NET MVC application that has one part where I dont really

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.