I have an application developed with Windows Form C # + Entity Framework v6.1.3, where I use an existing database. The application works correctly, in Visual Studio 2013, where I'm developing.
My App.config
has ConnectionStrings
as follows:
<connectionStrings>
<add name="RHContext" providerName="System.Data.SqlClient"
connectionString="Server=SERVER;Database=BASE;
Trusted_Connection=false;Persist Security Info=True;User Id=USUARIO;
Password=SENHA;MultipleActiveResultSets=True"
</connectionStrings>
And like I said, it works normally.
The problem is that I need to take to the production environment, that is, publish.
Using the Publish
option of Visual Studio itself, it generates the executable along with other files, which are these:
AndwithintheApplicationFiles
folderIhavetheseothers:
Note that I have a .condif
file, however if I change the connectionStrings
directly in this file, I get this error when running .exe
The application can not be downloaded. Not all files required by the application are available.
When I return to connectionStrings
to original, it works normally.
This application will "run" on different machines, so I need a way for the technician to change the connectionStrings
, not needing the programmer.
And here's my question: How do I change the connectionStrings
of the application after publishing it?
I thought about creating a file txt
and reading the connectionStrings
of it, but I do not know if it is feasible, or if there is a better way to do it.