You really should set aside some time to learn the Visual Studio build basics. The best way to do this is to create demo code that illustrates what happens when a console application is built. Use minimal code.
Create a new test Console application and name it "ConsoleApp1". Add logic that reads and displays the connection string node from the app.config file.
class Program
{
static void Main(string[] args)
{
var connection = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;
Console.WriteLine(connection);
}
}
app.config example.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<add name="DefaultConnection" connectionString="Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=DemoDB;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False" providerName="System.Data.SqlClient"/>
</connectionStrings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup>
</configuration>
Do not rename the app.config or run aspnet_regiis.exe. Simply build the application.
Go to to the project's bin folder and open the Debug folder. You should see 3 files.
- ConsoleApp1.exe
- ConsoleApp1.exe.config
- ConsoleApp1.pdb
The ConsoleApp1.exe.config file is the result of building the app.config file. The ConsoleApp1.exe is the built C# code and the ConsoleApp1.pdb file is the debugger symbol file used by the Visual Studio debugger to display variable values among other things.