1

I am trying to deploy a WPF application, that comes along with a databasefile (.mdb), which contains each customers company connectionstrings etc.

We have multiple customers with this setup, and we want to only include the db file with connectionstring to each company, so that the code can't be decompiled (or db file opened) and connectionstrings to all companys be seen. One option, as I see it, is to compile a deployment for each customer, but since the number of customers is high, this has to be automated.

We plan on having the deployment hosted online, behind a login, that differentiates between users from each company.

But is it possible somehow to publish one, (or multiple) db files to the deployment location, and then when each user downloads the app, have it only include the relevant info, for the company that user works in?

Our goal is to achieve an easy way of continuous-deployment of this desktop app.

We are currently testing with ClickOnce installer.

Update: I don't like the idea of placing the program in "%LocalAppData%", so we won't be using the ClickOnce installer, but one that appropriately deals with Windows UAC.

2nd update: We're looking for the best solution to this. Not a quickfix, that will have to be replaced after a year, cause of x, y and z became an issue. Our deployment at the moment, includes building our applications, zipping them, putting them online for our the IT guy of each company to download and overwrite the files on their company network drive. Each tech guy have to kill all processes to all the .exe files he is owerwriting, cause they otherwise is locked. This is for 350+ companys, with thousands of employees. So there is alot to gain with an automated way of doing this, that doesnt require building our applications 350+ times per update and that prevents the IT guy of each company, from having to do anything.

Djensen
  • 1,337
  • 1
  • 22
  • 32

2 Answers2

2

I would suggest that you take a look at Squirrel.Windows. It's an installer that's meant to be as simple as ClickOnce to use (for developers and for users) but is much more flexible.

It allows to add custom events that is code (in your app) that is triggered on first install, on update, on uninstall or on first run. This should allow you to have the same installer, and same application for all of your customers and display a menu (or have another way to do it automatically) to setup the settings and everything specific to your customer.

It's relatively easy to include in a continuous deployment pipeline, I have written an article about it a few years ago. It might be a bit outdated on some parts but it should give you a good direction.

For the database itself since, if I understood correctly, you're going to install a db file directly on the machine, I would suggest you take a look at localdb and, if you're using Entity Framework, using Migrations to generate and fill the database from code.

Gimly
  • 5,975
  • 3
  • 40
  • 75
  • Thnx for the article. Its a very good read. It is also our plan to setup something similar from our TFS in the buildactions on VSOnline. The Squirrel.Windows looked promising, untill i realised it doesn't deal with UAC, and does the same thing as ClickOnce installer, with not being able to install in the "Program Files" folder. Our current working system works with each company having a accessdb file next to the exe files, so as a proof of concept, thats just the idea im working with now. There might be better way of storing info that is unique to each branch of users. – Djensen Nov 23 '17 at 12:13
  • 1
    If you want to be able to install the app in the program file folder then you'll probably have to use a real installer software. Wix is probably the most popular today http://wixtoolset.org. It's quite complex to use unfortunately. What's the reason why you need the app on program file and not app data? – Gimly Nov 23 '17 at 12:24
  • Complexity is okay, as long as it comes along with lots of customization options, and doesn't put up roadblocks. I've updated the question with more info on our current deployment process. We want the access to program files, because we want to install it for all the users on a pc. There will be many cases where there are more than one user of a given pc. Plus the possibility of creating services, seems like a reasonable tradeoff aswell, for not going with ClickOnce. – Djensen Nov 23 '17 at 14:14
0

But is it possible somehow to publish one, (or multiple) db files to the deployment location, and then when each user downloads the app, have it only include the relevant info, for the company that user works in?

Of course it is, provided that you implement this functionality in the back end code that is executed at the deployment location.

Your web app or whatever API you are using should authorize the end user and then respond with only the information that is relevant for this particular user. So, in short, you can store the executable itself and all customer specific files at the deployment location and return only the executable and a single customer specific file - for example as a single .zip file - to the user depending on the user's identity and permissions.

The authorization itself, and the functionality of mapping a customer against a file, is not really part of the desktop application's functionality though. It is the responsibility of the back end that distributes and packages the application.

mm8
  • 163,881
  • 10
  • 57
  • 88
  • I would prefer to keep the steps for the end user af simple as possible. Like download the software, and then run the exe file after it is done downloading, and then following a simple installation guide, that resembles something that they have seen before. Some of the users are expert pc users, but some are really old school, and barely know how to find the "on" switch on the pc. The files being in a zip file, would add another step of unzipping them. Would the installer be able to copy the files from the zip file to a more permanent location, like the programs folder? – Djensen Nov 24 '17 at 10:00
  • 1
    Yes, provided that you implement a custom installer. – mm8 Nov 27 '17 at 09:01