how to publish c# window application installer

2020-05-09 19:11发布

enter image description here

I'm trying to publish C# Windows application. I tried to install shield and visual studio installer but it does not work properly.

This setup can install only on those laptops or PC in which visual studio is installed. can anyone help me what are prerequisites are required and how can publish installer setup.exe

app.config connection string SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["connection_string"].ConnectionString);

but it occurs error failed to update database because the database is read-only visual studio

2条回答
乱世女痞
2楼-- · 2020-05-09 19:28

I have faced the same problem about how to get the setup file to work in any other device although it takes some time for me to understand the process but finally i have found that it's really simple.

1) you have to change the connection string to something like that :

string connectionStr = @"Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|DatabaseName.mdf;Integrated Security=True";

2) you can use Advanced Installer to generate the setup file, the process is simple, you can watch any short tutorial about how to get the setup file in Advanced Installer.

3) Finally, You have to install 3 programs as Prerequisites in client pc :

  • .Net Framework (I think started from version 4.5)
  • Sql Server Express
  • SSMS (Sql Server Management Studio)
查看更多
▲ chillily
3楼-- · 2020-05-09 19:34

You need to check the prerequisites. The .net version on which you have created the application will be required along with other prerequisites. It's not visual studio that is required to run the executable, but just the .net framework.

查看更多
登录 后发表回答