Modifying wyUpdate Source Code (self updates)

Hi,

I made my own version of wyupdate, so i want to let my own update in a specific folder custom-wyupdate.So in the File->properties of my Application wybuild project i've added http://mywebsite/custom-wyupdate/wyserver.wys. Then i've created a new wybuild project for my custom WyUpdate and put the new wyupdate.exe in files&folders, but when i try to upload the new version from my application it doesn't find anything.

Can you help me?

Have you read How to make a custom version of wyUpdate?

After you added the custom wyUpdate location in File -> Properties did you rebuild wyUpdate to generate the new client.wyc file? You must - because the self update location is stored in this file.

yes i read it !

i rebuilt my Application project and put the client.wyc file in my client folder where i launch my app but when i check for the updates it doesn't detect that i upgrade a new Wyupdate version and says "you already have the latest version".And if i build a new version of my application in wybuild it check the folder custom-wyupdate, download the file but don't install it, then check the updates of my application and just install the updates of my application..

Ok, Sebastien, let me explain. wyUpdate will update itself only when you have a new update for your main application. So if your app is unchanged wyUpdate doesn't bother updating itself.

Also, when updating your main app, wyUpdate will only update itself if the new wyUpdate version is greater than the old one. e.g. the old version is 2.6.7 and the new version is 2.6.7.1.

Tell me if this helps.

Okay so now it works, it installs the version 2.6.7. But now it re launchs the downloading and installing updates for ProductName, but instead of this, downloads wyupdate.all.to.2.6.7.wyu even if it has already downloaded and installed it and then immediatly shows an error : "The downloaded file "wyupdate.all.to.2.6.7.wyu" failed the signature validation: Verification failed."

You're getting this because you clicked "Build wyUpdate" for your custom self-update of wyUpdate. And you included this client.wyc file with your app, correct?

This is wrong.

You don't click "Build wyUpdate" for your custom wyUpdate project, because there is no need to. However, in your main app wyBuild project (in your case the "ProductName" wyBuild project) you must rebuild wyUpdate. You won't be including the rebuilt wyUpdate.exe with your app, obviously, however you will be including the new client.wyc with your app.

The reason is that the self-update site is embedded in the client.wyc file. By default (if you have no self update sites listed in file -> properties) the client.wyc file contains self update sites that point to wyday.com. When you change these sites to your own, then you must rebuild the client.wyc.

Does this make sense?

Yes i understood that i have to put in my client folder the "client.wyc" from my main project. i put the right one.the first time it download wyupdate.2.6.6.to.2.6.7.wyu, then it launch the wyupdate 2.6.7 and download wyupdate.all.to.2.6.7.wyu and here it failed.and when I run again my application it launch again the 2.6.6 version, so it didn't install the 2.6.7.

Can you just delete my last post and a part of yours or to change where there's the name of my product? I'm sorry for this.

Let me try to explain it in broad steps. The details of which you can read in the How to make a custom version of wyUpdate article:

  1. Get the wyUpdate source code.
  2. Open AssemblyInfo.cs and change the version to 2.6.7.0. Build it. This will be your old version that you're testing self-updating with.
  3. Copy this 2.6.7.0 version to another folder (e.g. C:\Your Custom wyUpdate\2.6.7.0\wyUpdate.exe)
  4. Modify AssemblyInfo.cs to the version 2.6.7.1. Build it. Copy it to C:\Your Custom wyUpdate\2.6.7.1\wyUpdate.exe
  5. Now make a new project in wyBuild. Your first version will be 2.6.7.0, and your second version will be 2.6.7.1.
  6. Drag the wyUpdate.exe files to the correct version in wyBuild.
  7. Build these updates and upload them to your site.
  8. Now close this wyBuild project and open your app's wyBuild project.
  9. Go to File->Properties->wyUpdate and add the self update *.wys location (e.g. http://example.com/self-updates/wyserver.wys )
  10. Click the "Build wyUpdate" button.
  11. Include the new client.wyc with your app, also copy your "2.6.7.0" version of wyUpdate to your app folder.
  12. Update.

Tell me if this helps.

I did everything you said but It doesn't still works. I checked in the code the urls that are run and here is what it does : _ downlad ftp://Mysite/myapplication/wyserver.wys _ download ftp://Mysite/custom-wyupdate/wyserver.wys _ download ftp://Mysite/custom-wyupdate/wyupdate.all.to.2.6.7.1.wyu and installs it _ restarts with the new wyupdate version (2.6.7.1) _ check again ftp://Mysite/custom-wyupdate/wyupdate.all.to.2.6.7.1.wyu _ failes and says The downloaded file "wyupdate.all.to.2.6.7.1.wyu" failed the signature validation: Verification failed."

An other question : I run an authentification form before that wyupdate checks for updates in the frmMain.cs of WyUpdate project and after around 30 seconds the authentification window crash. I guess it's due to wyupdate but i don't know why..

thank you

Sebastien,

From what you say, self-update is working fine. Then after the wyUpdate updates itself, it tries to download the update to your product, which in this case is downloading "ftp://Mysite/custom-wyupdate/wyupdate.all.to.2.6.7.1.wyu". This is the step that is broken. This can be caused by 1 (or both) of 2 things:

  1. You built the "client.wyc" file from the "wyUpdate self-update" wyBuild project instead of from your app's wyBuild self update project.
  2. You put the location of the self-update update sites in the download site list for you app's wyBuild project.
An other question : I run an authentification form before that wyupdate checks for updates in the frmMain.cs of WyUpdate project and after around 30 seconds the authentification window crash. I guess it's due to wyupdate but i don't know why..

Did you try debugging it?

I think the error might comes from the wyUpdate Source code coz everything is done correctly in wy build.

In my Application wybuild project : In file -> property -> wyupdate i put ftp://username:passwd@mysite/custom-wyupdate/wyserver.wysThe download site list is ftp://username:passwd@mysite/myapplication/%file%I built Wyupdates and updates, put client.wyc in my application folderIn the upload site : ftp://username:passwd@mysite/myapplication/I upload files

In my WyUpdate wybuild project : The download site list is ftp://username:passwd@mysite/custom-wyupdate/%file%I built updatesIn the upload site : ftp://username:passwd@mysite/custom-wyupdate/I upload files

The other point is that if i run wyupdate through my application, it downloads the new version of wyupdate, restart with it and finally failed while checking the ftp://Mysite/custom-wyupdate/wyupdate.all.to.2.6.7.1.wyu but the new version IS finally NOT installed.Now if i run the update directly from the wyupdate.exe, it does the same stuff ,the installation failed but the new version IS installed and then if i run my application, it installs the new version of my application successfully.

Did you try debugging it?

yes, but actually it only crash if i launch wyUpdate from my application. If i run directly wyupdate, it doesn't crash..

Can you send me the client.wyc file you're using along with the 2 wyBuild projects files? support@wyday.com

yes, but actually it only crash if i launch wyUpdate from my application. If i run directly wyupdate, it doesn't crash..

In Visual Studio click the Debug menu and click "Attach to Process...". This way you can watch where the crash happens.

did you received my message?

I tried to use Attach to Process but it says "impossible to display the machine code in execution mode".

Yes, I received the message. My guess is that you have the wyserver.wys files mixed up on the server.

Let's take this a step at a time. First let's get your main app updating properly. Then we can worry about self-updates.

Try this: go to File -> Properties -> wyUpdate in your app's wyBuild project file. Delete the reference to your self update site. Rebuild wyUpdate, include the new client.wyc and our wyUpdate.exe with your app. Does it work? If not, then you've got to rebuild your updates, reupload them and try again.

Tell me if this works.

I tried to use Attach to Process but it says "impossible to display the machine code in execution mode".

Use a debug build.

Can I ask what you're trying to add? From what you mentioned it sounds like you're trying to limit updates to only some users -- is that correct?

Yes this works fine!Then, i add an update for my application, it works.

Use a debug build.

Can I ask what you're trying to add? From what you mentioned it sounds like you're trying to limit updates to only some users -- is that correct?

Yes, i set up a user authentification before checking for updates, to know which user has update his application.

Yes, i set up a user authentification before checking for updates, to know which user has update his application.

We actually have an example that covers this. See SaaS and time-limited licensing.

You don't need to be using LimeLM, but you can still use %urlargs% to pass extra information to your server. And your server script can either reject the user or deliver the file.

Using this built-in functionality means you wouldn't have to tinker with the wyUpdate source code.

Frankly, I'm not sure why your custom version of wyUpdate is download the wyUpdate self-update files instead of your app's update files. Our mainline version of wyUpdate doesn't do this.

If you want to continue to modify wyUpdate (which I don't recommend because %urlargs% satisfies your requirements), then you should step through the source code and see why the self-update files are being downloaded instead of your main app's update files.

Could the error come form the fact that i don't touch to the registry changes neither in my app's wybuild project nor custom wyupdates project?

No, touching the registry doesn't effect anything one way or the other.

Here's what was happening: your custom self-update was successfully downloading & installing the self-update. Then your new version of wyUpdate tried to download your update.

Now here's where the problem happened. Instead of downloading your update it was downloading the self-update as if it were you update. This is why you got the signature validation error (the self update files aren't signed with the private key that matches the public key that's embedded in the client.wyc file. see Signing Updates in wyBuild).

This can be caused by a few things:

  • You modified wyUpdate's downloading functions.
  • Your FTP server is creating an alias to the self-update folder when it shouldn't be.
  • Your updates got overwritten by the self-update updates.
  • etc.