How to create setup program to copy ClickOnce files because 'publish' is not allowed

A

anonieko

How to create a simple setup program for your administrator to run.

This post is better read in mono-space format.

Scenario: As usual you don't have the access right to do ClickOnce
'publish' option. It's just how big companies work so
you have to work with the deployment team.

Well, your ever witty manager tells you to write
an install file that will automatically unzip and copy
the deployment files. Let the administrator run it and
never you.

You know exactly that a virtual directory already
exists and the exact location of this in the server.
Say example "c:\inetpub\wwwroot\MyClient" It
was setup before by someone.

Let me think:

I can create an msi file but it is too much. Hmm...

I can not use Visual Studio 'Setup Project' to create
one msi because it is too much work. Besides it
is considering dependencies like .NET framework
automatically. The thing I don't need here.

So what do I do???


My Solution:

Use 7zip file to create a self extracting file.
It is open source and free It can be downloaded at 7zip.org

The instructions are less clear in 7zip.org but you can
follow it after a few trials. Don't worry, to speed
you up I will describe an example setup.

For example. Imagine you have a directory like these
note ('\' means a folder)


C:
|
+---\WorkArea
|
+---\ClickOnceFiles
| |
| +---\MyClickOnceApp_0_1_0_4
| | |
| | +--<other .deploy, .manifest files here>
| |
| +---MyClickOnceApp.application
| +---MyClickOnceApp_0_1_0_4.application
| +---publish.htm
| +---setup.exe
| +---run.bat
|
+---\Output
|
+---7za.exe
+---7zSD.sfx
+---config.txt
+---create.bat


First, you can publish locally to your computer to the
'ClickOnceFiles' Folder as above.


Secondly, note that 'run.bat' is copied inside the folder
together with the ClickOnce deployment files.
This is intentional because it will part of the zip
component.

All you have to do is the run CREATE.bat, and it will produce
MySetup.exe in the output directory.

Yes, give MySetup.exe to your system administrator.
(better give its md5 hash also for peace of mind).
And you will look 'cool' from now on.

-------------
Ok, now the descriptions and contents of these files.

The files 7za.exe, 7zSD.sfx can be downloaded from 7zip.org
Look for 7z Library, SFXs for installers


create.bat
----------

del TempFile.7z
7ZA a -r TempFile.7z C:\WorkArea\ClickOnceFiles\*.*
copy /b 7zSD.sfx + config.txt + TempFile.7z output\MySetup.exe
del TempFile.7z


config.txt
----------

;!@Install@!UTF-8!
Title=" Client ClickOnce Files Setup- (C)2006 "
BeginPrompt="Do you want to update Client Deployment Files?"
RunProgram="run.bat"
;!@InstallEnd@!



run.bat
-------

(I know, I know this is not optimized, you can probably use variables
to store the virtual directory path, etc...) but here it is.


@ECHO OFF
CLS


IF NOT EXIST c:\inetpub\wwwroot\MyClient GOTO ERROR_DIR

XCOPY *.* c:\inetpub\wwwroot\MyClient /s /Y 1> nul 2> nul
if ERRORLEVEL 1 GOTO :ERROR_COPYING
REM DEL c:\inetpub\wwwroot\MyClient\*.bat

@ECHO ******************************************
@ECHO * *
@ECHO * SUCCESS IN COPYING DEPLOYMENT FILES!! *
@ECHO * *
@ECHO * Thanks Mr. Admin! - ERV *
@ECHO * *
@ECHO ******************************************

GOTO END_BATCH

:ERROR_DIR
@ECHO ******************************************
@ECHO * *
@ECHO * ERROR! APP VIRTUAL DIR NOT FOUND *
@ECHO * *
@ECHO * For Client to deploy this virtual *
@ECHO * directory which point to folder *
@ECHO * *
@ECHO * c:\inetpub\wwwroot\MyClient must *
@ECHO * *
@ECHO * must exist! *
@ECHO * *
@ECHO * *
@ECHO ******************************************

GOTO END_BATCH

:ERROR_COPYING
@ECHO ******************************************
@ECHO * *
@ECHO * ERROR IN COPYING FILES. NOT DEPLOYED *
@ECHO * *
@ECHO ******************************************


:END_BATCH
PAUSE
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top