Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8965483
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:48:48+00:00 2026-06-15T16:48:48+00:00

Does anyone know of a way in the Microsoft .NET framework to check the

  • 0

Does anyone know of a way in the Microsoft .NET framework to check the syntax, and only the syntax, of a given C# file?

For a little background, what I am interested in doing is setting up syntastic to check the syntax of .cs files. Out of the box, syntastic uses the Mono C# compiler with its --parse flag to perform this operation but I can find no equivalent in the Microsoft .NET framework.

My first attempt to get this to work was to use csc /target:library /nologo in place of mcs --parse, but the problem is that this is called on a per-file basis. As a result, it reports missing namespaces (which exist in the full project build) instead of only syntactic errors.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T16:48:49+00:00Added an answer on June 15, 2026 at 4:48 pm

    I’ve used NRefactory before from the icsharpcode IDE. It’s quick and easy for basic stuff.

    see this article:
    Using NRefactory for analyzing C# code

    I use it for creating VB.NET examples from C# examples. The method that does this is really straight-forward and can easily be adapted to your needs:

        private static void ConvertLanguage(TextReader input, TextWriter output, SupportedLanguage language, Action<string> onError)
        {
            using (IParser parser = ParserFactory.CreateParser(language, input))
            {
                parser.Parse();
                var specials = parser.Lexer.SpecialTracker.RetrieveSpecials();
                var result = parser.CompilationUnit;
                //if (parser.Errors.Count > 0)
                //    MessageBox.Show(parser.Errors.ErrorOutput, "Parse errors");
    
                IOutputAstVisitor outputVisitor;
                if (language == SupportedLanguage.CSharp)
                    outputVisitor = new VBNetOutputVisitor();
                else
                    outputVisitor = new CSharpOutputVisitor();
    
                outputVisitor.Options.IndentationChar = ' ';
                outputVisitor.Options.IndentSize = 4;
                outputVisitor.Options.TabSize = 4;
    
                using (SpecialNodesInserter.Install(specials, outputVisitor))
                    result.AcceptVisitor(outputVisitor, null);
    
                if (outputVisitor.Errors.Count > 0 && onError != null)
                    onError(outputVisitor.Errors.ErrorOutput);
    
                output.Write(outputVisitor.Text);
            }
        }
    

    Note: The preceding code is from an older version and may not compile against the latest version of the NRefactory library.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know of a way to detect when the last time a Microsoft
Does anyone know a way to get the mean amplitude of a .wav file
Does anyone know a way to display code in Microsoft Word documents that preserves
Does anyone know (with confidence either way) if Microsoft plans on continued support (as
Does anyone know if there is any equivalent to Microsoft's ASP.NET Model View Control
Does anyone know if there is a way to integrate NHunspell with Microsoft Word?
Does anyone know a way to register a persistent UDF in SQLite 3 (using
Does anyone know a way to get Firefox to crop the corners if the
Does anyone know a way to determine if a Rails association has been eager
Does anyone know of a way to contain a nonbreaking space in an html

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.