Giter Club home page Giter Club logo

Comments (2)

xidedix avatar xidedix commented on July 23, 2024

hi @fhlee74

CoreUI is a standard CRA React app. Therefore basic setup of CoreUI for .NET Core 2.1 using .Net Core 2.1 React project template should be straightforward.

1. Prerequisites:

  • .NET Core 2.1.2 with SDK 2.1.302 installed - SDK Installer
  • Node.js, version 8.11 or later
  • code editor of your choice (if you prefer Visual Studio you need to use version 2017 15.7.x or newer)

2. Create a new app

  • in an empty directory create a new project from a command prompt dotnet new react
  • remove sample application directory rd ClientApp /S /Q
  • clone CoreUI repo: git clone https://github.com/coreui/coreui-free-react-admin-template CoreUI
  • edit react.csproj and modify <SpaRoot>ClientApp\</SpaRoot> to <SpaRoot>CoreUI\</SpaRoot>
  • edit startup.cs and modify:
    configuration.RootPath = "ClientApp/build"; to configuration.RootPath = "CoreUI/build";
    and spa.Options.SourcePath = "ClientApp"; to spa.Options.SourcePath = "CoreUI";

3. Build and run

  • from Visual Studio open the .csproj file, and run the app (the build process restores npm dependencies on the first run)
  • or from .NET Core CLI
    • Run dotnet build
    • Run dotnet run to start the app

See also: https://docs.microsoft.com/en-us/aspnet/core/client-side/spa/react?view=aspnetcore-2.1&tabs=netcore-cli

from coreui-net.

rachelfreeman avatar rachelfreeman commented on July 23, 2024

@xidedix with that type of setup for the startup.cs SourcePath and RootPath, I'm randomly getting the following error on my dev server: "Exception":"System.InvalidOperationException: The SPA default page middleware could not return the default page '/index.html' because it was not found, and no other middleware handled the request.\nYour application is running in Production mode, so make sure it has been published, or that you have built your SPA manually. Alternatively you may wish to switch to the Development environment.

Any ideas? Everything I am finding is saying it's because the RootPath and SourcePath can't find the page, but most of the time it works.

from coreui-net.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.