O
O
Ogoun Er2011-10-20 14:15:32
Microsoft
Ogoun Er, 2011-10-20 14:15:32

Need an example of running a ClickOnce application deployment from C# code

The task is to launch a ClickOnce application located on the network by URI.

I found the CorLaunchApplication function, from mscorwks.dll, I try to call it this way:


[DllImport("mscorwks.dll", CharSet = CharSet.Unicode, ExactSpelling = true, PreserveSig = false)]
internal static extern void CorLaunchApplication(uint hostType, string applicationFullName, 
int manifestPathsCount, string[] manifestPaths, 
int activationDataCount, string[] activationData, 
PROCESS_INFORMATION processInformation);

public void StartApplication(string uri)
{
CorLaunchApplication((uint)HOST_TYPE.HOST_TYPE_CORFLAG, uri, 0, null, 0, null, new PROCESS_INFORMATION());
}


Throws an exception: The value is not in the expected range.

Maybe someone has examples, or other launch options?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dzuba, 2011-10-20
@Dzuba

Wouldn't C#'s built-in capabilities be better?

AppDomain.CurrentDomain.ExecuteAssembly(...)

E
EvgK, 2011-10-20
@EvgK

A couple of links for thought:
1) An example with CorLaunchApplication .
2) Bug-request with similar error with CorLaunchApplication

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question