13

How can I rename a setup file in ClickOnce, from setup.exe to myapp.exe?

Wayne Koorts
  • 10,861
  • 13
  • 46
  • 72
Mediator
  • 14,951
  • 35
  • 113
  • 191
  • This is a technology from Microsoft to install the program – Mediator Oct 17 '10 at 11:12
  • The *ClickOnce* is a simplified installer. Using Microsoft's rationale of "simplified", users can't change much. After all, it is designed so *you don't have to change many items*. For any thing more, use a real installer. – Thomas Matthews Feb 02 '11 at 21:06

8 Answers8

4

Just rename setup.exe to myAppSetup.exe and edit the publish.htm file to change the href from setup.exe to myAppsetup.exe. Users can download this by right clicking the install button and choosing Save As. I recommend myAppSetup.exe so as not to confuse it with the executable.

Oh yes, it is a bit tricky to automate this process because Visual Studio only has a post build event option to run an external tool, and no post publish. So remember to re-edit every time you publish a new version.

Gonzalo.-
  • 12,512
  • 5
  • 50
  • 82
2

I stumbled upon this post because I want to deploy two applications to the same location and was surprised I can't do this with visual studio. This is how I solved it.

It is worth to mention that I don't rely on visual studio to deploy my application but use two steps:

  1. publish to local directory (\bin\release\app.publish)
  2. deploy to webserver with pscp.exe -r -batch -C -q -pw <pass> * <user>@<host>:<path>

my publish command (step 1) looks like this

msbuild /target:Rebuild;Publish MyApp.csproj

Now I added a simple target in my csproj file

<Target Name="AfterPublish">
  <Move SourceFiles="$(OutputPath)app.publish\setup.exe" DestinationFiles="$(OutputPath)app.publish\viewer.exe" />
</Target>

and changed my publish command to

msbuild /target:Rebuild;Publish;AfterPublish MyApp.csproj
Jürgen Steinblock
  • 30,746
  • 24
  • 119
  • 189
1

Not sure about the setup.exe BUT in case anyone needs to alter the XXX.application file name, the instructions are as follows

  1. Go to the project properties and select the Application Tab; Alter the Assembly Name property to the value you want the .application filename to be.

    Application Properties

    click once .application name updated

Geovani Martinez
  • 2,053
  • 2
  • 27
  • 32
0

Turns out the properly named .exe is not found within the "publish" feature. If I go to c:\path\to\my\app\bin\Release\MyApp.exe I'll find the file I was looking for. This seems pretty silly to me that "publish" can't give me the proper exe I'm looking for, but this works.

Ben
  • 60,438
  • 111
  • 314
  • 488
0

That is not a solution as it should be, but if you are using ftp deployment, and you have http access to your ftp, you can implement downloading with content disposition through php (or other language, supported by your hosting):

<?php
$file = 'setup.exe';

if (file_exists($file)) {
    header('Content-Description: File Transfer');
    header('Content-Type: application/octet-stream');
    header('Content-Disposition: attachment; filename=MySuperApp-setup.exe');// name it as you want
    header('Content-Transfer-Encoding: binary');
    header('Expires: 0');
    header('Cache-Control: must-revalidate');
    header('Pragma: public');
    header('Content-Length: ' . filesize($file));
    ob_clean();
    flush();
    readfile($file);
    exit;
}
?>
Pavel K
  • 496
  • 3
  • 15
0

I think you cannot modify the setup.exe file name from setup.

If you have to distribute your installation file around manually, and setup.exe is too confusing, you could just create a Setup Project, rename the name of the .msi output file and then distribute it around.

il_guru
  • 8,383
  • 2
  • 42
  • 51
-1

Double click on My Project in the Solution Explorer. A DataEntryApplication form will appear. Under the application tab, Enter your desired Application name in the Assembly name field. Republish your solution.

-1

I was trying to fix the same problem for my software. I already have 'xxxx' in Assembly Name field, but when I publish it creates setup.exe. I just have renamed the setup.exe to xxxx.exe and install from the exe. It worked fine.