Deploying updates to a Windows Service application - c#

I've created a windows service application using Visual Studio .NET 2010 and C#. I've also added an installer application which works great. The application runs great but I have no clue how I am to deploy updates for this application. On a few of the desktop apps that I've created, I can specify that the application check for updates after the program launches. It would be great if I could do the same thing with a window service application. Is this possible? If not, what's the preferred way of deploying updates out to all of my clients?

What you're seeing is a result of the same problem encountered here. This question isn't necessarily a duplicate of that one, but the end-result is the same (See Marc Gravell's answer to that question).

Related

C# Winforms autoupdate check

I am trying to make autoupdate check and upgrade procedure (now from location on shared drive, in future maybe from server).
I have created "Visual Studio Installer" project that creates setup and it is possible to install the app. Also I have created another binary that searches for updates - if there are updates and user wants it, it runs the setup and app ends - if no updates, it runs main program. I have selected 2 binaries system in order to have possibility to run app without updates checking.
But If I confirm the update I am getting "Another version of this product is already installed. error code..." dialog.
I am not sure if my approach is right, probably not. But I found only commerce solutions and ClickOnce which seems to be for updating from network.
Thank you in advices for your answers.
It seems you are looking for something that allow you to have folder in your disk or a shared drive that can be used as local server to help you make updates without using internet connection , I introduce you to Squirrel.Windows its an open source installation and update framework for Windows desktop apps.
Here is link for Getting Started With Squirrel.
And here is a Youtube Video by Tim Corey where he explain Squirrel practically with demo windows forms project.
Happy Codding...

Standalone server bundled with blazor server application

I need to create an application that will operate on a windows 10 machine and needs to be reached from mobile clients and other desktop clients.
I figured i'd need an application that has a web interface and possibli be a pwa.
This could allow me to use it on mobile without coding an app for android and one for ios.
My question is, is it possible to ship the application with a standalone webserver so that the customer has to install nothig but my app?
I looked into Kestrel but i have no idea on how to setup the project as it visual studio 2022 (preview) keeps using IIS.
What could be my options?
I'll go ahead and consider this thread closed for I discovered i don't need to transition to C# and dotNet to create what I need as SpringBoot offers me just that.

Run a .net project on a system with IIS but no Visual Studio

I have a MVC 5 web application that is working fine. But due to internal security reasons and restrictions of my organization, I cannot host it as a website. My current requirement is to make this app run on a particular computer that has IIS installed on it but no Visual Studio.
My application makes use of MS-SQL database, Entity Framework, C# razors and all other .NET dependencies that are usual in a MVC app, and my target framework is 4.5.1 .
What I Found : I googled a lot, what I got is to create a Virtual Directory using the inetmgr and create the application under that directory. But since already the application is created I cannot go for this fix.
Please help me out by providing some links to refer to or steps to solve this.
Thanks in advance for any help.
What you will need to do is to either:
Use Visual Studio to publish the website directly onto the machine which is hosting the IIS application, as shown here.
Use Visual Studio an publish the application to a folder location on your machine and then use remote desktop or some other method to move the published DLL's to the virtual directory of the application.
Essentially both of them do the same thing, but sometimes due to security reasons, option 2 is easier to accomplish.

Adding windows service to a GUI-Windows application project

I have a GUI based windows application which is an .exe application(TestServer.exe )application. Now I need to add a windows service to this project solution.
So the solution would then build two executables. The first is the one it is currently building using the UserApplication; MyTestServer.exe
The second would be the new Windows Service; MyTestservice.exe.
Both would share the MyTestServerLibrary and our 3rd party dlls.
How can i do that in C# - Visual studio 2010?
As #nvoigt said, you simply add another project to your solution. If you'll right-click on your solution in the Solution Explorer window, select the Add|New Project... menu option. In the resulting dialog, select the Windows Service project type, give it a name, and press OK. Note that this step assumes you have one of the paid versions of Visual Studio 2010. My recollection is that the Windows Service project type is not delivered with the Express version.
From there, you simply build out your Windows service project just like you would any other project. If you've never done this before, I've got a set of instructions for how to do this here. The instructions target Visual Studio 2008 (I really need to update it...), but they are practically identical for Visual Studio 2010.
At this point, when you build your project, you'll get your TestServer.exe, any other C# assemblies that are part of your solution, and the newly-added Windows service executable. By default, running the Windows service directly from the Visual Studio debugger won't work for two reasons. First, your solution probably has TestServer.exe marked as the startup project, which simply means that when you press F5 to start debugging, the TestServer.exe will be run. But even if you change the startup project to be the new Windows service, it still won't work because services don't start the way normal Windows applications do. To get around this, you can look at the instructions here for how to have your Windows service operate in an "interactive" mode, which will let you debug it like any other application. For my purposes, though, I prefer to debug my Windows service when it's actually running as a Windows service. To do this, just put a call to System.Diagnostics.Debugger.Launch() in the constructor for your Windows service. Providing you are an administrator on your system, this will give you the opportunity to jump into a debug session when you start the service from the Services console.
This leads directly to the point of installing the service. To actually run a Windows service, it has to be installed on the system. For .NET-based Windows services, you can use the Microsoft-provided InstallUtil.exe to do this. If you open the Visual Studio command prompt from the Start menu, it's available in the directory path. I prefer the solution that Marc Gravell suggested to have the Windows service install/uninstall itself. I've got a set of instructions for how to do that here.
That should get you started. There are many good answers regarding Windows services on SO, so if you get stuck, be sure to search for it on this site. HTH.

Win Form exe closes immediately after launch, deploying a win form application using setup project

I have created a win form application in c# with sqlce. I followed the steps here http://erikej.blogspot.dk/2013/10/sql-server-compact-4-desktop-app-with.html making some tweaks along the way since I was using sqlce 3.5 .net and that blog was talking about 4.0 .net.
When I finished the application, I created a set up project and build it which gave me an msi and setup file.
Now when I run this set up on my own machine where I developed the applicaton, it works a charm.
I tried it on a friend's machine as well, it worked well, he had visual studio 2010 as well on his machine.
Now when I tried it on 2 other machines with VS, after installation, on launching the exe, it launches and immediately closes, I do not see anything although.
I know it launches as i look at processes from my task manager it shows it in there for like 3-4 seconds and its gone.
I tried using this Not able to run the .exe file created from c# where i wrapped the try and catch around all the code inside the root win form but no text file was created with any errors.
On doing some research, it says it could be because I am missing some dll's, how do i make sure all the dlls from the references would be copied into the project ? I set all dll's to true for copy local.
Is this something else and not related to dlls?
I really just want to be able to install the application on any machine without any problems.
Thank you for your time.
EDIT
I need to add that this was a project that involved using an XBox controller sending data to a wireless receiver that was hooked to a PC. I used the XNA framework to intercept these and display some form of output on the Win Forms.
When packing and installing/deploying an application that makes use of the XNA DLLs on another non developer machine, the XNA framework needs to be installed.
My solution was packing my application along with the xna installer and so the xna framework installs as a prerequisite and then my application installs and then it no longer crashes.
Thanks to mrlucmoring and Mark for their support and troubleshooting.

Categories