Re: Excel : System.Security.Permissions.SecurityPermission

From: Shawn Farkas [MS] (shawnfa_at_online.microsoft.com)
Date: 06/25/03


Date: Wed, 25 Jun 2003 10:23:09 -0700


Since you have three AssemblyInfo.vb files, you need to make sure that all
three of them reference your keypair by including the AssemblyKeyFile
attribute. Do they all have this in addition to the AssemblyVersion
attributes?

-Shawn

-- 
--------------------------------------------------
This posting is provided "AS IS" with no warranties, and confers no rights
"Murali" <cutekutty@hotmail.com> wrote in message 
news:eIjlGmxODHA.2248@TK2MSFTNGP11.phx.gbl...
> Thanks for your help in this regard.
> Sorry for long time taken to reply.I stuck with other works.
>
> Well.
> Let me Explain my scenario.
> I have a one application project called MyApp and i have another solution
> which has 2 prjoects like(ControlLibrary and MyLib).MyLib has all the
> classes like functions to intract with DB and the other 
> one(ControlLibrary )
> has all the inerited classes for Grid,Textboxes,ComboBoxes,Menus...
>
> So i have total of 3 assemblyinfo.vb.(MyApp,ControlLibrary,MyLib)
>
> As you suggested earlier, i added AssemblyVersion(1.0.0.1)  ControlLibrary
> and MyLib (and  AssemblyVersion(1.0.0.2) )
> After that i build the both and referenced again in MyApp and created a
> StrongName.
>
> I have Interop.Shdocvw.dll, Excel.dll. These are all fine and i changed
> using tlbimp.
> But my own ControlLibrary.dll and MyLib.dll has making problems.
> It is really very hectic.Really i spent more than a week to solve this.But
> no use at all.
>
> -Murali
>
>
> "Shawn Farkas [MS]" <shawnfa@online.microsoft.com> wrote in message
> news:uMO8ygPNDHA.2248@TK2MSFTNGP12.phx.gbl...
>> This AssemblyInfo.vb file is part of your ControlLibrary project right?
> In
>> addition to being signed by a key, an assembly will also require a 
>> version
>> number to be properly strong name signed.  Are you sure there's a version
>> attribute in that AssemblyInfo file?
>>
>> When you develop so that your assemblies are built to a mapped network
>> drive, you are getting less than full trust for them, since they will map
> to
>> the LocalIntranet group.  If you don't need FullTrust, then you won't 
>> have
>> an issue here.
>>
>> -Shawn
>>
>> -- 
>>
>> --------------------------------------------------
>> This posting is provided "AS IS" with no warranties, and confers no 
>> rights
>> "Murali" <cutekutty@hotmail.com> wrote in message
>> news:uxM6QENNDHA.704@tk2msftngp13.phx.gbl...
>> > HI
>> > Really thanks for you help in this.But still i get the same error as
>> > "Unable to emit assembly: Referenced assembly 'ControlLibrary' does not
>> > have
>> > a strong name"
>> >
>> > Let me explain what i did,
>> > 1. I created a StrongName.snk and put it in ProjectDirectory.
>> > 2. Then AssembleInfo.vb line as <Assembly:
>> > AssemblyKeyFileAttribute("G:\Source\App\StrongName.snk")>
>> >
>> > Then i build it again i get the error
>> > "Unable to emit assembly: Referenced assembly 'ControlLibrary' does not
>> > have
>> > a strong name"
>> >
>> > Could you please tell me what i do next? I dont know whether i have to
> use
>> > tlbimp.exe.
>> > I tried to use tlbimp as
>> > "G:/Source/Lib" is a path of Lib
>> > G:/Source/App>tlbimp "G:/Source/Lib/bin/ControlLibrary.dll"
>> > /publickey:StrongName.snk /out:My.dll
>> > "it says ControlLibrary.dll is not a valid type library.
>> >
>> > One more thing to mention here.
>> > I doing all this in Developing Machine(.net installed) and the whole
>> > project
>> > is in Mapped Drive (G)(server) where i have my whole project resides.
>> > It has also .Net Frame work installed.
>> >
>> > Do you suggest to directly do all this in my server itself?
>> >
>> > Thank you.
>> >
>> > Rgds
>> > Murali
>> >
>> >
>> > "Shawn Farkas [MS]" <shawnfa@online.microsoft.com> wrote in message
>> > news:OMRceqCNDHA.3664@tk2msftngp13.phx.gbl...
>> >> The easiest way to have a .dll that you author get signed is to 
>> >> include
>> > the
>> >> AssemblyKeyFileNameAttribute in your AssemblyInfo.cs (or
> AssemblyInfo.vb)
>> >> file.  This should have the file name of a key you generated using the
>> >> command "sn -k mykey.snk", which would generate mykey.snk.  If you are
>> > using
>> >> Visual Studio, note that the location of the file is relative to the
>> > output
>> >> binary path, so if your binaries are being built and placed in
>> >> projdir\bin\debug, and your key is projdir\mykey.snk, then your
>> >> AssemblyKeyFileNameAttribute should be "..\..\mykey.snk"
>> >>
>> >> -Shawn
>> >>
>> >> -- 
>> >>
>> >> --------------------------------------------------
>> >> This posting is provided "AS IS" with no warranties, and confers no
>> >> rights
>> >> "Murali" <cutekutty@hotmail.com> wrote in message
>> >> news:#mZGAbANDHA.2480@tk2msftngp13.phx.gbl...
>> >> >I dont understand how to convert my.dll to a signed one.
>> >> > Could anyone pass the complete procedure to do that?
>> >> >
>> >> > Thanks for all your replies.
>> >> > -Murali
>> >> >
>> >> > "Shawn Farkas [MS]" <shawnfa@online.microsoft.com> wrote in message
>> >> > news:eocdJgdMDHA.2300@TK2MSFTNGP11.phx.gbl...
>> >> >> Specifically tlbimp creates a managed wrapper for an unmanaged COM
>> >> >> libaray
>> >> >> that contains an embedded type library.  It will also create a
> managed
>> >> >> wrapper for an unmanaged COM library without an embedded type
> library
>> > if
>> >> > you
>> >> >> supply the type library seperately.
>> >> >>
>> >> >> -Shawn
>> >> >>
>> >> >> -- 
>> >> >>
>> >> >> --------------------------------------------------
>> >> >> This posting is provided "AS IS" with no warranties, and confers no
>> >> >> rights
>> >> >> "Marcelo Birnbach [MS]" <mbirnbac@online.microsoft.com> wrote in
>> > message
>> >> >> news:#aod11SMDHA.1840@TK2MSFTNGP11.phx.gbl...
>> >> >> > What exactly are you trying to do here? Is my.dll unmanaged?
> tlbimp
>> >> >> > creates
>> >> >> > managed wrappers for unmanaged libraries, so it won't work if you
>> >> >> > are
>> >> >> > using
>> >> >> > it with a managed dll.
>> >> >> >
>> >> >> > Thanks,
>> >> >> > Marcelo
>> >> >> >
>> >> >> > "Murali" <cutekutty@hotmail.com> wrote in message
>> >> >> > news:OKv3MQSMDHA.1624@tk2msftngp13.phx.gbl...
>> >> >> >> Thanks for your reply.
>> >> >> >> I solved the Interop.SHDocVw.dll problems.But my own dll creates
>> >> >> >> the
>> >> > same
>> >> >> >> problem.
>> >> >> >> tlbimp  "C:/dir/my.dll"   /publickey:StrongName.snk  /out: 
>> >> >> >> my.dll
>> >> >> >> It says the same error as  'is not a valid type library'
>> >> >> >> I tried this too.
>> >> >> >> tlbimp  "C:/dir/my.tlb"   /publickey:StrongName.snk  /out: 
>> >> >> >> my.dll
>> >> >> >> It is also says error.
>> >> >> >> How to do this?Could you help?
>> >> >> >> Thanks
>> >> >> >> -Murali
>> >> >> >>
>> >> >> >> "Michel Gallant" <neutron@istar.ca> wrote in message
>> >> >> >> news:uaIG3xRMDHA.3976@tk2msftngp13.phx.gbl...
>> >> >> >> > First off, you use either one or the other declarations:
>> >> >> >> >    Assembly: AssemblyKeyFileAttribute("strongpair.snk")
>> >> >> >> > **OR**, if you imported strongpair.snk into a keycontainer:
>> >> >> >> > Assembly: AssemblyKeyNameAttribute("StrongContainer")
>> >> >> >> >
>> >> >> >> > the tlbimp syntax is:
>> >> >> >> >  tlbimp  originalnativetypelib.dll   /publickey:StrongName.snk
>> >> >> >> /out:interop.yourchoice.dll
>> >> >> >> >
>> >> >> >> >  - Mitch
>> >> >> >> >
>> >> >> >> > "Murali" <cutekutty@hotmail.com> wrote in message
>> >> >> >> news:%23yPK6kQMDHA.3144@tk2msftngp13.phx.gbl...
>> >> >> >> > >
>> >> >> >> > > Well.Thanks for your replies.
>> >> >> >> > > <Assembly: AssemblyVersionAttribute("1.0.0.0")>
>> >> >> >> > > <Assembly: AssemblyKeyFileAttribute("strongpair.snk")>
>> >> >> >> > > <Assembly: AssemblyKeyNameAttribute("StrongContainer")>
>> >> >> >> > >
>> >> >> >> > > I created StrongName and i compiled the application,it says
>> > error
>> >> > as
>> >> >> >> > > "Unable to emit assembly: Referenced assembly
> 'Interop.SHDocVw'
>> >> > does
>> >> >> > not
>> >> >> >> > > have a strong name"
>> >> >> >> > >
>> >> >> >> > > For this i got one reply as to do as follows, tlbimp
>> >> >> >> > > /publickey:StrongName.snk 'Interop.SHDocVw.dll
>> >> >> >> > > It says error as 'is not a valid type library'
>> >> >> >> > >
>> >> >> >> > > I dont know what to do next?
>> >> >> >> > >
>> >> >> >> > >
>> >> >> >> > > Rgds
>> >> >> >> > > Murali
>> >> >> >> > >
>> >> >> >> > >
>> >> >> >> > >
>> >> >> >> > > "Michel Gallant" <neutron@istar.ca> wrote in message
>> >> >> >> > > news:%235MY2%23PMDHA.1216@TK2MSFTNGP11.phx.gbl...
>> >> >> >> > > > Here is similar information, with more visualization and
> some
>> >> > good
>> >> >> >> > > references:
>> >> >> >> > > >  http://www3.sympatico.ca/mitchg/dotnet/networkshare.html
>> >> >> >> > > >
>> >> >> >> > > >  - Michel Gallant
>> >> >> >> > > >    MVP Security
>> >> >> >> > > >
>> >> >> >> > > > "Shel Blauman [MSFT]" <sheldonb@online.microsoft.com> 
>> >> >> >> > > > wrote
>> >> >> >> > > > in
>> >> >> > message
>> >> >> >> > > > news:eYRhs7PMDHA.2008@TK2MSFTNGP10.phx.gbl...
>> >> >> >> > > > > Here are some instructions for running an application
> from
>> > the
>> >> >> >> Intranet
>> >> >> >> > > Zone
>> >> >> >> > > > > (ie:  running an app from a share).
>> >> >> >> > > > >
>> >> >> >> > > > > Shel
>> >> >> >> > > > >
>> >> >> >> > > > > The following applies to a managed executable program
>> >> >> >> > > > > (.exe)
>> >> > that
>> >> >> >> > > executes
>> >> >> >> > > > > with greater permissions than normally would be granted
> to
>> > the
>> >> >> > zone
>> >> >> >> to
>> >> >> >> > > which
>> >> >> >> > > > > the assembly belongs.  For a program hosted on another
>> >> >> >> > > > > computer
>> >> >> >> > > > > in
>> >> >> > a
>> >> >> >> > > local
>> >> >> >> > > > > area network, this would be the Local Intranet zone. 
>> >> >> >> > > > > Any
>> > file
>> >> >> >> residing
>> >> >> >> > > on a
>> >> >> >> > > > > mapped network drive is, by default, in the Local
> Intranet
>> >> >> >> > > > > zone
>> >> >> > and
>> >> >> >> > > operates
>> >> >> >> > > > > under its permission set.  If the assembly to be run 
>> >> >> >> > > > > does
>> > not
>> >> >> >> require
>> >> >> >> > > any
>> >> >> >> > > > > permissions other than those normally granted to
>> > applications
>> >> >> >> running in
>> >> >> >> > > the
>> >> >> >> > > > > Local Intranet zone, signing and creating a custom code
>> > group
>> >> > are
>> >> >> >> not
>> >> >> >> > > > > required.  The below steps are only necessary when the
>> >> >> >> > > > > assembly
>> >> >> >> causes a
>> >> >> >> > > > > security exception to be thrown when it is executed.  It
> is
>> >> >> > strongly
>> >> >> >> > > > > recommended that the permissions granted the Local
> Intranet
>> >> > zone
>> >> >> > not
>> >> >> >> be
>> >> >> >> > > > > changed to FullTrust as an alternative to the following
>> > steps.
>> >> >> >> > > > >
>> >> >> >> > > > >
>> >> >> >> > > > >
>> >> >> >> > > > > Check that the following conditions have been met:
>> >> >> >> > > > >
>> >> >> >> > > > >
>> >> >> >> > > > >
>> >> >> >> > > > >   1.. The evidence identifying the executable is used to
>> >> >> >> > > > > set
>> >> > the
>> >> >> >> > > membership
>> >> >> >> > > > > condition in a code group, using either the .NET
>> > Configuration
>> >> >> > Tool
>> >> >> >> > > > > (Mscorcfg.msc) or caspol.exe.   Although other 
>> >> >> >> > > > > membership
>> >> >> > conditions
>> >> >> >> are
>> >> >> >> > > > > available, the recommended practice is to sign the
> assembly
>> >> > with
>> >> >> >> > > > > a
>> >> >> >> > > strong
>> >> >> >> > > > > name or a certificate.
>> >> >> >> > > > >
>> >> >> >> > > > >
>> >> >> >> > > > > To create a strong name use sn.exe:
>> >> >> >> > > > >
>> >> >> >> > > > >
>> >> >> >> > > > >
>> >> >> >> > > > > sn -k keyPair.snk
>> >> >> >> > > > >
>> >> >> >> > > > >
>> >> >> >> > > > >
>> >> >> >> > > > > // This strong name key is used to create a code group
> that
>> >> > gives
>> >> >> > //
>> >> >> >> > > > > permissions to this assembly.
>> >> >> >> > > > >
>> >> >> >> > > > > [assembly: AssemblyKeyFile("keyPair.snk")]
>> >> >> >> > > > >
>> >> >> >> > > > > namespace SignedAssembly
>> >> >> >> > > > >
>> >> >> >> > > > >
>> >> >> >> > > > >
>> >> >> >> > > > >   2.. The code group corresponding to the evidence of 
>> >> >> >> > > > > the
>> >> >> > executable
>> >> >> >> > > gives
>> >> >> >> > > > > the permissions the assembly requires.  If the 
>> >> >> >> > > > > executable
>> >> >> >> > > > > is
>> >> >> >> identified
>> >> >> >> > > by a
>> >> >> >> > > > > strong name, the code group will utilize the
>> >> >> >> > > StrongNameMembershipCondition.
>> >> >> >> > > > >
>> >> >> >> > > > >
>> >> >> >> > > > > caspol -machine -addgroup All_Code -strong -file
>> >> >> > signedassembly.exe
>> >> >> >> > > > > FullTrust -name FouthCoffeeStrongName -description "Code
>> > group
>> >> >> >> granting
>> >> >> >> > > > > trust to code signed by FourthCoffee"
>> >> >> >> > > > >
>> >> >> >> > > > >
>> >> >> >> > > > >
>> >> >> >> > > > > Alternatively, the code group can be created using the
>> >> > Microsoft
>> >> >> >> .NET
>> >> >> >> > > > > Framework Configuration tool  (Mscorcfg.msc) found under
>> >> >> >> Administrative
>> >> >> >> > > > > Tools.
>> >> >> >> > > > >
>> >> >> >> > > > >
>> >> >> >> > > > >
>> >> >> >> > > > > The simplest method of granting permissions to the new
> code
>> >> > group
>> >> >> > is
>> >> >> >> by
>> >> >> >> > > the
>> >> >> >> > > > > use of the existing FullTrust permission set; however, 
>> >> >> >> > > > > it
>> >> >> >> > > > > would
>> >> >> >> > > > > be
>> >> >> >> best
>> >> >> >> > > to
>> >> >> >> > > > > create a custom named permission set only granting the
>> >> >> >> > > > > permissions
>> >> >> >> the
>> >> >> >> > > > > assembly requires to execute.  Named permission sets are
>> > most
>> >> >> > easily
>> >> >> >> > > > > constructed using the Microsoft .NET Framework
>> >> >> >> > > > > Configuration
>> >> > tool
>> >> >> >> > > mentioned
>> >> >> >> > > > > above.  The sequence would be to first create the custom
>> > named
>> >> >> >> > > permission
>> >> >> >> > > > > set, then create the code group, making use of the new
>> >> > permission
>> >> >> >> set.
>> >> >> >> > > > >
>> >> >> >> > > > >
>> >> >> >> > > > >
>> >> >> >> > > > >   3.. The runtime version on the host computer is
>> >> >> >> > > > > compatible
>> >> > with
>> >> >> >> the
>> >> >> >> > > > > runtime used to compile the assembly.
>> >> >> >> > > > >
>> >> >> >> > > > >
>> >> >> >> > > > >   4.. The code group created for the executable is in 
>> >> >> >> > > > > the
>> > same
>> >> >> >> runtime
>> >> >> >> > > that
>> >> >> >> > > > > the executable uses.
>> >> >> >> > > > >
>> >> >> >> > > > >
>> >> >> >> > > > >
>> >> >> >> > > > > -- 
>> >> >> >> > > > > This posting is provided "AS IS" with no warranties, and
>> >> > confers
>> >> >> > no
>> >> >> >> > > rights.
>> >> >> >> > > > > Use of included script samples are subject to the terms
>> >> > specified
>> >> >> > at
>> >> >> >> > > > > http://www.microsoft.com/info/cpyright.htm
>> >> >> >> > > > >
>> >> >> >> > > > >
>> >> >> >> > > > > "Murali" <cutekutty@hotmail.com> wrote in message
>> >> >> >> > > > > news:Oq8TWFPMDHA.2348@TK2MSFTNGP11.phx.gbl...
>> >> >> >> > > > > > HI
>> >> >> >> > > > > > I opened a Excel application from my client side
>> >> >> >> > > > > > (Application
>> >> >> >> > > > > > is
>> >> >> >> > > installed
>> >> >> >> > > > > > in server,accessing via mapped drive), it says error 
>> >> >> >> > > > > > as
>> >> >> >> > > > > > "System.Security.Permissions.SecurityPermission"
>> >> >> >> > > > > > How to solve this?
>> >> >> >> > > > > >
>> >> >> >> > > > > > I changed Trust for this assembly to FullTrust.But no
>> >> >> >> > > > > > use.
>> >> >> >> > > > > > Can anyone help in this?
>> >> >> >> > > > > >
>> >> >> >> > > > > > Thanks
>> >> >> >> > > > > >
>> >> >> >> > > > > >
>> >> >> >> > > > > >
>> >> >> >> > > > >
>> >> >> >> > > > >
>> >> >> >> > > >
>> >> >> >> > > >
>> >> >> >> > >
>> >> >> >> > >
>> >> >> >> >
>> >> >> >> >
>> >> >> >>
>> >> >> >>
>> >> >> >
>> >> >> >
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >>
>> >>
>> >
>> >
>>
>>
>
> 


Relevant Pages

  • RE: SecurityException on InvokeMember with StrongNameIdentityPermission
    ... What you're probably seeing is a special behavior of link demands when used with reflection. ... when I reference it design-time. ... I always get a SecurityException. ... >My calling assembly has the same AssemblyKeyFile as the called assembly ...
    (microsoft.public.dotnet.security)
  • Re: SecurityException on InvokeMember with StrongNameIdentityPermission
    ... > What you're probably seeing is a special behavior of link demands when used with reflection. ... SecurityException on InvokeMember with StrongNameIdentityPermission ... > when I reference it design-time. ... >>My calling assembly has the same AssemblyKeyFile as the called assembly ...
    (microsoft.public.dotnet.security)
  • Re: Assembly not strongly named problem need help
    ... Thanks, but I thought to reference the assembly, I had to have it in ... To do this you will need to modifiy AssemblyKeyFile and ... >> in my csharp page. ... >> Thank you for any guidance. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Assembly not strongly named problem need help
    ... If use just want to say 'using owc10' then just reference the assembly and ... If for some reason you want to put the assembly in to ... To do this you will need to modifiy AssemblyKeyFile and ...
    (microsoft.public.dotnet.languages.csharp)