Home All Groups Group Topic Archive Search About

Problem using obfuscation

Author
25 Jul 2006 7:44 AM
Usman Jamil
Hi

I'm working on a project that has multiple modules. Most of the modules
(windows services, Class libraries) are coded in C#. There are multiple
class libraries which use each other's classes too having refrence added in
them. To avoid exact code decompilation, I tried using obfuscation on all
the compiled libraries(dlls). But now when I run my project, it just crashes
since the obfuscation has renamed the classes inside those class libraries,
so where ever these classes are being refrenced, i'm getting exception.

What I had in mind was to compile all the code and in the end obfuscate all
the output assemblies and ship them. Does obfuscation works this way that
after obfuscating a dll we have to change the code with the name of updated
classes whereever its being refrenced or am I missing something.

Regards

Usman

Author
25 Jul 2006 8:14 AM
Marcello Cantelmo
> Hi

Hi Usman,

> I'm working on a project that has multiple modules. Most of the modules
> (windows services, Class libraries) are coded in C#. There are multiple
> class libraries which use each other's classes too having refrence added
> in them. To avoid exact code decompilation, I tried using obfuscation on
> all the compiled libraries(dlls). But now when I run my project, it just
> crashes since the obfuscation has renamed the classes inside those class
> libraries, so where ever these classes are being refrenced, i'm getting
> exception.


very strange! if the classes are public do not have to be renamed! the
public field must be always visible.

> What I had in mind was to compile all the code and in the end obfuscate
> all the output assemblies and ship them. Does obfuscation works this way
> that after obfuscating a dll we have to change the code with the name of
> updated classes whereever its being refrenced or am I missing something.
>

you make use of reflection?

> Regards
>
> Usman

best regards,
Marcello Cantelmo
www.cantelmosoftware.com
Author
26 Jul 2006 11:38 AM
Usman Jamil
Hi Marcello

I'm using obfuscation for the first time, so not sure how to use it
properly. May be I'm missing something. What should be done if I have to
obfuscate multiple assemblies which are using each other's public classes.
Currently obfuscation would rename the public/private classes of my
assemblies and I guess this is the reason that crashes the
assemblies/applications that are using them.

I'm not aware of reflection. If its a solution, can u please explain it.

Regards

Usman

Show quoteHide quote
"Marcello Cantelmo" <marce***@cantelmosoftware.com> wrote in message
news:ec8ppJ8rGHA.2124@TK2MSFTNGP03.phx.gbl...
>> Hi
>
> Hi Usman,
>
>> I'm working on a project that has multiple modules. Most of the modules
>> (windows services, Class libraries) are coded in C#. There are multiple
>> class libraries which use each other's classes too having refrence added
>> in them. To avoid exact code decompilation, I tried using obfuscation on
>> all the compiled libraries(dlls). But now when I run my project, it just
>> crashes since the obfuscation has renamed the classes inside those class
>> libraries, so where ever these classes are being refrenced, i'm getting
>> exception.
>
>
> very strange! if the classes are public do not have to be renamed! the
> public field must be always visible.
>
>> What I had in mind was to compile all the code and in the end obfuscate
>> all the output assemblies and ship them. Does obfuscation works this way
>> that after obfuscating a dll we have to change the code with the name of
>> updated classes whereever its being refrenced or am I missing something.
>>
>
> you make use of reflection?
>
>> Regards
>>
>> Usman
>
> best regards,
> Marcello Cantelmo
> www.cantelmosoftware.com
>
>
Author
26 Jul 2006 12:58 PM
Nicole Calinoiu
"Usman Jamil" <us***@advcomm.net> wrote in message
news:OnihjgKsGHA.5100@TK2MSFTNGP06.phx.gbl...
> Hi Marcello
>
> I'm using obfuscation for the first time, so not sure how to use it
> properly. May be I'm missing something. What should be done if I have to
> obfuscate multiple assemblies which are using each other's public classes.

You would usually obfuscate the entire set of dependant assemblies together
as a group.  Different obfuscators have different capabilities with respect
to tracking renamings and applying them after an initial obfuscation run
(for example, when upgrading only one assembly from an obfuscated set).
Your obfuscator's documentation and/or support forums would probably be the
best source of information on the product-specific details.


> Currently obfuscation would rename the public/private classes of my
> assemblies and I guess this is the reason that crashes the
> assemblies/applications that are using them.

Are you obfuscating the assemblies one-by-one, or together in a single
obfuscation run?


> I'm not aware of reflection. If its a solution, can u please explain it.

It's not a solution--it's an additional problem which you may or may not be
encountering.  The main issue with reflection is that it references types
and members by name at runtime, and most (all?) obfuscators do not
accomodate this.  If you are using reflection (or taking advantage of
built-in framework code that uses reflection), you would usually need to
manually omit from obfuscation the types and/or members that are used via
reflection.


Show quoteHide quote
>
> Regards
>
> Usman
>
> "Marcello Cantelmo" <marce***@cantelmosoftware.com> wrote in message
> news:ec8ppJ8rGHA.2124@TK2MSFTNGP03.phx.gbl...
>>> Hi
>>
>> Hi Usman,
>>
>>> I'm working on a project that has multiple modules. Most of the modules
>>> (windows services, Class libraries) are coded in C#. There are multiple
>>> class libraries which use each other's classes too having refrence added
>>> in them. To avoid exact code decompilation, I tried using obfuscation on
>>> all the compiled libraries(dlls). But now when I run my project, it just
>>> crashes since the obfuscation has renamed the classes inside those class
>>> libraries, so where ever these classes are being refrenced, i'm getting
>>> exception.
>>
>>
>> very strange! if the classes are public do not have to be renamed! the
>> public field must be always visible.
>>
>>> What I had in mind was to compile all the code and in the end obfuscate
>>> all the output assemblies and ship them. Does obfuscation works this way
>>> that after obfuscating a dll we have to change the code with the name of
>>> updated classes whereever its being refrenced or am I missing something.
>>>
>>
>> you make use of reflection?
>>
>>> Regards
>>>
>>> Usman
>>
>> best regards,
>> Marcello Cantelmo
>> www.cantelmosoftware.com
>>
>>
>
>
Author
27 Jul 2006 3:16 PM
Usman Jamil
Hi Nicole

I'm using Dotfuscator that comes along with the Visual studio.Net. and yes
I've made a single dotfuscator project and obfuscating all the assemblies in
a single go, i.e I first compile all the code and then run dotfuscator on
all of them. I suppose this should be the correct way.Also I'm not using
reflection anywhere in my code.

For checking I created a Test .Net Class library and used it in a .Net
console application. It ran fine when the exe was run with the original
class library (dll). But when I placed the obfuscated dll, the console
application crashed with the TypeLoadException exception with description as
unable to locate that class in that dll of which I had created an object in
console application.

Hope you can try simmilarly with your dotfuscator tool. Also note that I'm
not using the professional or purchased version of dotfuscator instead using
community edition that comes free with Visual studio.Net

Regards

Usman Jamil

Show quoteHide quote
"Nicole Calinoiu" <calinoiu REMOVETHIS AT gmail DOT com> wrote in message
news:3B66CE26-21D2-4CE4-A8AD-CFBCCD8CB428@microsoft.com...
> "Usman Jamil" <us***@advcomm.net> wrote in message
> news:OnihjgKsGHA.5100@TK2MSFTNGP06.phx.gbl...
>> Hi Marcello
>>
>> I'm using obfuscation for the first time, so not sure how to use it
>> properly. May be I'm missing something. What should be done if I have to
>> obfuscate multiple assemblies which are using each other's public
>> classes.
>
> You would usually obfuscate the entire set of dependant assemblies
> together as a group.  Different obfuscators have different capabilities
> with respect to tracking renamings and applying them after an initial
> obfuscation run (for example, when upgrading only one assembly from an
> obfuscated set). Your obfuscator's documentation and/or support forums
> would probably be the best source of information on the product-specific
> details.
>
>
>> Currently obfuscation would rename the public/private classes of my
>> assemblies and I guess this is the reason that crashes the
>> assemblies/applications that are using them.
>
> Are you obfuscating the assemblies one-by-one, or together in a single
> obfuscation run?
>
>
>> I'm not aware of reflection. If its a solution, can u please explain it.
>
> It's not a solution--it's an additional problem which you may or may not
> be encountering.  The main issue with reflection is that it references
> types and members by name at runtime, and most (all?) obfuscators do not
> accomodate this.  If you are using reflection (or taking advantage of
> built-in framework code that uses reflection), you would usually need to
> manually omit from obfuscation the types and/or members that are used via
> reflection.
>
>
>>
>> Regards
>>
>> Usman
>>
>> "Marcello Cantelmo" <marce***@cantelmosoftware.com> wrote in message
>> news:ec8ppJ8rGHA.2124@TK2MSFTNGP03.phx.gbl...
>>>> Hi
>>>
>>> Hi Usman,
>>>
>>>> I'm working on a project that has multiple modules. Most of the modules
>>>> (windows services, Class libraries) are coded in C#. There are multiple
>>>> class libraries which use each other's classes too having refrence
>>>> added in them. To avoid exact code decompilation, I tried using
>>>> obfuscation on all the compiled libraries(dlls). But now when I run my
>>>> project, it just crashes since the obfuscation has renamed the classes
>>>> inside those class libraries, so where ever these classes are being
>>>> refrenced, i'm getting exception.
>>>
>>>
>>> very strange! if the classes are public do not have to be renamed! the
>>> public field must be always visible.
>>>
>>>> What I had in mind was to compile all the code and in the end obfuscate
>>>> all the output assemblies and ship them. Does obfuscation works this
>>>> way that after obfuscating a dll we have to change the code with the
>>>> name of updated classes whereever its being refrenced or am I missing
>>>> something.
>>>>
>>>
>>> you make use of reflection?
>>>
>>>> Regards
>>>>
>>>> Usman
>>>
>>> best regards,
>>> Marcello Cantelmo
>>> www.cantelmosoftware.com
>>>
>>>
>>
>>
>
Author
27 Jul 2006 7:16 PM
Nicole Calinoiu
Are you including the executable assembly in your obfuscation run?

Show quoteHide quote
"Usman Jamil" <us***@advcomm.net> wrote in message
news:OrHKY%23YsGHA.3496@TK2MSFTNGP06.phx.gbl...
> Hi Nicole
>
> I'm using Dotfuscator that comes along with the Visual studio.Net. and yes
> I've made a single dotfuscator project and obfuscating all the assemblies
> in
> a single go, i.e I first compile all the code and then run dotfuscator on
> all of them. I suppose this should be the correct way.Also I'm not using
> reflection anywhere in my code.
>
> For checking I created a Test .Net Class library and used it in a .Net
> console application. It ran fine when the exe was run with the original
> class library (dll). But when I placed the obfuscated dll, the console
> application crashed with the TypeLoadException exception with description
> as unable to locate that class in that dll of which I had created an
> object in console application.
>
> Hope you can try simmilarly with your dotfuscator tool. Also note that I'm
> not using the professional or purchased version of dotfuscator instead
> using community edition that comes free with Visual studio.Net
>
> Regards
>
> Usman Jamil
>
> "Nicole Calinoiu" <calinoiu REMOVETHIS AT gmail DOT com> wrote in message
> news:3B66CE26-21D2-4CE4-A8AD-CFBCCD8CB428@microsoft.com...
>> "Usman Jamil" <us***@advcomm.net> wrote in message
>> news:OnihjgKsGHA.5100@TK2MSFTNGP06.phx.gbl...
>>> Hi Marcello
>>>
>>> I'm using obfuscation for the first time, so not sure how to use it
>>> properly. May be I'm missing something. What should be done if I have to
>>> obfuscate multiple assemblies which are using each other's public
>>> classes.
>>
>> You would usually obfuscate the entire set of dependant assemblies
>> together as a group.  Different obfuscators have different capabilities
>> with respect to tracking renamings and applying them after an initial
>> obfuscation run (for example, when upgrading only one assembly from an
>> obfuscated set). Your obfuscator's documentation and/or support forums
>> would probably be the best source of information on the product-specific
>> details.
>>
>>
>>> Currently obfuscation would rename the public/private classes of my
>>> assemblies and I guess this is the reason that crashes the
>>> assemblies/applications that are using them.
>>
>> Are you obfuscating the assemblies one-by-one, or together in a single
>> obfuscation run?
>>
>>
>>> I'm not aware of reflection. If its a solution, can u please explain it.
>>
>> It's not a solution--it's an additional problem which you may or may not
>> be encountering.  The main issue with reflection is that it references
>> types and members by name at runtime, and most (all?) obfuscators do not
>> accomodate this.  If you are using reflection (or taking advantage of
>> built-in framework code that uses reflection), you would usually need to
>> manually omit from obfuscation the types and/or members that are used via
>> reflection.
>>
>>
>>>
>>> Regards
>>>
>>> Usman
>>>
>>> "Marcello Cantelmo" <marce***@cantelmosoftware.com> wrote in message
>>> news:ec8ppJ8rGHA.2124@TK2MSFTNGP03.phx.gbl...
>>>>> Hi
>>>>
>>>> Hi Usman,
>>>>
>>>>> I'm working on a project that has multiple modules. Most of the
>>>>> modules
>>>>> (windows services, Class libraries) are coded in C#. There are
>>>>> multiple
>>>>> class libraries which use each other's classes too having refrence
>>>>> added in them. To avoid exact code decompilation, I tried using
>>>>> obfuscation on all the compiled libraries(dlls). But now when I run my
>>>>> project, it just crashes since the obfuscation has renamed the classes
>>>>> inside those class libraries, so where ever these classes are being
>>>>> refrenced, i'm getting exception.
>>>>
>>>>
>>>> very strange! if the classes are public do not have to be renamed! the
>>>> public field must be always visible.
>>>>
>>>>> What I had in mind was to compile all the code and in the end
>>>>> obfuscate
>>>>> all the output assemblies and ship them. Does obfuscation works this
>>>>> way that after obfuscating a dll we have to change the code with the
>>>>> name of updated classes whereever its being refrenced or am I missing
>>>>> something.
>>>>>
>>>>
>>>> you make use of reflection?
>>>>
>>>>> Regards
>>>>>
>>>>> Usman
>>>>
>>>> best regards,
>>>> Marcello Cantelmo
>>>> www.cantelmosoftware.com
>>>>
>>>>
>>>
>>>
>>
>
>
>
Author
28 Jul 2006 9:09 AM
Usman Jamil
I've tested it with following combinations. Consider there's a class library
with output as Helper.dll and a console application using its classes named
TestApp.exe.

1. I obfusacted the Helper.dll and tried running it with the original
TestApp.exe. It failed with error TypeloadException.
2. I obfuscated the Helper.dll and TestApp.exe both and again it failed with
error TypeloadException.
3. I only obfuscated the TestApp.exe and kept the Helper.dll without
obfuscation. The application TestApp.exe ran without any error.

In my scenario I need both Helper.dll and TestApp.exe to be obfuscated as
both contain code that I need to make complicated for decompilers. Is it
possible.

Regards

Usman

Show quoteHide quote
"Nicole Calinoiu" <calinoiu REMOVETHIS AT gmail DOT com> wrote in message
news:058BCE61-D19C-4534-BFA1-2B92F5B963A8@microsoft.com...
> Are you including the executable assembly in your obfuscation run?
>
> "Usman Jamil" <us***@advcomm.net> wrote in message
> news:OrHKY%23YsGHA.3496@TK2MSFTNGP06.phx.gbl...
>> Hi Nicole
>>
>> I'm using Dotfuscator that comes along with the Visual studio.Net. and
>> yes
>> I've made a single dotfuscator project and obfuscating all the assemblies
>> in
>> a single go, i.e I first compile all the code and then run dotfuscator on
>> all of them. I suppose this should be the correct way.Also I'm not using
>> reflection anywhere in my code.
>>
>> For checking I created a Test .Net Class library and used it in a .Net
>> console application. It ran fine when the exe was run with the original
>> class library (dll). But when I placed the obfuscated dll, the console
>> application crashed with the TypeLoadException exception with description
>> as unable to locate that class in that dll of which I had created an
>> object in console application.
>>
>> Hope you can try simmilarly with your dotfuscator tool. Also note that
>> I'm not using the professional or purchased version of dotfuscator
>> instead using community edition that comes free with Visual studio.Net
>>
>> Regards
>>
>> Usman Jamil
>>
>> "Nicole Calinoiu" <calinoiu REMOVETHIS AT gmail DOT com> wrote in message
>> news:3B66CE26-21D2-4CE4-A8AD-CFBCCD8CB428@microsoft.com...
>>> "Usman Jamil" <us***@advcomm.net> wrote in message
>>> news:OnihjgKsGHA.5100@TK2MSFTNGP06.phx.gbl...
>>>> Hi Marcello
>>>>
>>>> I'm using obfuscation for the first time, so not sure how to use it
>>>> properly. May be I'm missing something. What should be done if I have
>>>> to
>>>> obfuscate multiple assemblies which are using each other's public
>>>> classes.
>>>
>>> You would usually obfuscate the entire set of dependant assemblies
>>> together as a group.  Different obfuscators have different capabilities
>>> with respect to tracking renamings and applying them after an initial
>>> obfuscation run (for example, when upgrading only one assembly from an
>>> obfuscated set). Your obfuscator's documentation and/or support forums
>>> would probably be the best source of information on the product-specific
>>> details.
>>>
>>>
>>>> Currently obfuscation would rename the public/private classes of my
>>>> assemblies and I guess this is the reason that crashes the
>>>> assemblies/applications that are using them.
>>>
>>> Are you obfuscating the assemblies one-by-one, or together in a single
>>> obfuscation run?
>>>
>>>
>>>> I'm not aware of reflection. If its a solution, can u please explain
>>>> it.
>>>
>>> It's not a solution--it's an additional problem which you may or may not
>>> be encountering.  The main issue with reflection is that it references
>>> types and members by name at runtime, and most (all?) obfuscators do not
>>> accomodate this.  If you are using reflection (or taking advantage of
>>> built-in framework code that uses reflection), you would usually need to
>>> manually omit from obfuscation the types and/or members that are used
>>> via
>>> reflection.
>>>
>>>
>>>>
>>>> Regards
>>>>
>>>> Usman
>>>>
>>>> "Marcello Cantelmo" <marce***@cantelmosoftware.com> wrote in message
>>>> news:ec8ppJ8rGHA.2124@TK2MSFTNGP03.phx.gbl...
>>>>>> Hi
>>>>>
>>>>> Hi Usman,
>>>>>
>>>>>> I'm working on a project that has multiple modules. Most of the
>>>>>> modules
>>>>>> (windows services, Class libraries) are coded in C#. There are
>>>>>> multiple
>>>>>> class libraries which use each other's classes too having refrence
>>>>>> added in them. To avoid exact code decompilation, I tried using
>>>>>> obfuscation on all the compiled libraries(dlls). But now when I run
>>>>>> my
>>>>>> project, it just crashes since the obfuscation has renamed the
>>>>>> classes
>>>>>> inside those class libraries, so where ever these classes are being
>>>>>> refrenced, i'm getting exception.
>>>>>
>>>>>
>>>>> very strange! if the classes are public do not have to be renamed! the
>>>>> public field must be always visible.
>>>>>
>>>>>> What I had in mind was to compile all the code and in the end
>>>>>> obfuscate
>>>>>> all the output assemblies and ship them. Does obfuscation works this
>>>>>> way that after obfuscating a dll we have to change the code with the
>>>>>> name of updated classes whereever its being refrenced or am I missing
>>>>>> something.
>>>>>>
>>>>>
>>>>> you make use of reflection?
>>>>>
>>>>>> Regards
>>>>>>
>>>>>> Usman
>>>>>
>>>>> best regards,
>>>>> Marcello Cantelmo
>>>>> www.cantelmosoftware.com
>>>>>
>>>>>
>>>>
>>>>
>>>
>>
>>
>>
>
Author
28 Jul 2006 11:01 AM
Nicole Calinoiu
Scenario 2 should work.  Are any of your assemblies strongly named?  Also,
might you be able to provide the complete details of the TypeLoadException?


Show quoteHide quote
"Usman Jamil" <us***@advcomm.net> wrote in message
news:es3h$VisGHA.4748@TK2MSFTNGP03.phx.gbl...
> I've tested it with following combinations. Consider there's a class
> library with output as Helper.dll and a console application using its
> classes named TestApp.exe.
>
> 1. I obfusacted the Helper.dll and tried running it with the original
> TestApp.exe. It failed with error TypeloadException.
> 2. I obfuscated the Helper.dll and TestApp.exe both and again it failed
> with error TypeloadException.
> 3. I only obfuscated the TestApp.exe and kept the Helper.dll without
> obfuscation. The application TestApp.exe ran without any error.
>
> In my scenario I need both Helper.dll and TestApp.exe to be obfuscated as
> both contain code that I need to make complicated for decompilers. Is it
> possible.
>
> Regards
>
> Usman
>
> "Nicole Calinoiu" <calinoiu REMOVETHIS AT gmail DOT com> wrote in message
> news:058BCE61-D19C-4534-BFA1-2B92F5B963A8@microsoft.com...
>> Are you including the executable assembly in your obfuscation run?
>>
>> "Usman Jamil" <us***@advcomm.net> wrote in message
>> news:OrHKY%23YsGHA.3496@TK2MSFTNGP06.phx.gbl...
>>> Hi Nicole
>>>
>>> I'm using Dotfuscator that comes along with the Visual studio.Net. and
>>> yes
>>> I've made a single dotfuscator project and obfuscating all the
>>> assemblies in
>>> a single go, i.e I first compile all the code and then run dotfuscator
>>> on
>>> all of them. I suppose this should be the correct way.Also I'm not using
>>> reflection anywhere in my code.
>>>
>>> For checking I created a Test .Net Class library and used it in a .Net
>>> console application. It ran fine when the exe was run with the original
>>> class library (dll). But when I placed the obfuscated dll, the console
>>> application crashed with the TypeLoadException exception with
>>> description as unable to locate that class in that dll of which I had
>>> created an object in console application.
>>>
>>> Hope you can try simmilarly with your dotfuscator tool. Also note that
>>> I'm not using the professional or purchased version of dotfuscator
>>> instead using community edition that comes free with Visual studio.Net
>>>
>>> Regards
>>>
>>> Usman Jamil
>>>
>>> "Nicole Calinoiu" <calinoiu REMOVETHIS AT gmail DOT com> wrote in
>>> message
>>> news:3B66CE26-21D2-4CE4-A8AD-CFBCCD8CB428@microsoft.com...
>>>> "Usman Jamil" <us***@advcomm.net> wrote in message
>>>> news:OnihjgKsGHA.5100@TK2MSFTNGP06.phx.gbl...
>>>>> Hi Marcello
>>>>>
>>>>> I'm using obfuscation for the first time, so not sure how to use it
>>>>> properly. May be I'm missing something. What should be done if I have
>>>>> to
>>>>> obfuscate multiple assemblies which are using each other's public
>>>>> classes.
>>>>
>>>> You would usually obfuscate the entire set of dependant assemblies
>>>> together as a group.  Different obfuscators have different capabilities
>>>> with respect to tracking renamings and applying them after an initial
>>>> obfuscation run (for example, when upgrading only one assembly from an
>>>> obfuscated set). Your obfuscator's documentation and/or support forums
>>>> would probably be the best source of information on the
>>>> product-specific
>>>> details.
>>>>
>>>>
>>>>> Currently obfuscation would rename the public/private classes of my
>>>>> assemblies and I guess this is the reason that crashes the
>>>>> assemblies/applications that are using them.
>>>>
>>>> Are you obfuscating the assemblies one-by-one, or together in a single
>>>> obfuscation run?
>>>>
>>>>
>>>>> I'm not aware of reflection. If its a solution, can u please explain
>>>>> it.
>>>>
>>>> It's not a solution--it's an additional problem which you may or may
>>>> not
>>>> be encountering.  The main issue with reflection is that it references
>>>> types and members by name at runtime, and most (all?) obfuscators do
>>>> not
>>>> accomodate this.  If you are using reflection (or taking advantage of
>>>> built-in framework code that uses reflection), you would usually need
>>>> to
>>>> manually omit from obfuscation the types and/or members that are used
>>>> via
>>>> reflection.
>>>>
>>>>
>>>>>
>>>>> Regards
>>>>>
>>>>> Usman
>>>>>
>>>>> "Marcello Cantelmo" <marce***@cantelmosoftware.com> wrote in message
>>>>> news:ec8ppJ8rGHA.2124@TK2MSFTNGP03.phx.gbl...
>>>>>>> Hi
>>>>>>
>>>>>> Hi Usman,
>>>>>>
>>>>>>> I'm working on a project that has multiple modules. Most of the
>>>>>>> modules
>>>>>>> (windows services, Class libraries) are coded in C#. There are
>>>>>>> multiple
>>>>>>> class libraries which use each other's classes too having refrence
>>>>>>> added in them. To avoid exact code decompilation, I tried using
>>>>>>> obfuscation on all the compiled libraries(dlls). But now when I run
>>>>>>> my
>>>>>>> project, it just crashes since the obfuscation has renamed the
>>>>>>> classes
>>>>>>> inside those class libraries, so where ever these classes are being
>>>>>>> refrenced, i'm getting exception.
>>>>>>
>>>>>>
>>>>>> very strange! if the classes are public do not have to be renamed!
>>>>>> the
>>>>>> public field must be always visible.
>>>>>>
>>>>>>> What I had in mind was to compile all the code and in the end
>>>>>>> obfuscate
>>>>>>> all the output assemblies and ship them. Does obfuscation works this
>>>>>>> way that after obfuscating a dll we have to change the code with the
>>>>>>> name of updated classes whereever its being refrenced or am I
>>>>>>> missing
>>>>>>> something.
>>>>>>>
>>>>>>
>>>>>> you make use of reflection?
>>>>>>
>>>>>>> Regards
>>>>>>>
>>>>>>> Usman
>>>>>>
>>>>>> best regards,
>>>>>> Marcello Cantelmo
>>>>>> www.cantelmosoftware.com
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>>
>>>
>>
>
>
Author
29 Jul 2006 10:16 AM
Usman Jamil
Hi Nicole

Thanx for your help. Its working now. I dont know what I was doing wrong but
I created fresh obfuscation project, included all the assemblies in an order
in which they were being used by each other and it worked fine with the test
application. I really appreciate your help.

Just one problem I'm having now with the whole application obfuscated and
running in actual environment. Actually my assemblies are interlinked in a
strange manner perhaps thats why I'm having problems. Let me put the actual
picture here.

I have a class library named Helper.dll, a remoting shared library
Remoting.dll, an ASP.Net web project assembly WebProj.dll and a few .Net
windows services exes. Now they are using each other in this manner.

1. Helper.dll is being used by Remtoing.dll
2. WebProj.dll is using both Remoting.dll and Helper.dll
3. .Net Windows services are using all three dlls mentioned above.

By using I mean the dlls are added in the refrences. I added all in an
obfuscation project and obfuscated all the 3 dlls and my service exes. I
replaced the obfuscated output assemblies in the actual folder and tried to
run the WebProject from IIS and got following exception.

--------------------------------------------------------------------------------------------------
Server Error in '/' Application.
--------------------------------------------------------------------------------

Parser Error
Description: An error occurred during the parsing of a resource required to
service this request. Please review the following specific parse error
details and modify your source file appropriately.

Parser Error Message: Could not load type WebProj.Global'.

Source Error:

Line 1:  <%@ Application Codebehind="Global.asax.cs"
Inherits="WebProj.Global" %>



Source File: /global.asax    Line: 1


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET
Version:2.0.50727.42
---------------------------------------------------------------------------------------------------

Do I have to obfuscate these aspx.cs files also that are using the
codebehind tag to refer to the classes that were originally in WebProj.dll.
If yes then how.

Thanx and Regards

Usman


Show quoteHide quote
"Nicole Calinoiu" <calinoiu REMOVETHIS AT gmail DOT com> wrote in message
news:2A454172-8F42-49EE-B3DD-1C924015F498@microsoft.com...
> Scenario 2 should work.  Are any of your assemblies strongly named?  Also,
> might you be able to provide the complete details of the
> TypeLoadException?
>
>
> "Usman Jamil" <us***@advcomm.net> wrote in message
> news:es3h$VisGHA.4748@TK2MSFTNGP03.phx.gbl...
>> I've tested it with following combinations. Consider there's a class
>> library with output as Helper.dll and a console application using its
>> classes named TestApp.exe.
>>
>> 1. I obfusacted the Helper.dll and tried running it with the original
>> TestApp.exe. It failed with error TypeloadException.
>> 2. I obfuscated the Helper.dll and TestApp.exe both and again it failed
>> with error TypeloadException.
>> 3. I only obfuscated the TestApp.exe and kept the Helper.dll without
>> obfuscation. The application TestApp.exe ran without any error.
>>
>> In my scenario I need both Helper.dll and TestApp.exe to be obfuscated as
>> both contain code that I need to make complicated for decompilers. Is it
>> possible.
>>
>> Regards
>>
>> Usman
>>
>> "Nicole Calinoiu" <calinoiu REMOVETHIS AT gmail DOT com> wrote in message
>> news:058BCE61-D19C-4534-BFA1-2B92F5B963A8@microsoft.com...
>>> Are you including the executable assembly in your obfuscation run?
>>>
>>> "Usman Jamil" <us***@advcomm.net> wrote in message
>>> news:OrHKY%23YsGHA.3496@TK2MSFTNGP06.phx.gbl...
>>>> Hi Nicole
>>>>
>>>> I'm using Dotfuscator that comes along with the Visual studio.Net. and
>>>> yes
>>>> I've made a single dotfuscator project and obfuscating all the
>>>> assemblies in
>>>> a single go, i.e I first compile all the code and then run dotfuscator
>>>> on
>>>> all of them. I suppose this should be the correct way.Also I'm not
>>>> using
>>>> reflection anywhere in my code.
>>>>
>>>> For checking I created a Test .Net Class library and used it in a .Net
>>>> console application. It ran fine when the exe was run with the original
>>>> class library (dll). But when I placed the obfuscated dll, the console
>>>> application crashed with the TypeLoadException exception with
>>>> description as unable to locate that class in that dll of which I had
>>>> created an object in console application.
>>>>
>>>> Hope you can try simmilarly with your dotfuscator tool. Also note that
>>>> I'm not using the professional or purchased version of dotfuscator
>>>> instead using community edition that comes free with Visual studio.Net
>>>>
>>>> Regards
>>>>
>>>> Usman Jamil
>>>>
>>>> "Nicole Calinoiu" <calinoiu REMOVETHIS AT gmail DOT com> wrote in
>>>> message
>>>> news:3B66CE26-21D2-4CE4-A8AD-CFBCCD8CB428@microsoft.com...
>>>>> "Usman Jamil" <us***@advcomm.net> wrote in message
>>>>> news:OnihjgKsGHA.5100@TK2MSFTNGP06.phx.gbl...
>>>>>> Hi Marcello
>>>>>>
>>>>>> I'm using obfuscation for the first time, so not sure how to use it
>>>>>> properly. May be I'm missing something. What should be done if I have
>>>>>> to
>>>>>> obfuscate multiple assemblies which are using each other's public
>>>>>> classes.
>>>>>
>>>>> You would usually obfuscate the entire set of dependant assemblies
>>>>> together as a group.  Different obfuscators have different
>>>>> capabilities
>>>>> with respect to tracking renamings and applying them after an initial
>>>>> obfuscation run (for example, when upgrading only one assembly from an
>>>>> obfuscated set). Your obfuscator's documentation and/or support forums
>>>>> would probably be the best source of information on the
>>>>> product-specific
>>>>> details.
>>>>>
>>>>>
>>>>>> Currently obfuscation would rename the public/private classes of my
>>>>>> assemblies and I guess this is the reason that crashes the
>>>>>> assemblies/applications that are using them.
>>>>>
>>>>> Are you obfuscating the assemblies one-by-one, or together in a single
>>>>> obfuscation run?
>>>>>
>>>>>
>>>>>> I'm not aware of reflection. If its a solution, can u please explain
>>>>>> it.
>>>>>
>>>>> It's not a solution--it's an additional problem which you may or may
>>>>> not
>>>>> be encountering.  The main issue with reflection is that it references
>>>>> types and members by name at runtime, and most (all?) obfuscators do
>>>>> not
>>>>> accomodate this.  If you are using reflection (or taking advantage of
>>>>> built-in framework code that uses reflection), you would usually need
>>>>> to
>>>>> manually omit from obfuscation the types and/or members that are used
>>>>> via
>>>>> reflection.
>>>>>
>>>>>
>>>>>>
>>>>>> Regards
>>>>>>
>>>>>> Usman
>>>>>>
>>>>>> "Marcello Cantelmo" <marce***@cantelmosoftware.com> wrote in message
>>>>>> news:ec8ppJ8rGHA.2124@TK2MSFTNGP03.phx.gbl...
>>>>>>>> Hi
>>>>>>>
>>>>>>> Hi Usman,
>>>>>>>
>>>>>>>> I'm working on a project that has multiple modules. Most of the
>>>>>>>> modules
>>>>>>>> (windows services, Class libraries) are coded in C#. There are
>>>>>>>> multiple
>>>>>>>> class libraries which use each other's classes too having refrence
>>>>>>>> added in them. To avoid exact code decompilation, I tried using
>>>>>>>> obfuscation on all the compiled libraries(dlls). But now when I run
>>>>>>>> my
>>>>>>>> project, it just crashes since the obfuscation has renamed the
>>>>>>>> classes
>>>>>>>> inside those class libraries, so where ever these classes are being
>>>>>>>> refrenced, i'm getting exception.
>>>>>>>
>>>>>>>
>>>>>>> very strange! if the classes are public do not have to be renamed!
>>>>>>> the
>>>>>>> public field must be always visible.
>>>>>>>
>>>>>>>> What I had in mind was to compile all the code and in the end
>>>>>>>> obfuscate
>>>>>>>> all the output assemblies and ship them. Does obfuscation works
>>>>>>>> this
>>>>>>>> way that after obfuscating a dll we have to change the code with
>>>>>>>> the
>>>>>>>> name of updated classes whereever its being refrenced or am I
>>>>>>>> missing
>>>>>>>> something.
>>>>>>>>
>>>>>>>
>>>>>>> you make use of reflection?
>>>>>>>
>>>>>>>> Regards
>>>>>>>>
>>>>>>>> Usman
>>>>>>>
>>>>>>> best regards,
>>>>>>> Marcello Cantelmo
>>>>>>> www.cantelmosoftware.com
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>
>>
>>
>
Author
29 Jul 2006 1:07 PM
Nicole Calinoiu
You'll need to exclude your WebProject.Global class from obfuscation in
order to avoid this problem.  IIRC, there's an entire tab dedicated to
exclusions in the Dotfuscator UI, but you might just want to check the
documentation if  you can't find how to set the exclusion.



Show quoteHide quote
"Usman Jamil" <us***@advcomm.net> wrote in message
news:%236VEexvsGHA.1632@TK2MSFTNGP06.phx.gbl...
> Hi Nicole
>
> Thanx for your help. Its working now. I dont know what I was doing wrong
> but I created fresh obfuscation project, included all the assemblies in an
> order in which they were being used by each other and it worked fine with
> the test application. I really appreciate your help.
>
> Just one problem I'm having now with the whole application obfuscated and
> running in actual environment. Actually my assemblies are interlinked in a
> strange manner perhaps thats why I'm having problems. Let me put the
> actual picture here.
>
> I have a class library named Helper.dll, a remoting shared library
> Remoting.dll, an ASP.Net web project assembly WebProj.dll and a few .Net
> windows services exes. Now they are using each other in this manner.
>
> 1. Helper.dll is being used by Remtoing.dll
> 2. WebProj.dll is using both Remoting.dll and Helper.dll
> 3. .Net Windows services are using all three dlls mentioned above.
>
> By using I mean the dlls are added in the refrences. I added all in an
> obfuscation project and obfuscated all the 3 dlls and my service exes. I
> replaced the obfuscated output assemblies in the actual folder and tried
> to run the WebProject from IIS and got following exception.
>
> --------------------------------------------------------------------------------------------------
> Server Error in '/' Application.
> --------------------------------------------------------------------------------
>
> Parser Error
> Description: An error occurred during the parsing of a resource required
> to service this request. Please review the following specific parse error
> details and modify your source file appropriately.
>
> Parser Error Message: Could not load type WebProj.Global'.
>
> Source Error:
>
> Line 1:  <%@ Application Codebehind="Global.asax.cs"
> Inherits="WebProj.Global" %>
>
>
>
> Source File: /global.asax    Line: 1
>
>
> --------------------------------------------------------------------------------
> Version Information: Microsoft .NET Framework Version:2.0.50727.42;
> ASP.NET Version:2.0.50727.42
> ---------------------------------------------------------------------------------------------------
>
> Do I have to obfuscate these aspx.cs files also that are using the
> codebehind tag to refer to the classes that were originally in
> WebProj.dll. If yes then how.
>
> Thanx and Regards
>
> Usman
>
>
> "Nicole Calinoiu" <calinoiu REMOVETHIS AT gmail DOT com> wrote in message
> news:2A454172-8F42-49EE-B3DD-1C924015F498@microsoft.com...
>> Scenario 2 should work.  Are any of your assemblies strongly named?
>> Also, might you be able to provide the complete details of the
>> TypeLoadException?
>>
>>
>> "Usman Jamil" <us***@advcomm.net> wrote in message
>> news:es3h$VisGHA.4748@TK2MSFTNGP03.phx.gbl...
>>> I've tested it with following combinations. Consider there's a class
>>> library with output as Helper.dll and a console application using its
>>> classes named TestApp.exe.
>>>
>>> 1. I obfusacted the Helper.dll and tried running it with the original
>>> TestApp.exe. It failed with error TypeloadException.
>>> 2. I obfuscated the Helper.dll and TestApp.exe both and again it failed
>>> with error TypeloadException.
>>> 3. I only obfuscated the TestApp.exe and kept the Helper.dll without
>>> obfuscation. The application TestApp.exe ran without any error.
>>>
>>> In my scenario I need both Helper.dll and TestApp.exe to be obfuscated
>>> as both contain code that I need to make complicated for decompilers. Is
>>> it possible.
>>>
>>> Regards
>>>
>>> Usman
>>>
>>> "Nicole Calinoiu" <calinoiu REMOVETHIS AT gmail DOT com> wrote in
>>> message news:058BCE61-D19C-4534-BFA1-2B92F5B963A8@microsoft.com...
>>>> Are you including the executable assembly in your obfuscation run?
>>>>
>>>> "Usman Jamil" <us***@advcomm.net> wrote in message
>>>> news:OrHKY%23YsGHA.3496@TK2MSFTNGP06.phx.gbl...
>>>>> Hi Nicole
>>>>>
>>>>> I'm using Dotfuscator that comes along with the Visual studio.Net. and
>>>>> yes
>>>>> I've made a single dotfuscator project and obfuscating all the
>>>>> assemblies in
>>>>> a single go, i.e I first compile all the code and then run dotfuscator
>>>>> on
>>>>> all of them. I suppose this should be the correct way.Also I'm not
>>>>> using
>>>>> reflection anywhere in my code.
>>>>>
>>>>> For checking I created a Test .Net Class library and used it in a .Net
>>>>> console application. It ran fine when the exe was run with the
>>>>> original class library (dll). But when I placed the obfuscated dll,
>>>>> the console application crashed with the TypeLoadException exception
>>>>> with description as unable to locate that class in that dll of which I
>>>>> had created an object in console application.
>>>>>
>>>>> Hope you can try simmilarly with your dotfuscator tool. Also note that
>>>>> I'm not using the professional or purchased version of dotfuscator
>>>>> instead using community edition that comes free with Visual studio.Net
>>>>>
>>>>> Regards
>>>>>
>>>>> Usman Jamil
>>>>>
>>>>> "Nicole Calinoiu" <calinoiu REMOVETHIS AT gmail DOT com> wrote in
>>>>> message
>>>>> news:3B66CE26-21D2-4CE4-A8AD-CFBCCD8CB428@microsoft.com...
>>>>>> "Usman Jamil" <us***@advcomm.net> wrote in message
>>>>>> news:OnihjgKsGHA.5100@TK2MSFTNGP06.phx.gbl...
>>>>>>> Hi Marcello
>>>>>>>
>>>>>>> I'm using obfuscation for the first time, so not sure how to use it
>>>>>>> properly. May be I'm missing something. What should be done if I
>>>>>>> have to
>>>>>>> obfuscate multiple assemblies which are using each other's public
>>>>>>> classes.
>>>>>>
>>>>>> You would usually obfuscate the entire set of dependant assemblies
>>>>>> together as a group.  Different obfuscators have different
>>>>>> capabilities
>>>>>> with respect to tracking renamings and applying them after an initial
>>>>>> obfuscation run (for example, when upgrading only one assembly from
>>>>>> an
>>>>>> obfuscated set). Your obfuscator's documentation and/or support
>>>>>> forums
>>>>>> would probably be the best source of information on the
>>>>>> product-specific
>>>>>> details.
>>>>>>
>>>>>>
>>>>>>> Currently obfuscation would rename the public/private classes of my
>>>>>>> assemblies and I guess this is the reason that crashes the
>>>>>>> assemblies/applications that are using them.
>>>>>>
>>>>>> Are you obfuscating the assemblies one-by-one, or together in a
>>>>>> single
>>>>>> obfuscation run?
>>>>>>
>>>>>>
>>>>>>> I'm not aware of reflection. If its a solution, can u please explain
>>>>>>> it.
>>>>>>
>>>>>> It's not a solution--it's an additional problem which you may or may
>>>>>> not
>>>>>> be encountering.  The main issue with reflection is that it
>>>>>> references
>>>>>> types and members by name at runtime, and most (all?) obfuscators do
>>>>>> not
>>>>>> accomodate this.  If you are using reflection (or taking advantage of
>>>>>> built-in framework code that uses reflection), you would usually need
>>>>>> to
>>>>>> manually omit from obfuscation the types and/or members that are used
>>>>>> via
>>>>>> reflection.
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> Regards
>>>>>>>
>>>>>>> Usman
>>>>>>>
>>>>>>> "Marcello Cantelmo" <marce***@cantelmosoftware.com> wrote in message
>>>>>>> news:ec8ppJ8rGHA.2124@TK2MSFTNGP03.phx.gbl...
>>>>>>>>> Hi
>>>>>>>>
>>>>>>>> Hi Usman,
>>>>>>>>
>>>>>>>>> I'm working on a project that has multiple modules. Most of the
>>>>>>>>> modules
>>>>>>>>> (windows services, Class libraries) are coded in C#. There are
>>>>>>>>> multiple
>>>>>>>>> class libraries which use each other's classes too having refrence
>>>>>>>>> added in them. To avoid exact code decompilation, I tried using
>>>>>>>>> obfuscation on all the compiled libraries(dlls). But now when I
>>>>>>>>> run my
>>>>>>>>> project, it just crashes since the obfuscation has renamed the
>>>>>>>>> classes
>>>>>>>>> inside those class libraries, so where ever these classes are
>>>>>>>>> being
>>>>>>>>> refrenced, i'm getting exception.
>>>>>>>>
>>>>>>>>
>>>>>>>> very strange! if the classes are public do not have to be renamed!
>>>>>>>> the
>>>>>>>> public field must be always visible.
>>>>>>>>
>>>>>>>>> What I had in mind was to compile all the code and in the end
>>>>>>>>> obfuscate
>>>>>>>>> all the output assemblies and ship them. Does obfuscation works
>>>>>>>>> this
>>>>>>>>> way that after obfuscating a dll we have to change the code with
>>>>>>>>> the
>>>>>>>>> name of updated classes whereever its being refrenced or am I
>>>>>>>>> missing
>>>>>>>>> something.
>>>>>>>>>
>>>>>>>>
>>>>>>>> you make use of reflection?
>>>>>>>>
>>>>>>>>> Regards
>>>>>>>>>
>>>>>>>>> Usman
>>>>>>>>
>>>>>>>> best regards,
>>>>>>>> Marcello Cantelmo
>>>>>>>> www.cantelmosoftware.com
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>>
>>
>
>
Author
29 Jul 2006 2:05 PM
Usman Jamil
I excluded the Global class but now it gives error on the next page i.e.
login.aspx.cs and continues for every aspx.cs file. Do I have to exclude all
the classes insde aspx.cs files from the web project to get it to compile or
can I obfuscate these classes too as they also contain code that I need to
obfuscate.

Regards

Usman Jamil


Show quoteHide quote
"Nicole Calinoiu" <calinoiu REMOVETHIS AT gmail DOT com> wrote in message
news:DC7C7E0E-D60C-4F08-83F8-243C68C449FA@microsoft.com...
> You'll need to exclude your WebProject.Global class from obfuscation in
> order to avoid this problem.  IIRC, there's an entire tab dedicated to
> exclusions in the Dotfuscator UI, but you might just want to check the
> documentation if  you can't find how to set the exclusion.
>
>
>
> "Usman Jamil" <us***@advcomm.net> wrote in message
> news:%236VEexvsGHA.1632@TK2MSFTNGP06.phx.gbl...
> > Hi Nicole
> >
> > Thanx for your help. Its working now. I dont know what I was doing wrong
> > but I created fresh obfuscation project, included all the assemblies in
an
> > order in which they were being used by each other and it worked fine
with
> > the test application. I really appreciate your help.
> >
> > Just one problem I'm having now with the whole application obfuscated
and
> > running in actual environment. Actually my assemblies are interlinked in
a
> > strange manner perhaps thats why I'm having problems. Let me put the
> > actual picture here.
> >
> > I have a class library named Helper.dll, a remoting shared library
> > Remoting.dll, an ASP.Net web project assembly WebProj.dll and a few .Net
> > windows services exes. Now they are using each other in this manner.
> >
> > 1. Helper.dll is being used by Remtoing.dll
> > 2. WebProj.dll is using both Remoting.dll and Helper.dll
> > 3. .Net Windows services are using all three dlls mentioned above.
> >
> > By using I mean the dlls are added in the refrences. I added all in an
> > obfuscation project and obfuscated all the 3 dlls and my service exes. I

> > replaced the obfuscated output assemblies in the actual folder and tried
> > to run the WebProject from IIS and got following exception.
> >
>
> --------------------------------------------------------------------------
------------------------
> > Server Error in '/' Application.
>
> --------------------------------------------------------------------------
------
> >
> > Parser Error
> > Description: An error occurred during the parsing of a resource required
> > to service this request. Please review the following specific parse
error
> > details and modify your source file appropriately.
> >
> > Parser Error Message: Could not load type WebProj.Global'.
> >
> > Source Error:
> >
> > Line 1:  <%@ Application Codebehind="Global.asax.cs"
> > Inherits="WebProj.Global" %>
> >
> >
> >
> > Source File: /global.asax    Line: 1
> >
> >
>
> --------------------------------------------------------------------------
------
> > Version Information: Microsoft .NET Framework Version:2.0.50727.42;
> > ASP.NET Version:2.0.50727.42
>
> --------------------------------------------------------------------------
-------------------------
> >
> > Do I have to obfuscate these aspx.cs files also that are using the
> > codebehind tag to refer to the classes that were originally in
> > WebProj.dll. If yes then how.
> >
> > Thanx and Regards
> >
> > Usman
> >
> >
> > "Nicole Calinoiu" <calinoiu REMOVETHIS AT gmail DOT com> wrote in
message
> > news:2A454172-8F42-49EE-B3DD-1C924015F498@microsoft.com...
> >> Scenario 2 should work.  Are any of your assemblies strongly named?
> >> Also, might you be able to provide the complete details of the
> >> TypeLoadException?
> >>
> >>
> >> "Usman Jamil" <us***@advcomm.net> wrote in message
> >> news:es3h$VisGHA.4748@TK2MSFTNGP03.phx.gbl...
> >>> I've tested it with following combinations. Consider there's a class
> >>> library with output as Helper.dll and a console application using its
> >>> classes named TestApp.exe.
> >>>
> >>> 1. I obfusacted the Helper.dll and tried running it with the original
> >>> TestApp.exe. It failed with error TypeloadException.
> >>> 2. I obfuscated the Helper.dll and TestApp.exe both and again it
failed
> >>> with error TypeloadException.
> >>> 3. I only obfuscated the TestApp.exe and kept the Helper.dll without
> >>> obfuscation. The application TestApp.exe ran without any error.
> >>>
> >>> In my scenario I need both Helper.dll and TestApp.exe to be obfuscated
> >>> as both contain code that I need to make complicated for decompilers.
Is
> >>> it possible.
> >>>
> >>> Regards
> >>>
> >>> Usman
> >>>
> >>> "Nicole Calinoiu" <calinoiu REMOVETHIS AT gmail DOT com> wrote in
> >>> message news:058BCE61-D19C-4534-BFA1-2B92F5B963A8@microsoft.com...
> >>>> Are you including the executable assembly in your obfuscation run?
> >>>>
> >>>> "Usman Jamil" <us***@advcomm.net> wrote in message
> >>>> news:OrHKY%23YsGHA.3496@TK2MSFTNGP06.phx.gbl...
> >>>>> Hi Nicole
> >>>>>
> >>>>> I'm using Dotfuscator that comes along with the Visual studio.Net.
and
> >>>>> yes
> >>>>> I've made a single dotfuscator project and obfuscating all the
> >>>>> assemblies in
> >>>>> a single go, i.e I first compile all the code and then run
dotfuscator
> >>>>> on
> >>>>> all of them. I suppose this should be the correct way.Also I'm not
> >>>>> using
> >>>>> reflection anywhere in my code.
> >>>>>
> >>>>> For checking I created a Test .Net Class library and used it in a
..Net
> >>>>> console application. It ran fine when the exe was run with the
> >>>>> original class library (dll). But when I placed the obfuscated dll,
> >>>>> the console application crashed with the TypeLoadException exception
> >>>>> with description as unable to locate that class in that dll of which
I
> >>>>> had created an object in console application.
> >>>>>
> >>>>> Hope you can try simmilarly with your dotfuscator tool. Also note
that
> >>>>> I'm not using the professional or purchased version of dotfuscator
> >>>>> instead using community edition that comes free with Visual
studio.Net
> >>>>>
> >>>>> Regards
> >>>>>
> >>>>> Usman Jamil
> >>>>>
> >>>>> "Nicole Calinoiu" <calinoiu REMOVETHIS AT gmail DOT com> wrote in
> >>>>> message
> >>>>> news:3B66CE26-21D2-4CE4-A8AD-CFBCCD8CB428@microsoft.com...
> >>>>>> "Usman Jamil" <us***@advcomm.net> wrote in message
> >>>>>> news:OnihjgKsGHA.5100@TK2MSFTNGP06.phx.gbl...
> >>>>>>> Hi Marcello
> >>>>>>>
> >>>>>>> I'm using obfuscation for the first time, so not sure how to use
it
> >>>>>>> properly. May be I'm missing something. What should be done if I
> >>>>>>> have to
> >>>>>>> obfuscate multiple assemblies which are using each other's public
> >>>>>>> classes.
> >>>>>>
> >>>>>> You would usually obfuscate the entire set of dependant assemblies
> >>>>>> together as a group.  Different obfuscators have different
> >>>>>> capabilities
> >>>>>> with respect to tracking renamings and applying them after an
initial
> >>>>>> obfuscation run (for example, when upgrading only one assembly from
> >>>>>> an
> >>>>>> obfuscated set). Your obfuscator's documentation and/or support
> >>>>>> forums
> >>>>>> would probably be the best source of information on the
> >>>>>> product-specific
> >>>>>> details.
> >>>>>>
> >>>>>>
> >>>>>>> Currently obfuscation would rename the public/private classes of
my
> >>>>>>> assemblies and I guess this is the reason that crashes the
> >>>>>>> assemblies/applications that are using them.
> >>>>>>
> >>>>>> Are you obfuscating the assemblies one-by-one, or together in a
> >>>>>> single
> >>>>>> obfuscation run?
> >>>>>>
> >>>>>>
> >>>>>>> I'm not aware of reflection. If its a solution, can u please
explain
> >>>>>>> it.
> >>>>>>
> >>>>>> It's not a solution--it's an additional problem which you may or
may
> >>>>>> not
> >>>>>> be encountering.  The main issue with reflection is that it
> >>>>>> references
> >>>>>> types and members by name at runtime, and most (all?) obfuscators
do
> >>>>>> not
> >>>>>> accomodate this.  If you are using reflection (or taking advantage
of
> >>>>>> built-in framework code that uses reflection), you would usually
need
> >>>>>> to
> >>>>>> manually omit from obfuscation the types and/or members that are
used
> >>>>>> via
> >>>>>> reflection.
> >>>>>>
> >>>>>>
> >>>>>>>
> >>>>>>> Regards
> >>>>>>>
> >>>>>>> Usman
> >>>>>>>
> >>>>>>> "Marcello Cantelmo" <marce***@cantelmosoftware.com> wrote in
message
> >>>>>>> news:ec8ppJ8rGHA.2124@TK2MSFTNGP03.phx.gbl...
> >>>>>>>>> Hi
> >>>>>>>>
> >>>>>>>> Hi Usman,
> >>>>>>>>
> >>>>>>>>> I'm working on a project that has multiple modules. Most of the
> >>>>>>>>> modules
> >>>>>>>>> (windows services, Class libraries) are coded in C#. There are
> >>>>>>>>> multiple
> >>>>>>>>> class libraries which use each other's classes too having
refrence
> >>>>>>>>> added in them. To avoid exact code decompilation, I tried using
> >>>>>>>>> obfuscation on all the compiled libraries(dlls). But now when I
> >>>>>>>>> run my
> >>>>>>>>> project, it just crashes since the obfuscation has renamed the
> >>>>>>>>> classes
> >>>>>>>>> inside those class libraries, so where ever these classes are
> >>>>>>>>> being
> >>>>>>>>> refrenced, i'm getting exception.
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> very strange! if the classes are public do not have to be
renamed!
> >>>>>>>> the
> >>>>>>>> public field must be always visible.
> >>>>>>>>
> >>>>>>>>> What I had in mind was to compile all the code and in the end
> >>>>>>>>> obfuscate
> >>>>>>>>> all the output assemblies and ship them. Does obfuscation works
> >>>>>>>>> this
> >>>>>>>>> way that after obfuscating a dll we have to change the code with
> >>>>>>>>> the
> >>>>>>>>> name of updated classes whereever its being refrenced or am I
> >>>>>>>>> missing
> >>>>>>>>> something.
> >>>>>>>>>
> >>>>>>>>
> >>>>>>>> you make use of reflection?
> >>>>>>>>
> >>>>>>>>> Regards
> >>>>>>>>>
> >>>>>>>>> Usman
> >>>>>>>>
> >>>>>>>> best regards,
> >>>>>>>> Marcello Cantelmo
> >>>>>>>> www.cantelmosoftware.com
> >>>>>>>>
> >>>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>
> >>>
> >>>
> >>
> >
> >
>
Author
31 Jul 2006 1:27 PM
Nicole Calinoiu
You should be able to exclude just the class name without excluding all the
code in the class.


