1

I wrote an One Click Install file for a console app. I am able to install the file , if the .exe file is present along with .application file.

I kept the files in the server and pointed the file to a html page with INSTALL button to it.

  <table>
  <tr>
    <td>
      <a href="setup.exe" id="InstallButton">Install</a>
    </td>
  </tr>
</table>

However, when i download the .exe file from server to local, .application file is not downloading. As the result, when i run the .exe file , file is not installing and throwing an error as follows ...

+ Downloading file:///C:/Users/MyAccName/Downloads/MyProject.application did not succeed.
        + Could not find file 'C:\Users\MyAccName\Downloads\MyProject.application'

How to download the .exe file and .application file by clicking the Install button?

Ashraf Sada
  • 4,527
  • 2
  • 44
  • 48
goofyui
  • 3,362
  • 20
  • 72
  • 128

2 Answers2

1

I've always had problems with ClickOnce, especially using the bootstrapper installer. You can link directly to the .application file from the HTML file and it will install, but in my experience that only works from Internet Explorer/Edge. I don't know whether it's possible to install handlers in the other browsers.

For other browsers, we needed up writing a separate installer (a really simple GUI application) that runs the .application file from the server (so mimics Internet Explorer).

Daniel Becroft
  • 716
  • 3
  • 19
  • Thank you @Daniel, Issue is.. .exe file is depending on .application file. Your posting made me to review the .exe file creation.. thanks for that – goofyui Jul 09 '19 at 22:26
1

You can use JavaScript for this function, assuming that the files you want to download are in the same root directory, or you can properly point to the files by changing the download link, like this:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>
  </head>
  <body>
    <table>
      <tr>
        <td>
          <button type="button" id="InstallButton">Install</button>
        </td>
      </tr>
    </table>

    <script>
      var installButton = document.getElementById("InstallButton");
      installButton.addEventListener("click", function(e) {
        e.preventDefault();
        let xFiles = ["setup.exe", "MyProject.Application"];
        downloadFiles(xFiles);
      });

      // Download file function
      let downloadFiles = function(files) {
        for (let i = 0; i < files.length; i++) {
          window.open(files[i], "", "width=200,height=100");
        }
      };
    </script>
  </body>
</html>

Make sure that the popup blocker is disabled when using window.open(), or replace window.open() with temporary iframes, like this answer

Ashraf Sada
  • 4,527
  • 2
  • 44
  • 48
  • Thank you @Ashraf , I just identified the issue is .. .exe file is depending on .application file. There is a mistake on creating the .exe file from my end. – goofyui Jul 09 '19 at 22:25