Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Making included Infralution.Licensing.WPF classes private

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Infralution Support Forum Index -> Licensing FAQ
View previous topic :: View next topic  
Author Message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Wed Jan 06, 2016 10:45 pm    Post subject: Making included Infralution.Licensing.WPF classes private Reply with quote

By default when you include the source code for the Infralution.Licensing classes in your own project they not declared as public unless you define the ILS_PUBLIC_CLASS compilation constant. If you are building a component (DLL) this is desirable as it means the licensing classes are not accessible to your users (for applications it is not really important). Unfortunately in the WPF implementation this is difficult because the WPF XAML designer generates a hidden partial class and sets the access modifier to "public" by default. This means you will get compilation errors if you don't set ILS_PUBLIC_CLASS constant, because public classes are not allowed to have methods which use private types. For this reason the instructions for including the WPF source code in your own project recommend defining the ILS_PUBLIC_CLASS compilation constant.

If you are using ILS to license an assembly (DLL) then this may not be desirable and you can take the following steps to compile the licensing classes as internal (friend) to the assembly.

VB.NET
1. Remove the ILS_PUBLIC_CLASS compilation constant
2. Add the following attribute to the XAML Window declaration for each of the *.xaml files:
Code:
 x:ClassModifier="Friend"

3. Select the Project "Show all Files" option to ensure you can see the hidden designer files for the project
4. Expand the *.xaml and *.resx file nodes to show the dependent files
5. Remove the "Public" access modifiers from each of the classes in the *.xaml.vb, *.Designer.vb and *.ResourceWrapper.vb files

C#
1. Remove the ILS_PUBLIC_CLASS compilation constant
2. Add the following attribute to the XAML Window declaration for each of the *.xaml files:
Code:
 x:ClassModifier="internal"

3. Select the Project "Show all Files" option to ensure you can see the hidden designer files for the project
4. Expand the *.xaml and *.resx file nodes to show the dependent files
5. Remove the "public" access modifiers from each of the classes in the *.xaml.cs, *.Designer.cs and *.ResourceWrapper.cs files

The code should now build without errors and the classes will now be private to the assembly
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Infralution Support Forum Index -> Licensing FAQ All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group