Error using CryptoLicensing

.NET obfuscator and automated error reporting

Error using CryptoLicensing

Postby MidSilence » Wed Aug 25, 2010 4:51 pm

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: Select all
<Assembly AssemblyName="LogicNP.CryptoLicensing, Culture=neutral, PublicKeyToken=4a3c0a4c668b48b4" />
<Assembly AssemblyName="">
    <Merging />
    <Embedding />
</Assembly>
<Assembly AssemblyName=", Culture=neutral, PublicKeyToken=null" />


SA 5.1

Code: Select all
<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!
MidSilence
 
Posts: 5
Joined: Wed Aug 25, 2010 4:39 pm

Postby Alex.Davies » Thu Aug 26, 2010 11:32 am

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/vi ... .php?f=116

If not, you can force which assembly to use using MandatoryPath. Details are here:
http://www.red-gate.com/supportcenter/C ... 032210.htm
Alex
Developer,
Red Gate .NET Tools
Alex.Davies
 
Posts: 335
Joined: Tue Dec 02, 2008 12:23 pm
Location: Cambridge, uk

Postby MidSilence » Thu Aug 26, 2010 1:54 pm

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!
MidSilence
 
Posts: 5
Joined: Wed Aug 25, 2010 4:39 pm

Postby slaphead99 » Thu Aug 26, 2010 7:44 pm

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?
slaphead99
 
Posts: 92
Joined: Wed Mar 10, 2010 2:27 pm

Postby MidSilence » Thu Aug 26, 2010 8:37 pm

It's very simple.
Download CryptoLicensing (http://www.ssware.com/cryptolicensing/c ... ng_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.
MidSilence
 
Posts: 5
Joined: Wed Aug 25, 2010 4:39 pm

Postby Alex.Davies » Fri Aug 27, 2010 12:22 pm

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
Alex.Davies
 
Posts: 335
Joined: Tue Dec 02, 2008 12:23 pm
Location: Cambridge, uk

Postby MidSilence » Fri Aug 27, 2010 1:23 pm

Thank you!
I'm waiting for the new EAP.
Sorry I didn't make myself clear in older posts.
MidSilence
 
Posts: 5
Joined: Wed Aug 25, 2010 4:39 pm


Return to SmartAssembly 5

Who is online

Users browsing this forum: No registered users and 0 guests