Windows Service Installer C# - c#

I am working on a task, where I need to create a installer (.msi/exe) which can install my application as an Windows Service. Also, I need to deploy this service from a non-alterable medium (i.e from CDROM). But I have my configuration files in the CDROM which I want to copy them to a local folder on hard drive before hosting the service. I understand there are different ways for creating a installer
1) Using Install shield wizard in Visual Studio
2) Advanced Installers
Which option do you think is optimal for my problem? Also, I am not sure if it is possible to copy configuration files to Hard Drive and leave the dll's on the disk while installation.
Please guide me through the right direction.

I am not totally clear what your real problem is, however, I try an answer:
But I have my configuration files in the CDROM which I want to copy them to a local folder on hard drive before hosting the service
If these files can be integrated in the VS solution, they can be tagged as "Content" (Build Action) and copied to the install location during setup. If you need to be more flexible, you can write a setup extension.
and leave the dll's on the disk while installation
I do not understand this. Which DLLs ?
If you are interested in some tips for creating a sample service with a complete setup, you can check my SO answer: https://stackoverflow.com/a/28853490/4547223
Or look at: http://www.rsprog.de/samplewindowsservice/
You may probably comment you experiences with that and tell us which files do you want to copy to which location and more about the background. I will try to refine my answer then.

Related

MSIX c# - Update and deploy on server/OneDrive

Goal:
I am trying to make a setup file for my app. Futhermore the app must be able to be updated from a server or OneDrive.
Solution:
I am using windows application packaging project for this.
The issue:
The installer works fine when the installer location is on my local harddrive. But when i try to change the installer location to my online file manager or a public OneDrive folder I am unable to download and install the update or App for that matter.
My question:
Has anyone been able to use windows application packaging project where the app downloads updates from a server / OneDrive by uploading the installation file to a server / OneDrive and entering the path to the location, or am I on the wrong track?
Alternatives
The alternativ is of course to use Setup Project and perhaps AutoUpdaterDotNET (from NuGet) which works fine, but now I am interested in a solution which does not require several different third-party programs, and windows application packaging project seems to be the solution.
Have you tried creating an .appinstaller file? This XML file (which you can write in any code editor - you don't need VS or Advanced Installer to generate it, although that way is easier) should allow the OS to cache all the necessary information to auto-update the app accordingly.

Where can I store my config file using windows forms?

I'm fairly new to windows forms and I was recently tasked with creating a simple software which will be deployed by USB drives to other companies. I made this software so during first run I check for a config.xml file. If it doesn't exist, I will send the user to a form to configure their first time setup. Next time I run the program, it skips this step since the config.xml file is found with its values. The problem is when I debugged this, I found the config.xml file alongside the executable, however when I ran this on a different computer, it stored it into the appdata virtual store. I read up on this and found out it has to do with write permissions.
Is there any way I can get around this without prompting the user to do anything extra on their part such as run as administrator? I also plan on saving the resulting reports generated by the use of this program and was hoping I can have XML files which can be easily found within the application folder.
*Note, I am aware of the built-in settings system but this also stores into appdata and if the executable is moved to another directly, it loses sight of that config and wants to create another.
EDIT : Please be aware I am trying to AVOID writing to the AppData folder. The software is packaged with Visual Studio Installer - Setup Project. A msi file is created which stores the application in C:\Program Files (x86)\\. Inside this directory I have the executable, the exe.config file which is generated, and any DLLs needed. This is the folder I am trying to also store the config.xml file but due to some windows magic, the code thinks its storing it here but in reality it is being stored in the virtualStore folder located in AppData.
Have you thought of using the C:\ most computers have this unlocked. alternitively use Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
the AppData folder is stored in the username space and requires no permission. (just remember to create a folder for your program to avoid conflicts)
It is a known issue due to security concerns that write permissions are limited.
More can be learned here.
Since no one was able to answer this, I will post my solution. Instead of packaging the solution using Visual Studio Installer tools. I install the application by copying the resulting executable from the build. This version of the application has write permissions that would have not existed if the application was installed using the resulting .msi from the Installer tools.

How do I publish a .NET application with OneClick publish through Visual Studio 2015?

I've been trying to research this the last couple of days and it doesn't seem like there is very good support for beginners. All video tutorials I find don't answer the questions I'm asking.
What I want:
I have an application I've written with .NET 4.6.1 in Visual Studio 2015 and I want to distribute an .exe that automatically checks if there are updates. It seems like this is exactly what OneClick is intended to do.
Where I'm at right now:
I want to publish to a shared drive among multiple people. It seems like I put that file path in the "Publishing Folder Location" which produces Setup.exe, MyApp.application, publish.htm, and Application Files. When you go to publish.htm there is an install button that downloads Setup.exe.
Where I'm stuck:
When you download the Setup.exe file onto your local machine and try running it gives an error. The details say it wasn't able to find the MyApp.application file. It seems that file is responsible for knowing what version of MyApp is currently installed on the users machine so that it can be compared to the download location (in my case the shared drive) to see if updates are available.
What am I missing? Do I misunderstand the purpose of OneClick publishing? Shouldn't users be able to visit the publish.htm once to get an .exe and that .exe is used to launch my application and look for updates first? I really appreciate any insight on this topic!
PS I've read over all the MSDN documentation, but it isn't user friendly to beginners in my opinion. Or maybe I'm just slow : )
You understand it exactly right, but when a user navigates to the html page, it downloads multiple files. The .exe, the .application and other supporting files.
You are correct in assuming ClickOnce is what you want. What I've found is the .net dependencies are very particular when using click once. You have to make sure each machine has the correct version of the framework and then they can use the htm site.
What I prefer doing is distributing the .application file to the users machine and just letting them run that. It will check for updates on the server every time it is ran and copy all the necessary decencies to the users Local directory.
You have to direct the users to the .application-File.
That one is responible for versioning (Updating) and executing your Application.
If you execute the .exe it will look for the .application-file to find the infos about the version, which should be installed/downloaded.
NOTE
Not all Browsers (in case of internet/intranet-deployment) support ClickOnce. But there are extensions for almost every browser

LAN Application with shared files

I've written a c# application which is intended to be ran on multiple computers within a network. The problem im trying to figure out is how I can share some common files between all the computers within the network.
I was handling this before by installing the software on one computer, storing a path string as an application scope setting during install, and then creating exe shortcuts on all other computers in the network which point back to the original installs exe.
Application deployment to network drive
I read this link and they talked about how it would be better to use clickonce rather than using a network share. The network share was the only way I could think of to have a common files directory. Are there any other ways to accomplish this?
Part of the installation process should ask the user for the path where the shared files will go. As long as each user enters the same path your good. That's the trick...
One way to solve that is to provide a silent installer mode that can be run with a preset of values the installer will need. You can then push the installer via group policy to all of the machines in your network.
I'm not sure what installer tech you are using, but WIX will create MSI's that support silent installation.

ClickOnce Deployment online questions

Bit of a strange question, but how do ClickOnce deployments work from a web site? I seem to be having some problems with this. Basically, the setup file will download when you click the "install" button, but then some files are missing.
Do you need to be on a Microsoft server to run ClickOnce deployments? I usually do deployments over a local server with UNC, and as this is the first time I've done one online I'm struggling a bit.
Any newbie tutorials you can point me to would be great, and if I do need a special host for it, could you please recommend some?
Thanks for all the answers everyone :)
Are you going to the setup.exe file or the .application file?
Deployment has to be pointed to the .application file. The ClickOnce file will then be launched directly there, no explicit "Save as" download. Once the manifest is loaded, the application will download what it needs and off it runs.
The first thing you need to do is determine if you want the user installing your app to run locally or launching it from the web only.
Second make sure you are using Internet Explorer to launch your application. The .application is registered in IE, but not other browsers.
I'd recommend server only. (At least to start) You don't have to worry about incremental updates. The user will get the correct version of your program every time.
There is nothing special going on with the server. It's all in the browser/.application.
It works from any file server, for example here is a ClickOnce deployment from an SVN server (i.e. I'm checking in the ClickOnce files after each publish): http://o2platform.googlecode.com/svn/O2_ClickOnce_Installers/O2_XRules_Database
Can you provide more details on what settings you have on the Publish tab of your project?
Regarding missing files, yes it can be a pain since ClickOnce doesn't auto add all dependent files from sub projects (I have found in the past that you need to include the extra (non dlls) files you need in the project you are deploying via ClickOnce)
No special hosting requirements are needed. You just need to make sure all the files required by the published clickonce app are deployed.
Take a look here :
http://msdn.microsoft.com/en-us/library/31kztyey%28VS.80%29.aspx
You can deploy to a webserver using either FTP or HTTP. You need to have the following MIME types set up in order to host the deployment:
.application --> application/x-ms-application
.manifest --> application/x-ms-manifest
.deploy --> application/octet stream
If you are deploying .Net 3.5 as a prerequisite, you need these as well:
.msp --> application/microsoftpatch
.msu --> application/microsoftupdate
If you have vsto apps, you need this one:
.vsto --> application/x-ms-vsto
Check out the Application Files dialog in the Publish tab to see what files are included. You can try running the exe file from your \bin\release folder, but if it's using something in the Global Assembly Cache (GAC), it will work and not tell you you're missing it.
Here are some other helpful links:
ClickOnce Overview
http://msdn2.microsoft.com/en-us/library/142dbbz4(VS.80).aspx
HowTo publish a clickonce app
http://msdn2.microsoft.com/en-us/library/31kztyey(VS.80).aspx
RobinDotNet
Visit my ClickOnce blog!

Categories

Resources