Skip to content
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

app.UseReact Could not load file or assembly 'react.js, Culture=neutral, PublicKeyToken=null'. #1305

Open
cmargroff opened this issue Jul 9, 2022 · 0 comments

Comments

@cmargroff
Copy link

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 SetUseReact and SetUseBabel is correct in ReactConfig.cs or Startup.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.12
  • JavaScriptEngineSwitcher: V8 v3.18.4
  • react and react-dom: react.js v0.14.7 from NuGet
  • webpack: N/A
  • node: 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()
        });
      });```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant