Suggestions for updating ClickOnce custom prereq - visual-studio-2010

I have a WinForms app I am deploying via ClickOnce. I added a custom prereq in the form of a .msi that installs X509 certificates. Question is, if I need to change certs due to expiration, how do I get ClickOnce to notice the difference in setup versions and run the .msi again? Is this even possible?

No, this isn't possible using ClickOnce. ClickOnce doesn't handle prereqs at all. It simply keeps client files in sync with files on a server.
It's confusing because when you deploy with Visual Studio it lumps prereqs in with ClickOnce so people think ClickOnce handles them. All Visual Studio does is build a small bootstrapper exe that ties all your prereqs together. That way, the user can run a single exe that handles downloading and running all the install packages in the correct order rather than telling your users, "Install the .NET Framework 4.0 (unless you already have it), then go here and download something else and run it, then this..."
If you want to handle this, you'll have to write code in your app's startup to do it. Check if they have the latest version, prompt them to install, send them to a webpage, etc. Not fun, but definitely possible.

Related

DotNet 5 ClickOnce missing Assemblies

I am trying to distribute a program in our small business environment. I tried to choose therefore ClickOnce in Visual Studio 2019 and DotNet 5. However, if I open the EXE from the published folder, it tells me that a DLL is missing. After adding this one, it tells me another DLL is missing, aso. In contrast, if I publish to a local folder, everything works as expected.
What may I do wrong? It seems like the missing DLLs have something to do with PowerShell automatization (Microsoft.Management.Infrastructure) which as I understood is only available as either x64 or x86. I tried to restrict my program to x64, however, without any success.
If you know any other simple distribution method for a small business (all pcs conneted locally) I am very happy and thankfully.
The solution was simple. Missing dependencies can be added here, during the setup for ClickOnce export creation.

Pushing updates to a application built in Visual Studio

