starLisa

I've done a search through the forums, but I haven't managed to find the answer I'm looking for.

I have a relatively simple Excel file that I created using VSTO. In the startup event of one of the sheets, I add a button to the toolbar, and when I click that button, it opens up a form. When I fill in the form and click the run button, it grabs data from a stored procedure and dumps it into Excel, formatting it correctly.

When I run it in VS.NET, it works fine. When I go to the bin folder and open the Excel file there, the button appears, and clicking on it works like a charm.

But... if I take the Excel file and the dll and copy them to another place on the same workstation (My Documents), then when I open up the Excel file, no button appears. No error, either. Nothing. Clearly, something is missing, but I'm not sure what it is. I can't imagine that I need to use an installer project, do I Again, it works fine without Visual Studio when it's sitting in its original bin folder, but if I put it anywhere else on the same machine, it doesn't.

Thanks,
Lisa



Re: Visual Studio Tools for Office Distributing Excel Workbook created by VSTO

Cindy Meister

Hi Lisa

You're tripping over the .NET Framework security protocols. When you create a VSTO project, the project template automatically sets location-based permissions to run the project. When you deploy the VSTO solution, you need to explicitly set permissions for the solution (CASPOL). As with any .NET solution, the evidence for permissions can be a combination of location, strong name and code signing. You have to decide what is appropriate and take appropriate steps.

There's a lot involved. Here are links to documentation on the process

Misha's blog

http://blogs.msdn.com/mshneer/archive/2006/01/05/deployment_articles.aspx

MSDN site

http://msdn2.microsoft.com/en-us/library/hesc2788.aspx






Re: Visual Studio Tools for Office Distributing Excel Workbook created by VSTO

starLisa

I have to sign the thing in order to use an installer to deploy it Isn't that taking security to an absurd level I might as well just write a macro, no



Re: Visual Studio Tools for Office Distributing Excel Workbook created by VSTO

Cindy Meister

Hi Lisa

You don't have to sign it. That's just one possibility for providing evidence that what you're installing meets your security requirements. (I listed the three types, which can be used separately or in combination.) Security is one of the main driving forces behind the .NET Framework concept; the user can no longer just run an executable and get "whacked". He has to make a conscious decision to install (trust).

You need to read up on the .NET Framework security design and CASPOL a bit to understand what's going on.