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 / March 2007

Tip: Looking for answers? Try searching our database.

Problem linking assembly to existing Excel file

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Brian Wolfe - 07 Mar 2007 15:58 GMT
We are having a problem linking an assembly produced by Visual
Studio 2005 to an existing Excel 2003 spreadsheet (.XLS) file.
(The assembly is correctly linked to the Excel 2003 spreadsheet
created by the Visual Studio 2005 project.)

With Visual Studio 2005 and Microsoft Visual Studio 2005 Tools
for Office 2007 SE we have successfully built an install project
that deploys a strongly named assembly ExcelWorkbookSimple.dll
with ExcelWorkbookSimple.xls.  This "app" just puts up a simple
ActionPane.  The ExcelWorkbookSimple.xls file can be copied
anywhere and works -- starting the ActionPane -- as long as the
installed directory containing ExcelWorkbookSimple.dll is
available and has not been renamed.

We have tried adding the AssemblyLocation / AssemblyName custom
properties using Excel and Windows Explorer with no success. Each
time we get the following message:

 "The current .NET security policy does not permit
 ExcelWorkbookSimple to run from the folder C:\The\Actual\Path\.
 Do not change the security policy in your computer. The .NET
 security policy is controlled by your administrator or the
 developer who wrote the custom macros.  You can still edit and
 save the document.  Contact your administrator or the author of
 this document for further assistance."

We are not trying to reference a LAN / network location, nor are
we trying to access a web location.  We are trying to access a
folder on the same computer.

We tried

 _AssemblyLocation0 = C:\The\Actual\Path\ and C:\The\Actual\Path
 _AssemblyName0 = ExcelWorkbookSimple

and

 _AssemblyLocation = C:\The\Actual\Path\ and C:\The\Actual\Path
 _AssemblyName = ExcelWorkbookSimple

from both Excel and Windows Explorer.

caspol -lf did not initially show ExcelWorkbookSimple.dll had full trust.

caspol -rsp ExcelWorkbookSimple.dll showed the following before
and after adding full trust:

Microsoft (R) .NET Framework CasPol 2.0.50727.42
Copyright (c) Microsoft Corporation.  All rights reserved.

Resolving permissions for level = Enterprise
Resolving permissions for level = Machine
Resolving permissions for level = User

Grant =
<PermissionSet class="System.Security.PermissionSet"
version="1"
Unrestricted="true"/>

Success

Granting full trust worked as follows:

C:\The\Actual\Path>caspol -af ExcelWorkbookSimple.dll

Microsoft (R) .NET Framework CasPol 2.0.50727.42
Copyright (c) Microsoft Corporation.  All rights reserved.

Because all GAC assemblies always get full trust, the full trust list is no
long
er meaningful. You should install any assemblies that are used in security
policy
y in the GAC to ensure they are trusted.
The operation you are performing will alter security policy.
Are you sure you want to perform this operation? (yes/no)
yes
Success

caspol -lf after granting full trust showed the assembly:

Microsoft (R) .NET Framework CasPol 2.0.50727.42
Copyright (c) Microsoft Corporation.  All rights reserved.

Security is ON
Execution checking is ON
Policy change prompt is ON

Level = Machine

Full Trust Assemblies:

...

22.  ExcelWorkbookSimple 1.0.0.0 =
StrongName -
0024000004800000940000000602000000240000525341310004000001000100E7D33901080D61DBD1F68A4A9432F633B28233AB9572BA75763EAF9B59894EA45D36303BD2CB7669052E0508A2EB0C30BAE44E1A49FF43ECC978C100DB42E8A021F66A80F0B35668C8A44DFC5795349AC8C9FCC245FECDB539A964A059544CF2A9A67DE13D6C05A84DB31E36A9031772426E2DC5A1D8A6019F862F5762D176D4 name = ExcelWorkbookSimple version = 1.0.0.0
Success

Even after granting full trust we still get the same message.

Thanks!
dev_osama - 08 Mar 2007 13:17 GMT
I also have the same problem .. i didn't any solution till now .. !!!!

> We are having a problem linking an assembly produced by Visual
> Studio 2005 to an existing Excel 2003 spreadsheet (.XLS) file.
[quoted text clipped - 97 lines]
>
> Thanks!
Cindy M. - 09 Mar 2007 17:39 GMT
Hi =?Utf-8?B?QnJpYW4gV29sZmU=?=,

> We are having a problem linking an assembly produced by Visual
> Studio 2005 to an existing Excel 2003 spreadsheet (.XLS) file.
> (The assembly is correctly linked to the Excel 2003 spreadsheet
> created by the Visual Studio 2005 project.)

You might try asking in the VSTO FORUM, where there are more
people who may be able to help:

http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=16&SiteID=
1&PageID=0

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17
2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow
question or reply in the newsgroup and not by e-mail :-)

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.