I am considering building an application in Visual Studio 2010. This application will be distributed to dozens of users. As time passes, I will have to update the application. Is there a way that I can push updates to the users without having to rebuild the application, re-distribute the application to the users, have the users uninstall the original application, then install the new version?
I imagine the solution as the user being notified of a new version upon start-up, and the user clicking "OK" (or some equivalent) and then the program will download the new version.
Is there a way to do this in Visual Studio?
Thanks!
ClickOnce is an option, but not necessarily the most popular. You can also roll-your-own solution, which really isn't that hard:
Create a URL on a web server which returns the latest version (as a JSON object, XML string, plain text, whatever).
Have your program query this URL at startup.
If the latest version doesn't match the current version, prompt the user and download the latest version from the web server, saving it to a temporary directory.
Invoke the downloaded installer. (If it's an msi, there are command line options for "silent install" without a user interface; other installer have similar features.)
This approach has nothing to do with Visual Studio and could be used with any language / IDE.
I think you are looking for ClickOnce.
Apps automatically download the latest version of themselves.
ClickOnce takes the advantage of the Background Intelligent Transfer Service (BITS).
Trustworthy deployment model for users to be able to download and execute applications from centrally managed servers without requiring administrator privileges on the client machine.
Updates are transacted in a single transcation. (See this to understand “Single Transaction”)
The application not only can work offline but it has a degree of control over it; APIs exist, so that the application can find out if it’s online or offline; it can also control its own update process;
ClickOnce is integrated with Visual Studio .NET, including the ability to generate the appropriate extra files and tools that help to figure out which security privileges your application need in order to run.
Application files can be downloaded on demand or in batches.
ClickOnce comes with a Win32 “bootstraper” executable that can download necessary components, even the .NET Framework itself.

Why Visual Studio creates .exe installer files?

when I build solutions in Visual Studio, that generates installer files as .exe and .msi, .exe files are useful for what?
The .EXE file that is created by the installer project is a bootstrapper for the .MSI setup file. It is used to launch the .MSI setup file.
Generally, both will launch the setup program and allow the user to install the application. However, sometimes the setup.exe file will run a custom validation routine to determine if the user's computer meets the minimum requirements for installing the software.
For example, if the user does not have Windows Installer, they will not be able to launch the .MSI file, but the .EXE application will still run and inform them that they need to install Windows Installer first. For .NET applications specifically, the .EXE file verifies the presence of the appropriate version of the .NET Framework, and if it is not present, it prompts the user to download and install it.
You can customize the prerequisites that are required for your application in your installer project using Visual Studio. See these MSDN articles for details on how to do that:
http://msdn.microsoft.com/en-us/library/ms165429(v=VS.100).aspx
http://msdn.microsoft.com/en-us/library/7eh4aaa5(v=VS.100).aspx
Others have commented on the how (.exe bootstraps the .msi) but part of the reason why is that users know that .exe files are the things you run. I don't think your average user knows that .msi files are something that you can click on to install an application.
The .exe file is made for installing the prerequisites of your application.
Let's say your application uses the .Net 3.5 framework, you can tell the installer project to include the installation of the needed libraries if they're not already installed.
You may also deactivate it, so only the .msi is being created.
This page shows how to activate and configure the prerequisites setup, just uncheck the checkbox in order to deactivate it.
You also find more details on the process of Bootstrapping on MSDN:
the capability to automatically detect
the existence of components during
installation and install a
predetermined set of prerequisites
.exe files are useful for executing your programs that you've just built in Visual Studio, assuming you're not doing web applications.
Pretty much every Windows program out there is executed using files with an .exe suffix.
Installer exe files are normally just the msi wrapped in a bootstrapper. The bootstrapper can do anything, but normally its purpose is to ensure the user is running a sufficient version of Windows Installer, then extract the msi and invoke msiexec.exe to start installing the msi. Generating installers as exe's is deprecated these days, but some still do it.

Install wizard for my windows form application - or not?

I am wondering about the need for an install wizard for my little Windows Forms application. No database access, just file access on a shared network drive.
I have seen times when an executable is sent in an email, copied to a desktop and used.
Other times when an 'install wizard' seems to be used to set up the application.
What dictates the need for this or not?
And if I want to use one - what needs to be added to my windows form app?
If your application is truly just an .exe file, it's probably okay to distribute it as-is without an installer. This might be preferable for more advanced users, because they won't have to worry about cleaning up a broken/unwanted install - they can just delete the file and be done with it.
On the other hand, most Windows users are used to working with installers, and having shortcuts automatically created on the desktop or Start->Programs. This is where an .msi can really help. Also, using an installer will usually put your application in the "Add or Remove Programs" control panel, which most people know how to use. Also, if your application is more than just a single .exe file (e.g. multiple .dlls and resource files), you'll probably want to use an .msi.
Creating an installer is easy, look at "Setup Projects" in Visual Studio.
An installer is almost always a good idea, because it can work out what dependencies your application has - which you may not even be aware of.
It also looks more professional and users will have more confidence in it.
There's an open source installer called NSIS that's pretty good, if you find the Visual Studio setup wizard too clunky, as I sometimes have.
Sometimes simply copying a file just isn't sufficient, this is when you need a setup program.
Checking if the correct version of .NET is installed
Installing C++ runtime dependencies
Creating a desktop shortcut
Setting up "default" configuration data
Adding exceptions to the Windows Firewall
Preventing installation on unsupported systems such as Windows 95/98/ME
etc, etc.
If your program is a stand-alone application with no dependencies and can run on a stock-standard install of Windows 95... then you don't need to worry about setup ;) But if your app has any external dependencies then you want to spend some time on setup.

VS 2008 Express - clickOnce question

I have the VS Express 2008 where there is only ClickOnce deployment option. I need my app to be simple ran by clicking on the exe file without any installation.
I have found out that after deleting both manifests and icon /which is always in the output directory even though its embedd with "Do not copy" option/ it works well. Is it ok or is there any cleaner way how to do that? I mean, if the app is not being installed but only ran, do I still need external manifest files? I tried to embedd them but these still persist external (tried "Embed manifest with default setting" option or add my own and selected from list).
EDIT: In the Express, there is only ClickOnce.
Thanks
If you want to run it from the exe, ClickOnce isn't quite right. ClickOnce executes as a .application, and you should be able to just click the radio button (on the "Publish" tab) for "The application is available online only", which avoids any local ClickOnce install.
Otherwise, just build as Release and take the /bin/Release output; this is your standalone exe app. To get the right trust, a .NET exe can be executed from:
local drives
mapped network drives (f: etc) with the right .NET service pack
anywhere if "caspol" has been used to set a policy
I believe in Visual Studio Express, ClickOnce deployment is your only choice.

Resources