开发者

Library for parsing/modifying C# source code (and compiling after that) [duplicate]

This question already has answers here: Closed 11 years ago.

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开发者_StackOverflow社区 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
{
}


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/


Duplicate of question Parser for C#.

Your best bet may be one of these:

http://csparser.codeplex.com/

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