Red Gate forums :: View topic - Error using CryptoLicensing
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SmartAssembly 5
SmartAssembly 5 forum

Error using CryptoLicensing

Search in SmartAssembly 5 forum
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.
Jump to:  
Author Message
MidSilence



Joined: 25 Aug 2010
Posts: 5

PostPosted: Wed Aug 25, 2010 4:51 pm    Post subject: Error using CryptoLicensing Reply with quote

Hello!

I'm using CryptoLicensing with Smartassembly and I've got some errors.
In VS2008 design-time, referenced CryptoLicensing assembly works perfect and builds the project. I can see assembly details.
When using Smartassembly, it adds multiples assemblies in project as follows:

SA 4.2

Code:

<Assembly AssemblyName="LogicNP.CryptoLicensing, Culture=neutral, PublicKeyToken=4a3c0a4c668b48b4" />
<Assembly AssemblyName="">
    <Merging />
    <Embedding />
</Assembly>
<Assembly AssemblyName=", Culture=neutral, PublicKeyToken=null" />


SA 5.1

Code:
<Assembly AssemblyName="LogicNP.CryptoLicensing, Culture=neutral, PublicKeyToken=4a3c0a4c668b48b4">
    <Merging />
</Assembly>
<Assembly AssemblyName=", Culture=neutral, PublicKeyToken=null">
    <Merging />
</Assembly>


When I build SA project, I'got an invalid token accessing an enum from CryptoLicensing. I think SA is using the wrong assembly to build the project. I've tried the SA.com (command prompt) with no success.

Is there some way to force which assembly to use? Any ideas to solve this?

Thanks!
Back to top
View user's profile Send private message
Alex.Davies



Joined: 02 Dec 2008
Posts: 335
Location: Cambridge, uk

PostPosted: Thu Aug 26, 2010 11:32 am    Post subject: Reply with quote

Yes, it sounds like SA might be finding the wrong version of your assembly.

Try the latest EAP of SA 5.5, there have been lots of improvements in this area.
http://www.red-gate.com/MessageBoard/viewforum.php?f=116

If not, you can force which assembly to use using MandatoryPath. Details are here:
http://www.red-gate.com/supportcenter/Content.aspx?p=SmartAssembly&c=SmartAssembly/help/5.0/SA_SearchingForDependencies.htm&toc=SmartAssembly/help/5.0/toc1032210.htm
_________________
Alex
Developer,
Red Gate .NET Tools
Back to top
View user's profile Send private message
MidSilence



Joined: 25 Aug 2010
Posts: 5

PostPosted: Thu Aug 26, 2010 1:54 pm    Post subject: Reply with quote

Using MandatoryPath doesn't work.
What happened is that SA doesn't recognize CryptoLicensing assembly correctly (the assembly is already obfuscated). It always found the assembly with wrong name.

If I use MadatoryPath with the AssemblyName = "LogicNP.CryptoLicensing, Culture=neutral, PublicKeyToken=4a3c0a4c668b48b4" I've got an error saying that the path assembly is not the same as its name. But, if I use AssemblyName = ", Culture=neutral, PublicKeyToken=null" SA founds the assembly but doesn't compile.

Since SA always rescan the dependencies I can't change project file to force to use the correct name; it always change the project creating 2 or 3 items with worng names in the SA project as I said before.

I'm still looking for a solution for this.

Thanks!
Back to top
View user's profile Send private message
slaphead99



Joined: 10 Mar 2010
Posts: 93

PostPosted: Thu Aug 26, 2010 7:44 pm    Post subject: Reply with quote

I'm a little confused as to why you are processing these third party, obfuscated, assemblies? What happens if you do not apply any smartassembly features to the third party assemblies?
Back to top
View user's profile Send private message
MidSilence



Joined: 25 Aug 2010
Posts: 5

PostPosted: Thu Aug 26, 2010 8:37 pm    Post subject: Reply with quote

It's very simple.
Download CryptoLicensing (http://www.ssware.com/cryptolicensing/cryptolicensing_net.htm), install it, create an console project in Visual Studio and add the reference to LogicNP.CryptoLicensing.dll.

After, create a new SA 4/5 project and select the new console project .exe.
You'll see that SA 4/5 cannot read the CryptoLicensing assembly correctly, adding 3 assemblies in SA project file and show one empty item (item with no caption/text) on SA assembly dependencies list.

That's it.
Back to top
View user's profile Send private message
Alex.Davies



Joined: 02 Dec 2008
Posts: 335
Location: Cambridge, uk

PostPosted: Fri Aug 27, 2010 12:22 pm    Post subject: Reply with quote

The CryptoLicensing assembly is invalid. It has two Assembly metadata items.

The next EAP will read the first Assembly metadata item instead of the second, the same as the CLR does. This means that you can process your assembly.
_________________
Alex
Developer,
Red Gate .NET Tools
Back to top
View user's profile Send private message
MidSilence



Joined: 25 Aug 2010
Posts: 5

PostPosted: Fri Aug 27, 2010 1:23 pm    Post subject: Reply with quote

Thank you!
I'm waiting for the new EAP.
Sorry I didn't make myself clear in older posts.
Back to top
View user's profile Send private message
Display posts from previous:   
This topic is locked: you cannot edit posts or make replies. All times are GMT + 1 Hour
Page 1 of 1

 
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