visual studio 2022, run react project open new edge explorer

Sergio Cascales Puerto 11 Reputation points
2023-04-01T21:33:25.18+00:00

Hello

I have react project with net core api backend

When run project (F5) backend project open in actual chrome but react open new instance of Chrome

I want to use existing instance of chrome. Any ideas? Thanks

package.json:

{
  "name": "reactapp",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "bootstrap": "^5.1.3",
    "jquery": "^3.6.0",
    "@testing-library/jest-dom": "^5.16.5",
    "@testing-library/react": "^13.4.0",
    "@testing-library/user-event": "^13.5.0",
    "http-proxy-middleware": "^2.0.6",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-router-bootstrap": "^0.26.1",
    "react-router-dom": "^6.3.0",
    "react-scripts": "5.0.1",
    "reactstrap": "^9.1.1",
    "web-vitals": "^2.1.4"
  },
  "scripts": {
    "start": "set HTTPS=true&&react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject",
    "prestart": "node aspnetcore-https && node aspnetcore-react"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "devDependencies": {
    "eslint-config-react-app": "^7.0.1",
    "jest-editor-support": "^31.0.1"
  }
}

project:
<Project Sdk="Microsoft.VisualStudio.JavaScript.Sdk/0.5.74-alpha">
  <PropertyGroup>
    <StartupCommand>set BROWSER=none&amp;&amp;npm start</StartupCommand>
    <JavaScriptTestRoot>src\</JavaScriptTestRoot>
    <JavaScriptTestFramework>Jest</JavaScriptTestFramework>
    <!-- Command to run on project build -->
    <BuildCommand></BuildCommand>
    <!-- Command to create an optimized build of the project that's ready for publishing -->
    <ProductionBuildCommand>npm run build</ProductionBuildCommand>
    <!-- Folder where production build objects will be placed -->
    <BuildOutputFolder>$(MSBuildProjectDirectory)\build</BuildOutputFolder>
  </PropertyGroup>
</Project>
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,674 questions
{count} votes

2 answers

Sort by: Most helpful
  1. AgaveJoe 28,861 Reputation points
    2023-04-02T12:39:33.38+00:00

    When run project (F5) backend project open in actual chrome but react open new instance of Chrome

    Press Ctrl-F5 to start the application without debugging.

    0 comments No comments

  2. MD 0 Reputation points
    2023-06-15T14:58:56.95+00:00

    I had the same issue with new project from template "React And ASP.NET Core (Preview)" in VS2022 - 17.6.2. I have found that in project "reactapp", in folder ".vscode", there is also file "launch.json". You can edit this file OR set the "reactapp" as startup project then choose preferred configuration.
    User's image

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.