Thorin Oakenshield
Thorin Oakenshield

Reputation: 14662

Can we decompile a C# dll to VB.NET

I have developed a dll in C#.net. Can we decompile the same in VB.net. If yes, how to do that?

Upvotes: 1

Views: 6247

Answers (5)

Rob
Rob

Reputation: 3843

Assuming you have the source, you can use sharpdevelop to convert whole solutions back and forth between c#.net and vb.net

The same group also developed a plugin for visual studio: Code Converter C# to/from VB.NET

Upvotes: 2

MarkJ
MarkJ

Reputation: 30398

Sometimes C# cannot be converted (or decompiled) into VB.Net because there are some elements of C# that have no equivalent in VB. E.g. iterators (yield) and unsafe code. Furthermore some of the free converters fail badly even when there are direct equivalents.

Why do you want to do this anyway? It's probably easy to just use the C# DLL from VB.Net code: you can call it, you can inherit from it. "CLS compliance" will help with this.

For what it's worth, it's also true that there are some elements of VB that have no equivalent in C#, e.g. exception filters.

Upvotes: 1

pingoo
pingoo

Reputation: 2064

If you've developed it your self I assume you have access to the source? If so you can just convert it all though here:

http://www.developerfusion.com/tools/convert/csharp-to-vb/

Upvotes: 0

Christoph Fink
Christoph Fink

Reputation: 23093

I agree with Mitch, but as a free alternative to Reflector:

Upvotes: 3

Mitch Wheat
Mitch Wheat

Reputation: 300489

Use a tool like Reflector to convert a compiled C# assembly (IL) into decompiled VB.NET source code (might lose some meaning with certain variable names). Another post mentions some free alternatives to Reflector.

Or convert the C# code using an online resource such as this one (1 code file at a time though).

Upvotes: 5

Related Questions