I believe Application.Restart was designed for standard command line arguments, not as a ClickOnce application.
By looking at the Microsoft code for Application.Restart , they explicitly check to see if the application is a ClickOnce application, and then restarts it without any passed arguments. Any other application gets Environment.GetCommandLineArgs() parsed and sent to a new process.
I think the best solution, instead of writing arguments to a file, is to simply start a new process as such:
"path\Application Name.appref-ms" arg1,arg2,arg3
That way, when your application starts, GetCommandLineFile() will take the arguments again.
source share