none
Getting error "An error occurred loading a configuration file: Unknown error "-1" during installation.

    Question

  • Hi,

    We are getting the following error during installation of our application in few machines.

    "An error occurred loading a configuration file: Unknown error "-1"

    While installation we are trying to encrypt our config files using "UserDpapiProtectedConfigurationProvider". It seems like this issue is specific to desktops.

    Please help me in resolving this issue. Also please provide me the exact root cause of this issue.

    Thanks.

    • Moved by Tom_Xu_WX Thursday, April 28, 2011 3:50 AM Install issue (From:Visual Studio Tools for Office)
    Monday, April 04, 2011 9:36 AM

All replies

  • Hi Vinoth,

     

    Thanks for posting in the MSDN Forum.

     

    Would you clarify the relationship between you deployment demo and VSTO technic? Do you want to deploy a VSTO add-in to your customers’ machines?

     

    If it is, please clarify following questions:

     

    1.      Your customers use which kind of operation system on their machines?

    2.      What’s version of your VSTO runtime?

    3.      What’s version of your Office System?

    4.      What’s version of your .NET Framework?

    5.      What’s version of the Visual Studio you used to develop your solution?

     

    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.

    Wednesday, April 06, 2011 3:26 AM
  • Hi Tom,

    Thanks for your reply.

    No, i dont want to deploy VSTO add-in along with my application. And please find below my comments on your questions below.

    1. Our application supports Windows XP/Vista/7

    2, 3. No specific version is required. In fact its not necessary office should be installed to run our application.

    4. We developed our application in .Net Framework 2.0

    5. We are using Visual Studio 2005 for the development.

    Also please let me know what could be the root cause of the issue mentioned above. We are unable to fix this.

    Thanks.


    Monday, April 18, 2011 7:32 AM
  • Hi Tom,

    Any updates on the above issue. Please help me in resolving this error.

    Tuesday, April 26, 2011 6:14 AM
  • Hi Vinoth,

     

    In you post you said <<I don’t want to deploy VSTO add-in along with my application>> Do you mean the your application is not a VSTO project?

     

    If you project isn’t a VSTO project which kind of project it is? Is it a windows form application? Or WPF application, ASP.NET application etc.?

     

    And would you please tell me which way you distribute your application, do you distribute it via Window installer or ClickOnce?

     

    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.

    Tuesday, April 26, 2011 10:14 AM
  • Hi Tom,

    Thanks for your reply.

    Our application is a winform application developed using Visual Studio 2005 (C#)

    We will distribute our application via Windows Installer using Wise Installation Studio 7.0. We will create msi setup using Wise and distribute it to our users.

    Also, we have incorporated few wise scripts which will encrypt config files during installation for security purpose. For encryption we are using "UserDpapiProtectedConfigurationProvider".

    We overridden the Install class which will invoke the wise script during installation. (Probably at the end of installation)

    Our assumption is we are receiving the above "An error occurred loading a configuration file: Unknown error "-1" error during the wise script is being executed.

    Please let me know your comments.

    Thanks.




    Wednesday, April 27, 2011 6:31 AM
  • Hi Vinoth,

    I'm not familiar with the tool you're using.

    But if I'm facing such request to encrypt the information in a config file while installing the application with the windows installer package, I will just use a custom action and the ProtectSection method.

    And the following is a article with a simple sample code to demonstrate how to use DpapiProtectedConfigurationProvider to encrypt the config information.

    For more details, you can look in to it:

    http://beta.codeproject.com/KB/security/ProtectedConfigWinApps.aspx?display=Mobile

     

    Since it seemed you can use a custom action in this deployment solution, then I also think this suggestion would be suitable for you. So, please let us know the result after you tried this suggestion.

    And, to solve that exception, I think you can ensure the config file's elements first, and then to make sure if the DpapiProtectedConfigurationProvider used correctly in your script.

     

    Best wishes,


    Mike [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.


    Wednesday, April 27, 2011 6:59 PM
    Moderator
  • Hi Vinoth,
    I am writing to check the status of the issue on your side. 
    What about this problem now? 
    Would you mind letting us know the result of the suggestions?
    Best wishes,

    Mike [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.

    Monday, May 02, 2011 7:29 AM
    Moderator
  • Hi Mike,

    Thanks for your reply.

    As you suggested previously, we tried Setup and Deployment Project to create setup for our application before going for Wise Installation Studio which is a software used to create setups.

    We couldn't achieve our requirements by using Setup and Deployment Project as it had its own disadvantages. So we have chosen Wise for our application deployment.

    Its also exposing options to add a custom action which will trigger the Install class as you mentioned before. (We placed our encryption logic here)

    But we are still not sure where exactly we are receiving the error which i mentioned before. (An error occurred loading a configuration file: Unknown error "-1")

    Is there any possibility that this issue may occur due to some machine configuration problem?

    Thanks.

    Monday, May 02, 2011 8:03 AM
  • Hi Vinoth,

    I would like to know if you can just use that code to encrypt the configuration information in a common .net application.

    Please show us the result after you tried this test.

     

    Best wishes,


    Mike [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.

    Tuesday, May 03, 2011 7:17 AM
    Moderator
  • If you are having a problem with the WISE deployment, you should post your question in the forums for that product.

    RobinDotNet


    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    Thursday, May 05, 2011 5:32 AM
    Moderator