Skip to content

ASP.NET 5 (originally vNext) support #47

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Daniel15 opened this issue Nov 17, 2014 · 8 comments
Closed

ASP.NET 5 (originally vNext) support #47

Daniel15 opened this issue Nov 17, 2014 · 8 comments
Assignees
Milestone

Comments

@Daniel15
Copy link
Member

Moved to pull request #94

@lukemcgregor
Copy link

I'm really keen to see this. I had a quick crack at getting it going but I ended up going down the rabbit hole a bit.

It will require (as far as I can tell):

  • a new React.Web.Mvc6 project (using vNext .net)
  • Possibly need to re-compile of the React and React.Web in .net 4.5 or vnext (required to reference them in the Mvc6 project)

The second is a little tricky as it basically means dual compilation or upgrading everything (which doesn't make sense for MVC 3 especially)

I imagine if you do the above it will probably work.

@Daniel15
Copy link
Member Author

Daniel15 commented Feb 2, 2015

We'll need a new React.Web project but why would React itself need to be recompiled? Surely ASP.NET v5 can reference .NET Framework 4.0 assemblies?

@lukemcgregor
Copy link

I think you might be right, I had a go at making it work but couldn't work out how to tell it not to build the .net core version of the project, so there's a couple of errors still. I needed to create wraps to even get it to reference the other projects which is a bit weird also.

I did also need to change IHtmlString -> HtmlString also as the interface no longer exists in the new MVC.

Anyway when you do get to implementing this feel free to take a look at the fork.

@Daniel15
Copy link
Member Author

Daniel15 commented Feb 3, 2015

I ordered a new external hard drive to give me enough hard drive space for another Windows VM and to install the Visual Studio 2015 preview :P

I'm going to be on holiday from 6th to 16th February but I'll probably pick this up when I return.

I did also need to change IHtmlString -> HtmlString also as the interface no longer exists in the new MVC.

Yeah I think IHtmlString is part of System.Web which is no longer used with ASP.NET 5. This can probably be handled with conditional comments in the code.

@Daniel15 Daniel15 changed the title ASP.NET vNext support ASP.NET 5 (originally vNext) support Feb 21, 2015
@Daniel15
Copy link
Member Author

So far I've created a new React.AspNet5 ASP.NET 5 Class Library project but I can't figure out how to make it reference the core React project. Apparently referencing csproj projects from kproj projects should work in the latest version of Visual Studio so this should definitely work.

I'm trying to use IReactEnvironment but I keep getting "The type or namespace name 'IReactEnvironment' could not be found (are you missing a using directive or an assembly reference?)" no matter what I try. I tried kpm wrap src\React as suggested at http://stackoverflow.com/questions/27020036/how-to-reference-csproj-from-kproj but that didn't help :(

@Daniel15 Daniel15 self-assigned this Feb 21, 2015
@Daniel15
Copy link
Member Author

I got past that, the next hurdle is hooking ReactJS.NET's dependency injection container (using TinyIoC) into the ASP.NET dependency injection container. I've managed to get dependencies registering as scoped (per-instance) but they're not being disposed correctly. I'll investigate more tomorrow, and post what I've done in a separate branch if I get anything useful :)

@Daniel15
Copy link
Member Author

Initial set of changes in 5d48be6. With these changes I was able to run an ASP.NET MVC 6 site and use server-side rendering. I still need to add the pieces to the build script.

@Daniel15
Copy link
Member Author

Moving to pull request #94

@Daniel15 Daniel15 added this to the 1.4 milestone Mar 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants