Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / VS Tools for Office / April 2006

Tip: Looking for answers? Try searching our database.

Copying and running VSTO customizations between network shares

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Nick Keller - 18 Apr 2006 00:15 GMT
We have created a simple VSTO customization for Excel, and have deployed the
customization to a network share via the project's "Publish" Properties tab.  
Users have requested a different path on the network for the spreadsheet than
the deployment folder.  I initially attempted to copy the .xls file from the
deployment location to another location on the same network share (e.g. let's
say my mapped drive is K:, I want to copy the file from
K:\ISDevelopment\Trusted\Report\Report.xls to K:\Report\Report.xls), but when
I tried to open the .xls file in its new location, I get an error saying the
customization assembly could not be found or could not be loaded, with the
following details:

The customization does not have the required permissions to execute.

************** Exception Text **************
System.Security.SecurityException: The customization does not have the
required permissions to execute.
  at
Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.HandleOnlineOffline (Exception e, String basePath, String filePath)
  at
Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.CreateCustomizationDomainInternal(Uri
uriFullDocumentDirectory, Uri uriFullDocFilePath, String documentName,
IHostServiceProvider hostCallback, IAddinSecurityManager secman, AppManifest&
applicationManifest, Boolean& manifestDirty, IAppInfo& appInfo)
  at
Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.CreateCustomizationDomain(String
applicationDomainPath, String documentName, IHostServiceProvider
hostCallback, IExecuteCustomization& executor)
  at
Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManager.CreateCustomizationDomain(String
applicationDomainPath, String documentName, IHostServiceProvider
hostCallback, IExecuteCustomization& executor)
The Zone of the assembly that failed was:
MyComputer

************** Loaded Assemblies **************
mscorlib
   Assembly Version: 2.0.0.0
   Win32 Version: 2.0.50727.42 (RTM.050727-4200)
   CodeBase:
file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
Microsoft.VisualStudio.Tools.Applications.Runtime
   Assembly Version: 8.0.0.0
   Win32 Version: 8.0.50727.42
   CodeBase:
file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Applications.Runtime/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Applications.Runtime.dll
----------------------------------------
System
   Assembly Version: 2.0.0.0
   Win32 Version: 2.0.50727.42 (RTM.050727-4200)
   CodeBase:
file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
Microsoft.Office.Tools.Common
   Assembly Version: 8.0.0.0
   Win32 Version: 8.0.50727.42
   CodeBase:
file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.Office.Tools.Common/8.0.0.0__b03f5f7f11d50a3a/Microsoft.Office.Tools.Common.dll
----------------------------------------
System.Xml
   Assembly Version: 2.0.0.0
   Win32 Version: 2.0.50727.42 (RTM.050727-4200)
   CodeBase:
file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Configuration
   Assembly Version: 2.0.0.0
   Win32 Version: 2.0.50727.42 (RTM.050727-4200)
   CodeBase:
file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------

I have created an installer action that modifies the CAS settings on the
target machine.  With an Enterprise policy level, level final code group, it
gives full trust to all code originating from
"\\fileserver\ISDevelopment\Trusted\ReportName\*"; this path contains the
deployment folder "Report_1.0.0.0" as well as the .xls file.  When I run the
.xls file from this location, all is well.  In addition if I copy the .xls
file to my desktop or C: for example, the report runs fine.  

Is there some reason why I might not be able to run the customization after
I copy it from one location on the network share to another location?

Thanks in advance.

Signature

Nick Keller
Software Developer/Analyst
Mercury Media

MMJ - 18 Apr 2006 10:18 GMT
every customization (code-behind assembly) requires to pass a security
barrier ... now,
when you published the project, not only the required files were
copied/deployed at destination, but also the Code Access Security Policy
was also updated for the customization to run! that policy was for that
particular destination and will not hold for the new location

solutions:

