Click here to Skip to main content
15,916,949 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I have a script which deploys click once to a file share via mage.exe.
\\Servername\Sharename

When i try to launch the exe from the share it says network path not found.
However i am able to browse to that path from my machine.
Here is my Powershell Script.

param (
[switch]$help,
[string]$env = {} # Name of the env

)


if ( $help ) {
"Usage: updatePublishPremiumNetClient.ps1 -env "
exit 0
}

if ( $env.Length -eq 0 ) {
"Please enter env name."
exit 1
}

if ( $env -eq "IT" ) {
$Drive="\\server\ClickOnce"
}




$NewString="PremiumNet Test"


$buildOutput = "G:\TFS\PremiumNet\Trunk\Build\PNClient"
write-output $buildOutput

$oldPath = get-content Env:\Path;
$newPath = $oldPath + ";C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin";

set-content Env:\Path $newPath;
$certificateFile = "PremiumNet.Desktop_1_TemporaryKey.pfx"
$magePath = "C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin"

$publishVersion=$version;
$publishLocation = $Drive;

#Create folder for the new version
New-Item -Path $publishVersion -ItemType Directory -Force

copy -recurse $buildOutput\* $publishVersion


& "C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\mage.exe" -New Application -ToFile $publishVersion\PremiumNet.Desktop.exe.manifest -Name "PremiumNet - $env" -Version $publishVersion -FromDirectory $publishVersion

& "C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\mage.exe" -Sign $publishVersion\PremiumNet.Desktop.exe.manifest -CertFile $certificateFile

& "C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\mage.exe" -Update PremiumNet.Desktop.application -Name "PremiumNet - $env" -Version $publishVersion -AppManifest $publishVersion\PremiumNet.Desktop.exe.manifest -providerUrl $publishLocation\PremiumNet.Desktop.application -install true

& "C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\mage.exe" -Sign PremiumNet.Desktop.application -CertFile $certificateFile
Posted

1 solution

you should use UNC file paths at all times. Make an output at critical points.

"Click once" and "worry every time"
 
Share this answer
 
Comments
Member 8268618 26-Sep-11 11:09am    
Is it a requirement for click once??
KarstenK 27-Sep-11 3:23am    
The answer is "No", BUT UNC pathes are better because they are user indepent. User may map drives in another way or have not mapped the pathes. So it stabilizes your code.

Try on a commandline:

1. run the script
2. make a call to to the setup

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900