PC Review


Reply
Thread Tools Rate Thread

How to Create WinForms client and ClassLib server as one assembly?

 
 
Joseph Geretz
Guest
Posts: n/a
 
      12th Feb 2007
I'd like to break up my aplication into a WinForm executable, plus a class
library containing application utility functions. But I don't want any
client other than my own application to have access to my application
library. Isn't this the point of an 'assembly'? So how can I generate these
two artifacts as belonging to the same assembly? Is this possible with
Visual Studio 2005?

Thanks!

- Joe Geretz -


 
Reply With Quote
 
 
 
 
Patrick Steele
Guest
Posts: n/a
 
      12th Feb 2007
In article <(E-Mail Removed)>, (E-Mail Removed)
says...
> I'd like to break up my aplication into a WinForm executable, plus a class
> library containing application utility functions. But I don't want any
> client other than my own application to have access to my application
> library. Isn't this the point of an 'assembly'? So how can I generate these
> two artifacts as belonging to the same assembly? Is this possible with
> Visual Studio 2005?


Use different assemblies and CAS (Code Access Security). There was an
overview posted in the newsgroups about a week ago:

http://tinyurl.com/2nwefz

--
Patrick Steele
http://weblogs.asp.net/psteele
 
Reply With Quote
 
Alvin Bruney [MVP]
Guest
Posts: n/a
 
      12th Feb 2007
I'm not sure how and why you see CAS as preventing the access. Were you
thinking programmatically? The way I read the question seemed to imply it
was other than programmatically. Perhaps OP can clarify.

As a suggestion, why not use a windows control library?

--
Regards,
Alvin Bruney
------------------------------------------------------
Shameless author plug
Excel Services for .NET is coming...
OWC Black book on Amazon and
www.lulu.com/owc
Professional VSTO 2005 - Wrox/Wiley


"Patrick Steele" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> In article <(E-Mail Removed)>, (E-Mail Removed)
> says...
>> I'd like to break up my aplication into a WinForm executable, plus a
>> class
>> library containing application utility functions. But I don't want any
>> client other than my own application to have access to my application
>> library. Isn't this the point of an 'assembly'? So how can I generate
>> these
>> two artifacts as belonging to the same assembly? Is this possible with
>> Visual Studio 2005?

>
> Use different assemblies and CAS (Code Access Security). There was an
> overview posted in the newsgroups about a week ago:
>
> http://tinyurl.com/2nwefz
>
> --
> Patrick Steele
> http://weblogs.asp.net/psteele



 
Reply With Quote
 
Patrick Steele
Guest
Posts: n/a
 
      14th Feb 2007
In article <(E-Mail Removed)>, "Alvin Bruney
[MVP]" <some guy without an email address> says...
> I'm not sure how and why you see CAS as preventing the access. Were you
> thinking programmatically? The way I read the question seemed to imply it
> was other than programmatically. Perhaps OP can clarify.


To me, it sounded like he wanted to break his "utility functions" into a
separate assembly, but only wanted his WinForms app to be able to access
that assembly. The link I posted was to a similar question and showed
how to use strong keys and attributes to control who could make calls
into an assembly.

But perhaps the OP could clarify exactly what they want?

--
Patrick Steele
http://weblogs.asp.net/psteele
 
Reply With Quote
 
Joseph Geretz
Guest
Posts: n/a
 
      16th Feb 2007
Hi Patrick,

Yes, you state the case correctly; this is exactly what I'd like to do. I
see how CAS can acheive this, however CAS seems more of an administrative
tool than a development option. For a commercial product which will be
installed all over the place, I don't see how CAS can be a viable solution
unless CAS rules can be manipulated programmatically, or via our installer.
Would this be possible?

Thanks,

- Joseph Geretz -

"Patrick Steele" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> In article <(E-Mail Removed)>, "Alvin Bruney
> [MVP]" <some guy without an email address> says...
>> I'm not sure how and why you see CAS as preventing the access. Were you
>> thinking programmatically? The way I read the question seemed to imply it
>> was other than programmatically. Perhaps OP can clarify.

>
> To me, it sounded like he wanted to break his "utility functions" into a
> separate assembly, but only wanted his WinForms app to be able to access
> that assembly. The link I posted was to a similar question and showed
> how to use strong keys and attributes to control who could make calls
> into an assembly.
>
> But perhaps the OP could clarify exactly what they want?
>
> --
> Patrick Steele
> http://weblogs.asp.net/psteele



 
Reply With Quote
 
Patrick Steele
Guest
Posts: n/a
 
      16th Feb 2007
In article <(E-Mail Removed)>, (E-Mail Removed)
says...
> Hi Patrick,
>
> Yes, you state the case correctly; this is exactly what I'd like to do. I
> see how CAS can acheive this, however CAS seems more of an administrative
> tool than a development option. For a commercial product which will be
> installed all over the place, I don't see how CAS can be a viable solution
> unless CAS rules can be manipulated programmatically, or via our installer.
> Would this be possible?


I believe the link I posted suggested that you simply strong-name your
assemblies that want to call your utility assembly. Then, your utility
assembly methods (or maybe the whole assembly?) has an attribute to
demand a specific strong-name public key from all callers. Since only
your assemblies are signed with the proper key, they will be the only
ones allowed to call the utility assembly.

I don't think you'll need to manipulate any CAS rules for that.

--
Patrick Steele
http://weblogs.asp.net/psteele
 
Reply With Quote
 
Joseph Geretz
Guest
Posts: n/a
 
      18th Feb 2007
Thanks Patrick,

Yes, that article mentions StrongNameIdentityPermissionAttribute which will
do the trick for me. Further explanation at:
http://www.morganskinner.com/Article...ityPermission/

Thanks,

- Joe Geretz -

"Patrick Steele" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> In article <(E-Mail Removed)>, (E-Mail Removed)
> says...
>> Hi Patrick,
>>
>> Yes, you state the case correctly; this is exactly what I'd like to do. I
>> see how CAS can acheive this, however CAS seems more of an administrative
>> tool than a development option. For a commercial product which will be
>> installed all over the place, I don't see how CAS can be a viable
>> solution
>> unless CAS rules can be manipulated programmatically, or via our
>> installer.
>> Would this be possible?

>
> I believe the link I posted suggested that you simply strong-name your
> assemblies that want to call your utility assembly. Then, your utility
> assembly methods (or maybe the whole assembly?) has an attribute to
> demand a specific strong-name public key from all callers. Since only
> your assemblies are signed with the proper key, they will be the only
> ones allowed to call the utility assembly.
>
> I don't think you'll need to manipulate any CAS rules for that.
>
> --
> Patrick Steele
> http://weblogs.asp.net/psteele



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Create WinForms client and ClassLib server as one assembly? Joseph Geretz Microsoft Dot NET Framework 6 18th Feb 2007 08:43 PM
How to Create WinForms client and ClassLib server as one assembly? Joseph Geretz Microsoft Dot NET Framework Forms 6 18th Feb 2007 08:43 PM
Re: problem desploying winforms app using Assembly.LoadFrom Dmitriy Lapshin [C# / .NET MVP] Microsoft Dot NET Framework Forms 0 12th Feb 2004 09:06 AM
How to create a client server app Matt Microsoft VB .NET 3 10th Dec 2003 05:09 AM
Assembly for Client/Server AND Web Bob Microsoft Dot NET 1 10th Oct 2003 11:29 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:38 AM.