none
Exclude Files from Clickonce signing in VS2010 ? RRS feed

  • Question

  • hello,

    I developed a VSTO-Word-Addin. The project's option about signing the clickonce-manifest can not be disabled. So I signed it with our private key (pfx-file).

    After installing the Addin I realized that you can't even change the Addin's app.config file without invalidating the manifest because of the Addin's hash value that has changed by manipulating the config file.

    Our customers are large companies that will deploy the Addin by software management tools. Before deploying the admin has to adjust some settings in the app.config file. If those changes break the manifest's signature, our software can not be installed / run.

    So my question is: is there a way to exclude the app.config from signing so that an admin can modify it before deploying?

    I don't want to build a solution for every customer just to adjust the values in my app.config ;)

    I hope that someone can help me here.

    thanks a lot!

    Tobias Koller

    Tuesday, July 12, 2011 7:56 AM

Answers

  • hi Tom,

    thanks for your answer. 

    But the app.config will be definitely deployed to the installation-directory (called MyAddIn.dll.config), i checked it.

    The problem is that I can't change it when I use the clickonce-cache (it's always the case, when you install the word-addin by doubleclick the vsto-file or "publish" via clickonce) because the files are stored in random-created-directories in c:/users/appdata/local/apps/2.0.....

     

    I found another solution:

    1. I just copy the content of my "bin/release" directory to the enduser machine.

    2. Then I doubleclick the vsto-file to install the word-addin (or use "c:/program files/common files/microsoft shared/VSTO/10.0/VSTOInstaller.exe" /i "c:/program files/MyAddIn/MyAddIn.vsto" /s).

    3. After that i open the registry and change the "manifest"-key "HKCU/Software/Microsoft/Office/Word/Addins/MyAddIn@manifest" from "file:///C:/program files/MyAddIn/MyAddIn.vsto" to "file:///C:/program files/MyAddIn/MyAddIn.vsto|vstolocal"

     

    The |vstolocal suffix tells the addin to start directly out of "c:/program files/MyAddIn" and not from the clickonce-cache "f.e. c:/users/appdata/local/apps/2.0/....".

    After these three steps its no problem to modifiy the MyAddIn.dll.config file after the installation (you can't change it before the installation because of the clickonce hashvalues).

    The second benifit is that f.e. Assembly.GetExecutingAssembly().CodeBase points directly to your "c:/program files/MyAddIn/MyAddIn.dll" (and not into the clickonce-cache)so I can easily add any file I want to this directory and can access it with this path.

     

    I don't know if its a common way to handle this but it works like expected.

     

    thanks

    Tobias

     

    Thursday, July 14, 2011 5:23 AM

All replies

  • Hi Tobias,

    Thanks for posting in the MSDN Forum.

    As far as I know, the app.config file will not exist in your distribution. It only exists in the project.  And what you set in the app.config will build into the dll file.

    So I think what you want to do is hard to approach. I would recommend you create an xml file to store the values which need to adjust before install and write logic in the add-in to access this file.

     I hope it can help you.

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, July 14, 2011 3:01 AM
    Moderator
  • hi Tom,

    thanks for your answer. 

    But the app.config will be definitely deployed to the installation-directory (called MyAddIn.dll.config), i checked it.

    The problem is that I can't change it when I use the clickonce-cache (it's always the case, when you install the word-addin by doubleclick the vsto-file or "publish" via clickonce) because the files are stored in random-created-directories in c:/users/appdata/local/apps/2.0.....

     

    I found another solution:

    1. I just copy the content of my "bin/release" directory to the enduser machine.

    2. Then I doubleclick the vsto-file to install the word-addin (or use "c:/program files/common files/microsoft shared/VSTO/10.0/VSTOInstaller.exe" /i "c:/program files/MyAddIn/MyAddIn.vsto" /s).

    3. After that i open the registry and change the "manifest"-key "HKCU/Software/Microsoft/Office/Word/Addins/MyAddIn@manifest" from "file:///C:/program files/MyAddIn/MyAddIn.vsto" to "file:///C:/program files/MyAddIn/MyAddIn.vsto|vstolocal"

     

    The |vstolocal suffix tells the addin to start directly out of "c:/program files/MyAddIn" and not from the clickonce-cache "f.e. c:/users/appdata/local/apps/2.0/....".

    After these three steps its no problem to modifiy the MyAddIn.dll.config file after the installation (you can't change it before the installation because of the clickonce hashvalues).

    The second benifit is that f.e. Assembly.GetExecutingAssembly().CodeBase points directly to your "c:/program files/MyAddIn/MyAddIn.dll" (and not into the clickonce-cache)so I can easily add any file I want to this directory and can access it with this path.

     

    I don't know if its a common way to handle this but it works like expected.

     

    thanks

    Tobias

     

    Thursday, July 14, 2011 5:23 AM
  • Hi Tobias,

    Thanks for your prompt.

    Yes, the app.config will be built into *.dll.config.deploy file. And I’m glad to share your solutions here, I tried to use System.Environment.CurrentPath to handle this case but it failed. Your solutions are very beneficial for the community members who have similar issues to see how you solved your problem.

    Thanks for the sharing.

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    Thursday, July 14, 2011 7:17 AM
    Moderator
  • hi Tom,

    the *.deploy files will only be created when you "publish" your solution via Visual Studio and Clickonce.

    If you "only" build your solution in Visual Studio and copy the output from "bin/release", there will be a *.dll.config without the ".deploy" extension.

     

    I'm always glad if i could help other members with this solution ;)

     

    Tobias

    Thursday, July 14, 2011 7:56 AM