Search code examples
asp.net-mvc-3visual-studio-2012nugetnuget-packagemetro-ui-css

VS2012 How to add external javascript to packages.config


I'm new to the concept of packages.config and NuGet so feel free to correct me if my understanding is off. I created a new web project in VS2012 and I saw that packages.config was there to manage the javascript files. I used the NuGet package manager to add the metro ui package and it added version 2.0

However, the latest version is 3.0 and that's the one I would like to use. I tried deleting 2.0, replacing it with 3.0 and updated the package.config file with the corresponding verision number. But every time I open the project, it tries to override the file with version 2.0

My question is what is the proper approach update a package in which, the NuGet package manager doesn't hold the latest version?


Solution

    1. Use NuGet package manager to delete the out-of-date package.
    2. Download the code for the newer version (which is not yet available for NuGet) from the project site.
    3. Manually install the code. For many JavaScript projects, this might just be a matter of putting files in the correct folder (e.g., JavaScript files into the Scripts folder and CSS files into the Content folder).
    4. Optional - Reach out to the owner(s) of the NuGet package and encourage them to create a new version. Or, if it's a GitHub project and you are really dedicated, do it yourself and submit a pull request.

    It's not a good idea to manually edit packages.config unless you really know what you're doing.

    Also, when messing with NuGet packages, it's always a good idea to commit your project to version control before and after you make any changes. This way, if you mess something up, you can easily bring your project back to a known working state and try again.