Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7055411
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:44:45+00:00 2026-05-28T03:44:45+00:00

This is a ClickOnce application. According to the documentation , If your application was

  • 0

This is a ClickOnce application. According to the documentation, “If your application was originally supplied command-line options when it first executed, Restart will launch the application again with the same options.“. But I don’t know if this is supposed to work or not with ClickOnce applications. If so, what am I doing wrong?

Here is my code:

public Form1()
{
    InitializeComponent();         
    textBox1.Text = string.Join(Environment.NewLine, GetCommandLineFile());
}

private static string[] GetCommandLineFile()
{
    if (AppDomain.CurrentDomain != null &&
        AppDomain.CurrentDomain.SetupInformation != null &&
        AppDomain.CurrentDomain.SetupInformation.ActivationArguments != null &&
        AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData != null &&
        AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData.Any())
    {
        return AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData;
    }
    else return new string[] { };
}

private void button1_Click(object sender, EventArgs e)
{
    Application.Restart();
}

I associated my application with the .abc extension and when I double click my .abc file, the application will launch with the file name as the only argument, but then when I restart (by pressing my button1), GetCommandLineFile() will return an empty array.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T03:44:45+00:00Added an answer on May 28, 2026 at 3:44 am

    I believe Application.Restart was designed for standard command line arguments instead of how ClickOnce applications handle it.

    Looking at Microsoft’s code for Application.Restart, they explicitly check if the application is a ClickOnce application and then restart it without any arguments being passed. Any other application, gets Environment.GetCommandLineArgs() parsed and sent to a new process.

    I think a better 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 up, GetCommandLineFile() should grab the arguments again.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

According to Microsoft , you must sign your ClickOnce application. But it seems to
I have a ClickOnce-deployed application and I'm currently using this to detect the first
My application creates a ClickOnce application via the command line tool Mage . If
I have a ClickOnce environment like this: \\Fileserver\ClickOnceApps\App1.application C:\Documents and Settings\user\Start Menu\Programs\publisher\app1.appref-ms My understanding
I'm investiguating clickonce deployment for a .NET application. This application contains a duplicated sets
I have a simple WPF application that uses ClickOnce to handle installing. Within this
I have a ClickOnce application that will be used by two clients (multiple users
I created my ClickOnce application witch will install a small windows form application that
I have a Windows Forms ClickOnce application that performs its own application updates. This
Has anyone else experience this...on machines which I have an application updated via ClickOnce,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.