Reputation: 11
I've created an application which is connected to database and I want to have Installer which allows me to run my app on other PC. I've tried publishing, creating Setup File in Visual Studio and Advanced Installer, but none of this options works. When i run it on my computer it works perfect. I know that i have to change connection string when i connect to database on other PC. I have SQL Server and .NET Framework on other PC too so it's not the problem. I searched and tried many solutions on the internet, please help me !
Upvotes: 1
Views: 558
Reputation: 5738
You can always include any type of file inside a Setup Project
in Visual Studio. However, if you want to make a custom installer, you can easily do that.Here's some guidance that will help you greatly :
1.Create a zip
Search the term on google adding a c# tag at the end. You will find numerous answers even on SO on this. You can create a zip file and include every related file to your project in it. You can also simply add the database file in resource and access it.
2.Create the setup application
Create a WPF/WinForm project, design it the way you want. Now embed the earlier created zip file as a resource. Create a button to extract the zip file(do a quick google search of it too). You will now have a fully-customized installer
3.Take the installer to next step
What if there's already a version of your app installed on the client machine ? In your customized installer, make sure to create a registry key which will hold the path of where the installer will install the app(I mean where it will extract the .zip). Also add a check for the registry value. If there's a registry value, get the value which will be the path of the previously installed version, use the path to delete the folder/directory. Now do the rest of the work of step 2
The quickest way
Embed the database in your app as a resource.Now your setup project will automatically include it. However, the problem is that you cannot access the file directly from the resource as it has to be attached with a SQL Instance. However, you can use SqlLite for this.
Hope this helps :)
Upvotes: 1