app.UseReact Could not load file or assembly 'react.js, Culture=neutral, PublicKeyToken=null'.
Opened this issue · 0 comments
cmargroff commented
Thanks for filing a bug! To save time, if you're having trouble using the library, please check off the items you have tried. If you are just asking a question, skip right to the bottom.
Please verify these steps before filing an issue, and check them off as you go
- [ x ] The relevant native JavascriptEngineSwitcher library packages are installed (such as
JavaScriptEngineSwitcher.V8.Native.win-x64) - [ x ] The VC++ 2017 runtime is installed
- [ x ] The value of
SetUseReactandSetUseBabelis correct inReactConfig.csorStartup.cs - [ x ] I've looked at the sample projects in this repo to verify that my app is configured correctly
I'm using these library versions:
ReactJS.NET: React.AspNet v5.2.12JavaScriptEngineSwitcher: V8 v3.18.4reactandreact-dom: react.js v0.14.7 from NuGetwebpack: N/Anode: N/A
Runtime environment:
- OS: Windows
- .NET Framework or .NET Core Version: .net 6.0
Steps to reproduce
- Create new project ASP.NET Core Web App (Model-View-Controller)
- Followed Instructions from https://reactjs.net/getting-started/aspnetcore.html
- modified: Program.cs, Views/_ViewImports.cshtml, Views/Home/Index.cshtml
- added wwwroot/Components/Home/Login.jsx
- added
<script src="@Url.Content("~/Components/Home/Login.jsx")"></script>to Views/Home/Index.cshtml
Running the app results in a runtime error that react.js cannot be found at:
app.UseReact(config => {
config
.SetLoadReact(true)
.SetLoadBabel(true)
.AddScript("~/Components/Home/Login.jsx")
.SetJsonSerializerSettings(new JsonSerializerSettings
{
StringEscapeHandling = StringEscapeHandling.EscapeHtml,
ContractResolver = new CamelCasePropertyNamesContractResolver()
});
});```