0

When I publish my ASP.NET Core application, in the web.config, I have these entries:

<environmentVariables>
    <environmentVariable name="ASPNETCORE_ENVIRONMENT" 
                         value="Development" />
</environmentVariables>

I deleted all the environment variables config from my launchSettings.json, but it didn't help. I can't understand where is this variable coming from?

My Properties/PublishProfiles/FolderProfile.xml:

<Project>
  <PropertyGroup>
    <DeleteExistingFiles>false</DeleteExistingFiles>
    <ExcludeApp_Data>false</ExcludeApp_Data>
    <LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
    <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
    <LastUsedPlatform>Any CPU</LastUsedPlatform>
    <PublishProvider>FileSystem</PublishProvider>
    <PublishUrl>E:\pub\demo1</PublishUrl>
    <WebPublishMethod>FileSystem</WebPublishMethod>
    <_TargetId>Folder</_TargetId>
  </PropertyGroup>
</Project>
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
buga
  • 852
  • 9
  • 21
  • You should specify the command you're running to publish – possum Apr 29 '23 at 17:30
  • @possum I use VS2022, from the menu Build -> Pusblish "WebUI", after FolderProfile and click "Publish" button – buga Apr 29 '23 at 17:35
  • Does this answer your question? https://stackoverflow.com/questions/41546943/how-to-set-aspnetcore-environment-to-be-considered-for-publishing-an-asp-net-cor – possum Apr 29 '23 at 17:40
  • @possum, no, I'm not using the command line to publish, and I don't have `EnvironmentName` property defined in my csproj or publishprofiles xml file (as you can see above) – buga Apr 29 '23 at 17:50
  • @possum solved, I found it in my solution's `web.config`, altough I never added it there myself. – buga Apr 29 '23 at 17:52

0 Answers0