React.NET icon indicating copy to clipboard operation
React.NET copied to clipboard

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

Open cmargroff opened this issue 2 years ago • 0 comments

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()
        });
      });```

cmargroff avatar Jul 09 '22 17:07 cmargroff