Home » excel » .net VSTO save excel file and share on a server

.net VSTO save excel file and share on a server

Posted by: admin May 14, 2020 Leave a comment

Questions:

I have a requirement at job to produce an Excel file and then to put it on a shared folder so managers can take a copy and consult it.

I have been using VSTO to develop a part on my application.

When I execute this application, the excel file pops up and everything is populated properly.

If I save a local copy of the document on my desktop and I open it again, I receive error saying VSTO could not be downloaded.

Is there a way to:

1.execute the application
2. save a local copy on my desktop
3. use this file as a normal excel file

from an Excel Workbook application in visual studio 2010.

Please ask any question if I am not clear, it’s the first time I use VSTO and some of it is still unclear to me.

Thank you.

How to&Answers:

I found the answer to my problem.

Here’s where I found it:
http://gluegood.blogspot.com/2010/07/namecode-classc-sharp.html

Simply Add “RemoveCustomization” at the end of the startup method.

private void ThisWorkbook_Startup(object sender, System.EventArgs e)
    {
        [ code removed for clarity ]

        this.RemoveCustomization();
    }

This removes every customizations you made on your application.
This allows you to execute your application, save a local copy on your desktop, and open without the need to install or deploy anything.

Thank you.

Answer:

I Believe you should document yourself better about VSTO deployment issues.

There were somne changes between version 2007 and version 2010 to help and simplify deployment with ClickOnce, check on MSDN.