We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to Share Resources like DLL, Script, and CSS Among Multiple Websites or Web Applications

Platform: ASP.NET MVC |
Control: General |
Published Date: August 24, 2018 |
Last Revised Date: May 7, 2019

To share Syncfusion dependent resources like Script files, CSS files, and DLL files among multiple websites or web applications, host them in a common shared location. This hosting can be done locally in a server and shared across multiple projects.

 

Host the Scripts and CSS files 

 

To host the Script and CSS files, add a virtual directory in the existing website in IIS. It can be added to any existing website or create a new one. To create a new website, right-click the site in IIS and select Add Website.

IIS - Add website

 Then, provide configurations for Add Website dialog and select OK.

IIS - Website settings

Now, a new website has been created. Add the CSS and Scripts in the site to host them. The previously given steps can be skipped if the website is already available. In the physical location of the hosted site’s folder, add the scripts and CSS files.

IIS - Website created

After adding the files, right-click the website name in the Connections panel and select Refresh. This will update the changes in the site.

IIS - Refresh website

Now, the site is hosted. To access it, right-click the website and select Manage Website and then Browse.

IIS - Browse to website

From here, you can directly provide a path for the Script or CSS files to load them or  enable directory browsing in the features view of the website and browse the contents.

Host the Assembly files

Now, the script and theme files have been hosted. The dependent assemblies are hosted by creating a private NuGet server. This is done with the help of Nuget.Server package provided by .NET Foundation. This package creates an ASP.NET application that can host a package feed on any server that runs IIS. This is as simple as creating an Web application with Visual Studio.

VS - Asp Web project

Create a new Web application in Visual Studio. Make sure that the project’s Framework is in 4.6 or above, since Nuget.Server supports only above Framework 4.6.

VS - New Asp Web project

In this dialog, select the Empty template, then select OK. After creating the application, go to Tools > NuGet Package Manager > Manage NuGet Packages for Solution.

VS - NuGet packages 

Browse for Nuget.Server package and install it.

VS - Install Nuget packages

Now, the empty Web application is converted into a package source. It also installs a variety of other packages. Select “I Accept” to agree to the license terms and install the packages.

VS - Nuget packages

 

The Nuget.Server package installation creates a Packages folder in the application and modifies web.config to include additional settings for the private Nuget Server.

VS - Packages folder

Make sure that there are no duplicate configurations in the web.config file after the installation.

VS - Web config

The duplicate configuration added by the installation will lead to an internal server error when you host it. So, remove the element with older framework version.

VS - Nuget packages installed

Add .nupkg files to the Packages folder in Visual Studio.

VS - Add Nupkg

To make packages available when the application is published to a server, set each one's Build Action to Content and Copy to Output Directory to Copy always in the Properties window.

Now, press Ctrl + F5 to run the application without debugging.

VS - Run application

The OData feed of added packages is found in the previously given page. After the application is deployed, the “http://<domain>/nuget “ is added to the Package Sources and used as a private Nuget Server.

2X faster development

The ultimate ASP.NET MVC UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon