From 81cc216af2c4d3e7aceb7ae138eea2681c61a35f Mon Sep 17 00:00:00 2001 From: MrDave1999 Date: Sat, 28 May 2022 08:57:58 -0500 Subject: [PATCH] Added a subsection on how to copy the .env file to the output directory --- README.md | 16 ++++++++++++++++ docs/articles/getting_started.md | 16 +++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f072a3a..e10cfb5 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@ The advantage of using this library is that you do not need to set the environme * [Load .env file based on environment](#load-env-file-based-on-environment) * [Parsing .env files](#parsing-env-files) * [Using DotEnv in ASP.NET Core](#using-dotenv-in-aspnet-core) +- [Copying .env file to the output directory](#copying-env-file-to-the-output-directory) - [File Format](#file-format) * [Comments](#comments) * [Interpolating variables](#interpolating-variables) @@ -83,6 +84,9 @@ dotnet add package DotEnv.Core ``` ## Overview + +The first thing you need to do is create a `.env` file in the root directory of your project. + ### Load .env file You must import the namespace types at the beginning of your class file: @@ -228,6 +232,18 @@ builder.Configuration.AddEnvironmentVariables(); For more information, see the [articles](https://mrdave1999.github.io/dotenv.core/articles/getting_started.html). +## Copying .env file to the output directory + +If you want to copy the .env file to the output directory, you have to add the following to your .csproj file: +```xml + + + Always + + +``` +**NOTE:** Your .env file must be in the same directory as the .csproj file. + ## File Format - Empty lines or lines with white-spaces will be ignored. diff --git a/docs/articles/getting_started.md b/docs/articles/getting_started.md index 4b806a8..56755ad 100644 --- a/docs/articles/getting_started.md +++ b/docs/articles/getting_started.md @@ -17,6 +17,8 @@ dotnet add package DotEnv.Core ## Usage +The first thing you need to do is create a `.env` file in the root directory of your project. + ### Loading .env file You must import the namespace types at the beginning of your class file: @@ -195,4 +197,16 @@ else } ``` -**Note:** If you don't know what each class does, don't forget to check the [API documentation](xref:DotEnv.Core). \ No newline at end of file +**Note:** If you don't know what each class does, don't forget to check the [API documentation](xref:DotEnv.Core). + +## Copying .env file to the output directory + +If you want to copy the .env file to the output directory, you have to add the following to your .csproj file: +```xml + + + Always + + +``` +**NOTE:** Your .env file must be in the same directory as the .csproj file. \ No newline at end of file