you can:
1) place a shortcut of the .xls at the required location, and leave the
original file where it is published originally!
2) or update the CAS policy (use caspol.exe for command line access or
Adminitrative Tools>.net 2.0 configuration console

regards!
Muhammad Mohtashim Jangda!

> We have created a simple VSTO customization for Excel, and have deployed the
> customization to a network share via the project's "Publish" Properties tab.  
[quoted text clipped - 80 lines]
>
> Thanks in advance.
Nick Keller - 18 Apr 2006 17:26 GMT
Muhammad,

Thanks for your quick response.  The shortcut solution is the one I've been
using in the short term.

What is interesting to me is that the customization assembly is not being
moved, but rather the .xls file is.  The CAS
policy was configured via our installer to allow code loaded from the
deployment location to run.  I was assuming that
the code would still be loaded from the same location and thus present the
proper evidence to satisfy the CAS
settings.  Is this not the case?

I had also tried modifying the installer so that it would set the CAS policy
to grant full trust at the Enterprise policy level,
level final, to all code loaded from the path requested by the users.  This
also caused the assembly to fail to load.  Is this similar
to what you were suggesting?

Thanks,
Signature

Nick Keller
Software Developer/Analyst
Mercury Media

> every customization (code-behind assembly) requires to pass a security
> barrier ... now,
[quoted text clipped - 98 lines]
> >
> > Thanks in advance.
Harry Miller [MSFT] - 19 Apr 2006 16:00 GMT
Have you granted permissions to the document, as well as the assembly? If
the document is in a network location, you have to grant trust to it just
like you do the assembly. Documents work automatically only when they are
located on the user's computer. There's a bit about this in the VSTO docs:
http://msdn2.microsoft.com/en-us/library/6exya3kf(VS.80).aspx

Signature

Harry Miller
This posting is provided "AS IS" with no warranties, and confers no rights.

> Muhammad,
>
[quoted text clipped - 52 lines]
> > > required permissions to execute.
> > >    at

Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.H
andleOnlineOffline (Exception e, String basePath, String filePath)
> > >    at

Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.C
reateCustomizationDomainInternal(Uri
> > > uriFullDocumentDirectory, Uri uriFullDocFilePath, String documentName,
> > > IHostServiceProvider hostCallback, IAddinSecurityManager secman, AppManifest&
> > > applicationManifest, Boolean& manifestDirty, IAppInfo& appInfo)
> > >    at

Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.C
reateCustomizationDomain(String
> > > applicationDomainPath, String documentName, IHostServiceProvider
> > > hostCallback, IExecuteCustomization& executor)
> > >    at

Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManager.CreateCus
tomizationDomain(String
> > > applicationDomainPath, String documentName, IHostServiceProvider
> > > hostCallback, IExecuteCustomization& executor)
[quoted text clipped - 12 lines]
> > >     Win32 Version: 8.0.50727.42
> > >     CodeBase:

file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Applications.Runtime/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Applications.Runtime.dll
> > > ----------------------------------------
> > > System
> > >     Assembly Version: 2.0.0.0
> > >     Win32 Version: 2.0.50727.42 (RTM.050727-4200)
> > >     CodeBase:

file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
> > > ----------------------------------------
> > > Microsoft.Office.Tools.Common
> > >     Assembly Version: 8.0.0.0
> > >     Win32 Version: 8.0.50727.42
> > >     CodeBase:

file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.Office.Tools.Common/8.0.0.0__b03f5f7f11d50a3a/Microsoft.Office.Tools.Common.dll
> > > ----------------------------------------
> > > System.Xml
> > >     Assembly Version: 2.0.0.0
> > >     Win32 Version: 2.0.50727.42 (RTM.050727-4200)
> > >     CodeBase:

file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
> > > ----------------------------------------
> > > System.Configuration
> > >     Assembly Version: 2.0.0.0
> > >     Win32 Version: 2.0.50727.42 (RTM.050727-4200)
> > >     CodeBase:

file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
> > > ----------------------------------------
> > >
[quoted text clipped - 10 lines]
> > >
> > > Thanks in advance.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.