How to set SpaProxyServerUrl based on environment in .net core 6

Discussão em 'Angular' iniciado por Raghavendra Devraj, Dezembro 6, 2024.

  1. In the SPA project Angular 13 with Asp.net Core 6. I want to set the SpaProxyServerUrl based on the environments like Dev, Stage and Prod. In the csproj file i have the code as below. Can we able to set the property "SpaProxyServerUrl" in program.cs file or is there any way to set the value dynamically based on the environment?

    <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
    <Nullable>enable</Nullable>
    <IsPackable>false</IsPackable>
    <SpaRoot>ClientApp\</SpaRoot>
    <SpaProxyServerUrl>http://localhost:4200</SpaProxyServerUrl>
    <SpaProxyLaunchCommand>npm start</SpaProxyLaunchCommand>
    <ImplicitUsings>enable</ImplicitUsings>
    </PropertyGroup>

    Continue reading...

Compartilhe esta Página