Show quoteHide quote
"Usman Jamil" <us***@advcomm.net> wrote in message
news:%230B4bgxsGHA.1512@TK2MSFTNGP03.phx.gbl...
>I excluded the Global class but now it gives error on the next page i.e.
> login.aspx.cs and continues for every aspx.cs file. Do I have to exclude
> all
> the classes insde aspx.cs files from the web project to get it to compile
> or
> can I obfuscate these classes too as they also contain code that I need to
> obfuscate.
>
> Regards
>
> Usman Jamil
>
>
> "Nicole Calinoiu" <calinoiu REMOVETHIS AT gmail DOT com> wrote in message
> news:DC7C7E0E-D60C-4F08-83F8-243C68C449FA@microsoft.com...
>> You'll need to exclude your WebProject.Global class from obfuscation in
>> order to avoid this problem.  IIRC, there's an entire tab dedicated to
>> exclusions in the Dotfuscator UI, but you might just want to check the
>> documentation if  you can't find how to set the exclusion.
>>
>>
>>
>> "Usman Jamil" <us***@advcomm.net> wrote in message
>> news:%236VEexvsGHA.1632@TK2MSFTNGP06.phx.gbl...
>> > Hi Nicole
>> >
>> > Thanx for your help. Its working now. I dont know what I was doing
>> > wrong
>> > but I created fresh obfuscation project, included all the assemblies in
> an
>> > order in which they were being used by each other and it worked fine
> with
>> > the test application. I really appreciate your help.
>> >
>> > Just one problem I'm having now with the whole application obfuscated
> and
>> > running in actual environment. Actually my assemblies are interlinked
>> > in
> a
>> > strange manner perhaps thats why I'm having problems. Let me put the
>> > actual picture here.
>> >
>> > I have a class library named Helper.dll, a remoting shared library
>> > Remoting.dll, an ASP.Net web project assembly WebProj.dll and a few
>> > .Net
>> > windows services exes. Now they are using each other in this manner.
>> >
>> > 1. Helper.dll is being used by Remtoing.dll
>> > 2. WebProj.dll is using both Remoting.dll and Helper.dll
>> > 3. .Net Windows services are using all three dlls mentioned above.
>> >
>> > By using I mean the dlls are added in the refrences. I added all in an
>> > obfuscation project and obfuscated all the 3 dlls and my service exes.
>> > I
>
>> > replaced the obfuscated output assemblies in the actual folder and
>> > tried
>> > to run the WebProject from IIS and got following exception.
>> >
>>
>> --------------------------------------------------------------------------
> ------------------------
>> > Server Error in '/' Application.
>>
>> --------------------------------------------------------------------------
> ------
>> >
>> > Parser Error
>> > Description: An error occurred during the parsing of a resource
>> > required
>> > to service this request. Please review the following specific parse
> error
>> > details and modify your source file appropriately.
>> >
>> > Parser Error Message: Could not load type WebProj.Global'.
>> >
>> > Source Error:
>> >
>> > Line 1:  <%@ Application Codebehind="Global.asax.cs"
>> > Inherits="WebProj.Global" %>
>> >
>> >
>> >
>> > Source File: /global.asax    Line: 1
>> >
>> >
>>
>> --------------------------------------------------------------------------
> ------
>> > Version Information: Microsoft .NET Framework Version:2.0.50727.42;
>> > ASP.NET Version:2.0.50727.42
>>
>> --------------------------------------------------------------------------
> -------------------------
>> >
>> > Do I have to obfuscate these aspx.cs files also that are using the
>> > codebehind tag to refer to the classes that were originally in
>> > WebProj.dll. If yes then how.
>> >
>> > Thanx and Regards
>> >
>> > Usman
>> >
>> >
>> > "Nicole Calinoiu" <calinoiu REMOVETHIS AT gmail DOT com> wrote in
> message
>> > news:2A454172-8F42-49EE-B3DD-1C924015F498@microsoft.com...
>> >> Scenario 2 should work.  Are any of your assemblies strongly named?
>> >> Also, might you be able to provide the complete details of the
>> >> TypeLoadException?
>> >>
>> >>
>> >> "Usman Jamil" <us***@advcomm.net> wrote in message
>> >> news:es3h$VisGHA.4748@TK2MSFTNGP03.phx.gbl...
>> >>> I've tested it with following combinations. Consider there's a class
>> >>> library with output as Helper.dll and a console application using its
>> >>> classes named TestApp.exe.
>> >>>
>> >>> 1. I obfusacted the Helper.dll and tried running it with the original
>> >>> TestApp.exe. It failed with error TypeloadException.
>> >>> 2. I obfuscated the Helper.dll and TestApp.exe both and again it
> failed
>> >>> with error TypeloadException.
>> >>> 3. I only obfuscated the TestApp.exe and kept the Helper.dll without
>> >>> obfuscation. The application TestApp.exe ran without any error.
>> >>>
>> >>> In my scenario I need both Helper.dll and TestApp.exe to be
>> >>> obfuscated
>> >>> as both contain code that I need to make complicated for decompilers.
> Is
>> >>> it possible.
>> >>>
>> >>> Regards
>> >>>
>> >>> Usman
>> >>>
>> >>> "Nicole Calinoiu" <calinoiu REMOVETHIS AT gmail DOT com> wrote in
>> >>> message news:058BCE61-D19C-4534-BFA1-2B92F5B963A8@microsoft.com...
>> >>>> Are you including the executable assembly in your obfuscation run?
>> >>>>
>> >>>> "Usman Jamil" <us***@advcomm.net> wrote in message
>> >>>> news:OrHKY%23YsGHA.3496@TK2MSFTNGP06.phx.gbl...
>> >>>>> Hi Nicole
>> >>>>>
>> >>>>> I'm using Dotfuscator that comes along with the Visual studio.Net.
> and
>> >>>>> yes
>> >>>>> I've made a single dotfuscator project and obfuscating all the
>> >>>>> assemblies in
>> >>>>> a single go, i.e I first compile all the code and then run
> dotfuscator
>> >>>>> on
>> >>>>> all of them. I suppose this should be the correct way.Also I'm not
>> >>>>> using
>> >>>>> reflection anywhere in my code.
>> >>>>>
>> >>>>> For checking I created a Test .Net Class library and used it in a
> .Net
>> >>>>> console application. It ran fine when the exe was run with the
>> >>>>> original class library (dll). But when I placed the obfuscated dll,
>> >>>>> the console application crashed with the TypeLoadException
>> >>>>> exception
>> >>>>> with description as unable to locate that class in that dll of
>> >>>>> which
> I
>> >>>>> had created an object in console application.
>> >>>>>
>> >>>>> Hope you can try simmilarly with your dotfuscator tool. Also note
> that
>> >>>>> I'm not using the professional or purchased version of dotfuscator
>> >>>>> instead using community edition that comes free with Visual
> studio.Net
>> >>>>>
>> >>>>> Regards
>> >>>>>
>> >>>>> Usman Jamil
>> >>>>>
>> >>>>> "Nicole Calinoiu" <calinoiu REMOVETHIS AT gmail DOT com> wrote in
>> >>>>> message
>> >>>>> news:3B66CE26-21D2-4CE4-A8AD-CFBCCD8CB428@microsoft.com...
>> >>>>>> "Usman Jamil" <us***@advcomm.net> wrote in message
>> >>>>>> news:OnihjgKsGHA.5100@TK2MSFTNGP06.phx.gbl...
>> >>>>>>> Hi Marcello
>> >>>>>>>
>> >>>>>>> I'm using obfuscation for the first time, so not sure how to use
> it
>> >>>>>>> properly. May be I'm missing something. What should be done if I
>> >>>>>>> have to
>> >>>>>>> obfuscate multiple assemblies which are using each other's public
>> >>>>>>> classes.
>> >>>>>>
>> >>>>>> You would usually obfuscate the entire set of dependant assemblies
>> >>>>>> together as a group.  Different obfuscators have different
>> >>>>>> capabilities
>> >>>>>> with respect to tracking renamings and applying them after an
> initial
>> >>>>>> obfuscation run (for example, when upgrading only one assembly
>> >>>>>> from
>> >>>>>> an
>> >>>>>> obfuscated set). Your obfuscator's documentation and/or support
>> >>>>>> forums
>> >>>>>> would probably be the best source of information on the
>> >>>>>> product-specific
>> >>>>>> details.
>> >>>>>>
>> >>>>>>
>> >>>>>>> Currently obfuscation would rename the public/private classes of
> my
>> >>>>>>> assemblies and I guess this is the reason that crashes the
>> >>>>>>> assemblies/applications that are using them.
>> >>>>>>
>> >>>>>> Are you obfuscating the assemblies one-by-one, or together in a
>> >>>>>> single
>> >>>>>> obfuscation run?
>> >>>>>>
>> >>>>>>
>> >>>>>>> I'm not aware of reflection. If its a solution, can u please
> explain
>> >>>>>>> it.
>> >>>>>>
>> >>>>>> It's not a solution--it's an additional problem which you may or
> may
>> >>>>>> not
>> >>>>>> be encountering.  The main issue with reflection is that it
>> >>>>>> references
>> >>>>>> types and members by name at runtime, and most (all?) obfuscators
> do
>> >>>>>> not
>> >>>>>> accomodate this.  If you are using reflection (or taking advantage
> of
>> >>>>>> built-in framework code that uses reflection), you would usually
> need
>> >>>>>> to
>> >>>>>> manually omit from obfuscation the types and/or members that are
> used
>> >>>>>> via
>> >>>>>> reflection.
>> >>>>>>
>> >>>>>>
>> >>>>>>>
>> >>>>>>> Regards
>> >>>>>>>
>> >>>>>>> Usman
>> >>>>>>>
>> >>>>>>> "Marcello Cantelmo" <marce***@cantelmosoftware.com> wrote in
> message
>> >>>>>>> news:ec8ppJ8rGHA.2124@TK2MSFTNGP03.phx.gbl...
>> >>>>>>>>> Hi
>> >>>>>>>>
>> >>>>>>>> Hi Usman,
>> >>>>>>>>
>> >>>>>>>>> I'm working on a project that has multiple modules. Most of the
>> >>>>>>>>> modules
>> >>>>>>>>> (windows services, Class libraries) are coded in C#. There are
>> >>>>>>>>> multiple
>> >>>>>>>>> class libraries which use each other's classes too having
> refrence
>> >>>>>>>>> added in them. To avoid exact code decompilation, I tried using
>> >>>>>>>>> obfuscation on all the compiled libraries(dlls). But now when I
>> >>>>>>>>> run my
>> >>>>>>>>> project, it just crashes since the obfuscation has renamed the
>> >>>>>>>>> classes
>> >>>>>>>>> inside those class libraries, so where ever these classes are
>> >>>>>>>>> being
>> >>>>>>>>> refrenced, i'm getting exception.
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>>> very strange! if the classes are public do not have to be
> renamed!
>> >>>>>>>> the
>> >>>>>>>> public field must be always visible.
>> >>>>>>>>
>> >>>>>>>>> What I had in mind was to compile all the code and in the end
>> >>>>>>>>> obfuscate
>> >>>>>>>>> all the output assemblies and ship them. Does obfuscation works
>> >>>>>>>>> this
>> >>>>>>>>> way that after obfuscating a dll we have to change the code
>> >>>>>>>>> with
>> >>>>>>>>> the
>> >>>>>>>>> name of updated classes whereever its being refrenced or am I
>> >>>>>>>>> missing
>> >>>>>>>>> something.
>> >>>>>>>>>
>> >>>>>>>>
>> >>>>>>>> you make use of reflection?
>> >>>>>>>>
>> >>>>>>>>> Regards
>> >>>>>>>>>
>> >>>>>>>>> Usman
>> >>>>>>>>
>> >>>>>>>> best regards,
>> >>>>>>>> Marcello Cantelmo
>> >>>>>>>> www.cantelmosoftware.com
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>>
>> >>>>>>>
>> >>>>>>
>> >>>>>
>> >>>>>
>> >>>>>
>> >>>>
>> >>>
>> >>>
>> >>
>> >
>> >
>>
>
>