How to run an Angular / C# site in Cursor w/ SPA Proxy & debugging

I used to have to run my Angular / C# site in two separate windows. I would write the code in Cursor, and run / debug the site using VSCode.

I’ve seen several locked threads with people telling you to do exactly this, or at the very least mentioning that there is no way to specify where the site runs because launchsettings.json doesn’t work in Cursor.

After a long time trying to figure it out I have a solution that works and makes running and debugging in Cursor alone possible and, for me at least, doesn’t require anything more than the C# extension made by Anysphere for debugging either.

The reason the site doesn’t launch is because VSCode uses a few settings in “launchSettings.json” which Cursor doesn’t seem to use at all.

For my project it was specifically this part:

"applicationUrl": "https://localhost:7262;http://localhost:5162",
      
"environmentVariables": {
    "ASPNETCORE_ENVIRONMENT": "Development",
    "ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.SpaProxy"
}

The “applicationUrl” is used to set an environment variable called “ASPNETCORE_URLS” and without this, and the SpaProxy line, the site will never launch.

The solution was to add the following to your configuration inside the “launch.json” file:

    "name": "Launch Site",
    "type": "coreclr",
    
    ...

    "env": {
        "ASPNETCORE_ENVIRONMENT": "Development",
        "ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.SpaProxy",
        "ASPNETCORE_URLS": "https://localhost:7262;http://localhost:5162"
    }

I’m also able to debug the site as well. Hopefully this helps someone out there. It was driving me crazy having to consistently keep two separate windows open.

Sorry if the phrasing or structure of this is a bit odd as I constantly have a “Your topic might be similar to this” box above the editor that will not go away.


edit: Interesting, it seems that once you put it in “launch.json” you don’t need those lines, at all, in “launchsettings.json”. At least for me, both VSCode and Cursor launch the site fine, but if it’s in the launch settings one it only works with VSCode.