问题
How can I rename a setup file in ClickOnce, from setup.exe to myapp.exe?
回答1:
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.
回答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:
- publish to local directory (
\bin\release\app.publish
) - 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
回答3:
Can you rename the file after it's created?
回答4:
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.
回答5:
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.
回答6:
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;
}
?>
回答7:
Not sure about the setup.exe BUT in case anyone needs to alter the XXX.application file name, the instructions are as follows
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.
回答8:
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.
回答9:
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.
来源:https://stackoverflow.com/questions/3952916/how-to-rename-setup-file-in-clickonce