Error using CryptoLicensing

MidSilenceMidSilence Posts: 7
edited August 27, 2010 8:23AM in SmartAssembly 5

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

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

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 (command prompt) with no success.

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



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

    If not, you can force which assembly to use using MandatoryPath. Details are here: ... 032210.htm
    Red Gate .NET Tools
  • 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.

  • 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?
  • It's very simple.
    Download CryptoLicensing ( ... 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.
  • 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.
    Red Gate .NET Tools
  • Thank you!
    I'm waiting for the new EAP.
    Sorry I didn't make myself clear in older posts.
Sign In or Register to comment.