ClickOnce publish location change still looks for old location - c#

We have a prototype application that was originally published to an external server hosted on AWS (for discussions sake assume this was on http://prototypes.mysever.com/MyApp/).
The prototype size started to mount up so for speed we moved it to an internal server (assume http://internal/MyApp/).
I did some clearing out of our IIS server that was hosting the original published app (external) and removed the application. Now if we try to install a copy of the app, it fails, because it wants to talk to the original server even though we published it elsewhere (for like 80+ versions).
In the .application file I noticed a reference to the old server, but changing this didn't solve our problems.
Is there a way to stop it looking for the old server?

Sorry,
I deleted my last answer, because I misunderstood the question. Yes, there is a way to change the update location.
Open the Project properties page, and go to the Publish tab.
Click the Updates... button.
On the updates screen, verify that the update location is pointing to the new location.

Related

Automatically update local client website that running on IIS manager

I have a website that running locally on IIS Manager. Every time when I update website, I communicate client via Anydesk and update its file. Whenever the client got any update from server than it should be automatically updated.
I got it solution to push dll file on GitHub. When customer click on update button GitHub file download automatically in where website hosted folder. The problem is here when I replace updated file, it will give an error 'The process cannot access file, because it already used'.
If this solution is correct, kindly guide me how to overwrite file while application running on IIS manager without stop application
Otherwise give me suggestion to update file from online window server to local IIS manager without closing application.
Currently, in ASP.NET Core apps, it is impossible to replace binaries when the application is still running, but it will possible in .NET 6 by Shadow-copying in IIS.
You should consider the Blue Green deployemnt for your app https://docs.cloudfoundry.org/devguide/deploy-apps/blue-green.html
Options that I can suggest for your:
Move app to the cloud provider and use their features. For example Azure has Load Balancer/Traffic Manager/Slot deployment that can solve your issue
You can play with IIS Load Balancer: https://learn.microsoft.com/en-us/iis/web-hosting/scenario-build-a-web-farm-with-iis-servers/configuring-step-3-configure-iis-web-farm-load-balancing#:~:text=To%20configure%20load%20balancing%20with,Open%20IIS%20Manager.&text=Under%20the%20server%20node%2C%20expand,list%2C%20and%20then%20click%20Apply.

Is it possible to edit a project once is published on Azure?

I'm testing an application I just published using the free option that Azure gives us.
In this process I found out that I need to make a change to a Controller (ASP.NET Core 2.0) and I've been looking for the options to do so.
I've encountered with Azure App Service Editor and I'm reading some documentation about it. However, it does not seem the way to do this kind of change since I can't access the *.cs files thru this service. This is the list of files that are shown:
So, my question is:
Is there a way to edit these files (controllers, views) with Azure App Service Editor?
If no, what would be the way to reflect this changes on my already published application? Also, in the case the answer is "republish the project", is it possible to do so without alter the information contained in the database that has been added during this test process and only update the modified files?
I apoligize if these questions are very basic but I'm just getting started to know about Azure. Thanks in advance.
How I publish it:
In order to publish this project I used the option Visual Studio gives us:
Now, if I go to the same option, this windows shows up:
Question: If I hit the 'Publish' button I believe it will republish, the whole project, correct (the database included)? If this is the case, I believe there will be conflicts about the databases, since I have already information in the project published and other information in the local project. Is it possible to reflect the update for everything but the databases?
No, you can't update the files there as this is a compiled web app, so you have to publish the update.
I'm assuming you're using EntityFramework and originally publishing the database via the web publish.
If you click "settings" on the publish dialogue, on the second page (settings tab) you'll see the options for publishing the database.
Here you'll see options as to whether to update the database during deployment, this I believe is to apply migrations. But if you uncheck these it should not update your database at all.
You should verify this after saving the publish by looking at the generated publish profile (you don't have to do a publish to see this)
It will be located at "YourApp\Properties\PublishProfiles" and should have been added to your solution, and will be called something like "Your App - Web Deploy.pubxml"
Within this you will see a <PublishDatabaseSettings> section, where the Enabled properties should be set to False
However I would advice that before publishing any update:
Test the deployment to a new server
Back up the database before deploying and test you can restore from it.

Difference between C# dll built on local machine & TFS build server

Hello,
I am facing a problem with a WPF project that I am working on. The application works perfectly when I build it on my local machine, but when built on TFS server, it fails at runtime with an exception 'Cannot find HomePage/HomePageView.xaml'. Attached is a screenshot of the difference between the dll built on build server & the one built on local machine. Build server gets rid of the 'HomePage' folder path for some reason. Any help on why this might be happening would be appreciated.
Also attached is a screenshot of my project layout.
Based on the screenshot You provided, it seems that some files in this project are in fact added as links and the real files exist somewhere else (the little arrows on files icons indicate this).
Please make sure that TFS build server can actually access those files in their original location while building the project.
You mentioned that the build works on Your local machine, but it's not clear if You have only rebuilt the application or use Publish option. If not, please verify if publishing the project locally works correctly.
I also saw some article describing issue when using linked files and MSBuild, but it was rather related with web applications. You can find some information about it here.

Uninstalling ClickOnce application does not allow me to re-install from different location

I am new to ClickOnce applications. I published my application (locally, on my dev computer), installed the application using the setup.exe inside the published folder, and then ran the program. Everything was good.
I made some updates to the application, and wanted to install the new version on my computer to test it. So I uninstalled the previous version, using Add/Remove Programs. Now when I go to install the next version (from a different directory than the first install), I get the infamous "You cannot start application from this location because it is already installed from a different location." message.
I am looking into using the install-over-the-interwebs option, so that I can just update it online, for my client, but for now, I was just testing using the "From CD-ROM" install.
Basically, I'm hosed. My previous install is uninstalled, so I can't access that. And any new version cannot be installed because the installed is complaining that my previous one is still there.
My goal is to convince the computer that my previous version was indeed uninstalled. Apparently there is something lingering that is confusing it.
Thanks for your help.
So the solution for me was a 2-part fix.
First, I now update my app from a URL. You can use a local folder, or a website for this. The way I did it was publish my app into a folder of a website within the same solution. Then I publish the website to an azure site. Then to download the app I just go to that website/.
Second, I followed some advice found here: http://social.msdn.microsoft.com/Forums/windows/en-US/9e4b714e-bad4-4c62-a7ad-3c80e32d95eb/clickonce-fails-with-value-does-not-fall-within-the-expected-range?forum=winformssetup
The advice was to do this:
Mike, I am one of the previous posters here. I "solved" this (i.e. it rarely happens anymore) by turning off ClickOnce automatic version incrementing, and by making sure at every release I change the version in four places:
- assembly info for both assembly and file version
- ClickOnce version (making sure to keep the automatically increase version checkbox off)
- under Update, making sure I always set the minimum version to the same as elsewhere
I found that my version numbers didn't match in all these places -- specifically the assembly number and file version number weren't being updated inside the AssemblyInfo.cs. Once I had manually set those all to the same new number, published the app to my local folder (inside the website), published my website to azure, gone into my website via FTP and deleted old version folders in the "Application Files" folder, and downloaded the app from my website as described above, I could install and run the app without errors.
I don't know if this fix solves anyone else's problem(s) along the way, but there it is, for what it's worth.
This answer also is very helpful: http://social.msdn.microsoft.com/Forums/windows/en-US/365f8c65-b413-428e-af93-f150059a185f/cannot-runinstalluninstall-a-clickonce-application?forum=winformssetup
Thanks for reading.

ClickOnce does not copy data file on update

We are experiencing this strange issue with one of our ClickOnce-deployed applications:
On some client machines, ClickOnce when updating the application does not copy the old database in the .pre folder.
ClickOnce updates the application, but it behaves like it is a new installation.
Another strange thing is that despite it is specified a minimum required version to force any client to update the client PCs which have this issue display the ClickOnce upgrade prompt (it also displays the "Restore the application to its previous state" in the control panel "Program and features" item).
Indeed, other client PCs upgrade automatically without prompting and ClickOnce update behaves like it should.
This is a mature application and this is our 30th publication.
Another element is:
Usually we published this application alternatively with two PCs but after installing Visual Studio 2012 we cannot use them to publish ClickOnce and then we create a virtual machine only for publishing this application.
--------------UPDATE----------------
I accepted RobinDotNet's solution because it is DAMN RIGHT to not rely on ClickOnce moving your data reliably.
I also found that you cannot rely on ApplicationDeployment.IsFirstRun.
I changed my code to use my internal check for IsFirstRun and now every updates run smoothly.
As you have found, you can not rely on ClickOnce moving your data reliably. I strongly recommend that you put your data in LocalApplicationData, even if it involves moving a database. Here is a blog article explaining exactly how to do that.
I suspect your problem (and that of not being able to use two different VS2012 instances) is because of the certificate that you use to sign your application. Is it a certificate purchased from a CA, or is it a test certificate created with VS2012? If it's a test certificate, then you probably created a new one on each machine, and each time you publish it, ClickOnce thinks you are changing the certificate, which is part of the identity. When the identity changes, it doesn't carry data forward, and thinks it's a new application. With .NET 3.5, they at least made it stop forcing all of your customers to uninstall and reinstall when you changed the certificate.
Your solution to that is to create one certificate and use it on one machine, then copy it to the other machine. Double-click on it to add it to the certificate store on the second machine, and be sure it's part of the project so you pick up the same one. (In the Signing tab, be sure to select the file, don't select it from the Certificate Store on the machine).

Categories

Resources