Click once deployment - will a lower version get downloaded? - winforms

I am using VS2010 and deploying a small winforms type application - using click once deployment strategy.
If the server has a lower version installed in it(when comparing with the version in the users Cache)., will it still get downloaded to users machine while clicking on the "Run" button of the webpage generated by Click once deployment.
I have set "Application available online only".

Understand that the assembly version and the Click once publish version are different
Assembly Version is stored in AssemblyVersion.cs or AssemblyVersion.vb
Publish Version is stored in the project properties

Related

Unable to take control over MSIX updates for .net 6 WinForms application

I am trying to build MSIX setup for my WinForms application built on .net6. I want to give auto-update feature when the user clicks the "Update" button. I think originally developer didn't have control over updating MSIX and there was only way it was updated automatically when the application is restarted.
But there is a recent article on taking full control over MSIX updates I tried to follow it but I am facing the exception 'System.InvalidOperationException' while running the below line of code.
Package package = Package.Current;
I am using visual studio 2022 & WinForms application running on .net 6. I have kept other configurations as described in the above article but it is not working as expected. (I have tried in .net core 3.1 and it is working with it)
Package.Current only works in a packaged context, so you need to make sure to actually debug/launch the packaging project. An InvalidOperationException indicates that you are running your project unpackaged.
Make sure to select "Set as Startup Project" on the packaging project, likely named "MyApp (Packaging)" in the Solution Explorer. Then you can launch/debug your project as you normally do.

Load PDF in a WPF application?

I've been searching around and I can't find any clean ways to render PDFs in a native WPF application. Most solutions are either paid or run with errors or cannot load PDFs for my particular use case in Civil Construction.
Does WPF have any built in PDF renderers?
There's a built in PDF API in the UWP Runtime under the following nuget package:
Microsoft.Windows.SDK.Contracts
If you check under Windows.Data.Pdf there's actually an example link to GITHub for a very barebones PDF Renderer--that just so happens to be robust enough to load up Civil Construction PDFs: https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/PdfDocument
Of course the example is running on UWP so you'll need to go into the Windows settings (which should be auto-prompted if you've never installed UWP developer packages) and enable developer mode. This will give VS access to run UWP applications on your computer. You can search "developer" in the Windows settings or they're located under:
Settings -> Update & Security -> For developers -> "Developer Mode"
For the build platform in the configuration manager change from ARM to x64 (or x86 if you're on a 32-bit machine) and the program should run (works in VS Community 2019).

How do I create an MSIX package for a .Net ore 3.1 WPF app?

I am attempting to create an MSIX package for a .NET Core 3.1 WPF app.
I get the following error: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference
Part of the error message includes: Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.
I have tried changing the targeted processor in both the Configuration Manager and the Publish - Create Package wizard but cannot seem to get past the error.
Cant find a similar error when searching and there is no error code.
This issue was more about the Configuration Manager than the MSIX package project. The necessary step is to open the Configuration Manager and change the Platform of your project's configuration to a discrete platform (ie, not Any CPU)
To accomplish this, click the Configuration dropdown of the project you would like to modify and select a configuration (such as Debug). Then, click the Platform dropdown (which says "Any CPU" by default) and select New. From the "New platform" dropdown of this dialog box select a platform such as x64. The "Copy settings from:" dropdown should remain "Any CPU". The "Create new solution platforms" checkbox should be unchecked.
Rebuild the solution.
Next, add an Windows Application Packaging project, add the application reference and rebuild again.
Finally, right click on the MSIX projects and select Publish then Create App Packages. Make selections appropriate for you package. At the last step in wizard, uncheck the "Neutral" architecture and check the architecture that you created and compiled in the steps outlined above.
Click Create.

Published application requires visual studio to run

I have developed a WPF application and I need to try it on other computers.
1- I change my project properties to build in release mode and rebuilt project. However, /bin/release folder is empty and it still generates /bin/debug folder.
2- I selected publish and install it on other computers. Funny thing is, the program is not running if that computer does not have Visual C# (.Net Framework, Sql server etc. does not cause a problem)
3- I added a installer and add project output(release) to this application. It says /bin/release/abc.exe couldn't be find.. Changed it to project output(debug) and it builds fine. However, this setup is not even working on my computer..
So my question is simple... How can I publish WPF application in release mode and how can I run them on other computers without installing Visual C#. Thank you in advance
Check properties of your project, and set output folder for Release configuration.
You need .NET 4 framework installed on PC, to run (simple) WPF application.
Should work, when you set your output folder, see 1.

Desktop shortcut shows some configuration wizard on double click

I made a setup project for my windows forms application and then installed it. It properly created a shortcut on desktop. Now when I double click it to open, it shows a progress bar like thing saying Configuring application. After that, my windows form appears and runs normally.
I have no clue why this is happening. My earlier version for the same application was running properly with o. Also if I install the previous version, it starts normally without any problems. Only the setup files that I am creating now are showing this problem.
Any one having any clue...
You created a ClickOnce installation. You probably wanted to create a standard Setup Project. IIRC, there was some issue with this type of project in Visual Studio 2010, as in the project type is being depreciated, but I can't seem to find anything about that now.
Other alternatives are using WiX or the limited edition of InstallShield.
Oddly enough, the ClickOnce installer is pretty good, assuming you have the infrastructure to support it (a spot on the web where you place updates) and don't mind the nonstandard behavior (that weird dialog on start). Frankly, installer technologies right now in the .NET world suck. They're all extremely complicated and fail to insulate the developer from the intricacies of how installers work with Windows.
To turn off ClickOnce, IIRC, do the following:
Uncheck "Sign the ClickOnce manifests" on the Signing tab
Uncheck "Enable ClickOnce security settings" from the security tab
remove any references to "System.Deployment" from your projects

Resources