简体   繁体   中英

Adding nuget package to ASP.NET MVC 6 project

Although they have not ended support for nuget package manager in ASP.NET 5 but -at least with javascript libraries- nuget does not seem to work anymore.

I tried (and failed) to add React.ASPNET library using nuget (as I didn't find it on Bower).

There is a reference added under DNX 4.5.1 but no script file is added to wwroot/lib as it would when adding a JS library with Bower.

There's also no sign of it in the project.json dependencies.

It's an ASP.NET 5 project on Visual Studio 2015 Update 1.

React.ASPNET is a library which allows you do do something like that:

@Html.React("CommentsBox", new {
    initialComments = Model.Comments
})

It add some extension method to the ASP.NET MVC. You can also do something like that:

<!-- Initialise the component in JavaScript too -->
<script src="https://fb.me/react-0.14.0.min.js"></script>
<script src="https://fb.me/react-dom-0.14.0.min.js"></script>
@Scripts.Render("~/bundles/main")
@Html.ReactInitJavaScript()

If you want to learn more take a look here: http://reactjs.net/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM