주 콘텐츠로 건너뛰기

 locked
ClickOnce file association RRS feed

  • 질문

  • You cannot vote on your own post 
    I have configured my ClickOnce deployment so that on first run the application associates a file extension with the app. This works so that the application can be launched by executing files with the given extension. I would like the file name that lauched the app to be passed as a command line parameter which is usually retrieved with "Environment.GetCommandLineArgs()" but for ClickOnce this method does not return the launching file. Is there a way to get the file name?
    • 이동됨 YiChun Chen 2010년 6월 30일 수요일 오전 10:45 Deployment issue (From:.NET Framework Setup)
    2010년 6월 26일 토요일 오전 10:12

답변

모든 응답

  • Hi Perry,

    I am moving this thread from Base ".NET Framework Setup" forum to the "ClickOnce and Setup & Deployment Projects" forum, since the issue is related to deployment. There are more deployment experts in the "ClickOnce and Setup & Deployment Projects" forum.

    Thanks
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    2010년 6월 30일 수요일 오전 10:44
  • Hi Perry,

    That's not how ClickOnce picks up the file names. Check out this article for examples. If your app is online-only, just check out the MSDN article reference for online-only apps.

    http://robindotnet.wordpress.com/2010/03/21/how-to-pass-arguments-to-an-offline-clickonce-application/

    RobinDotNet


    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    • 답변으로 표시됨 Perry Manole 2010년 7월 2일 금요일 오전 4:40
    2010년 7월 2일 금요일 오전 2:07
  • Thank you that helped.

    So the simple answer to my question is:

    Dim straArgs() As String = AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData
    • 답변으로 표시됨 Perry Manole 2010년 7월 2일 금요일 오전 4:40
    2010년 7월 2일 금요일 오전 4:40
  • Hi,

    Yes. You also might want to check AppDomain.CurrentDomain.SetupInformation.ActivationArguments for null before checking ActivationData; I have heard some reports that sometimes it is null, and this would of course throw an exception.

    RobinDotNet


    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    2010년 7월 3일 토요일 오전 3:08
  • hello

    I tried the project that i have downloaded from the link :http://robindotnet.wordpress.com/2010/03/21/how-to-pass-arguments-to-an-offline-clickonce-application/ above and it works !

    I have added a file association to this type of file .asso just to try and have sent the publish project by ftp to my web site. I have installed the application and when i double click on a file.asso on my desk, the application load and the listbox show c:\the paths\file.asso : so it works.

    I have tried to reproduce this on my soft just by copying/pasting your code but it throw an NullReferenceException i can't figure out...

      'Get the ActivationArguments from the SetupInformation property of the domain.
            Dim activationData() As String = _
              AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData
    

    Can you help me ?

    thanks


    Cordialement
    Pascal
    http://www.scalpa.info

    2013년 5월 19일 일요일 오후 12:32
  • I doesn't work in debug mode, but it works after deploying the application on the server. Thanks for this great code.

    Cordialement
    Pascal
    http://www.scalpa.info

    • 답변으로 제안됨 scalpa 2013년 5월 19일 일요일 오후 7:43
    2013년 5월 19일 일요일 오후 7:42
  • When click on file associated with my application, the first time run (one instance) works fine!. When application already opens, and click on second file associated returns same value as first open, no second instance on envent startupnextinstance.

    2020년 7월 31일 금요일 오후 1:53