2

Possible Duplicate:
Parser for C#

Any (free) libraries that can parse C# source code and make a DOM of it?

I need to add an attribute to all classes in bunch of .cs files and then compile them to an assembly. This needs to be done in an asp.net application, so I'm not interested in Visual Studio plugins or similar.

I need to achieve this

input: ~/plugins/MyPlugin/MyPlugin.cs

public class MyPlugin : PluginBase, IEntitySavingPlugin
{
}

output: Plugins.dll

[PluginDirectory("~/plugins/MyPlugin/")]
public class MyPlugin : PluginBase, IEntitySavingPlugin
{
}
Community
  • 1
  • 1
Mike Koder
  • 1,898
  • 1
  • 17
  • 27

2 Answers2

1

You can try to use Antlr Parser, a framework for constructing recognizers, interpreters, compilers, and translators from grammatical descriptions. Support C#; C# 2 ;C# 3

http://www.antlr.org/

Hone MKS
  • 19
  • 1
0

Duplicate of question Parser for C#.

Your best bet may be one of these:

http://csparser.codeplex.com/

http://wiki.sharpdevelop.net/NRefactory.ashx

Community
  • 1
  • 1
luksan
  • 7,661
  • 3
  • 36
  • 38