BuildEngine

  • Thread starter Thread starter Joe
  • Start date Start date
J

Joe

Hi anyone use the BuildEngine Class

I cannot get code from MSDN to compile. I get the following error.
I am trying to us it to parse csproj file

thanks


at line
engine = new Microsoft.Build.BuildEngine.Engine(binPath);

get this error

Error 1 Invalid token '=' in class, struct, or interface member declaration
C:\Data\DotNet\CSharp\XML\ParseCSharpProjFile\Class1.cs 23 20
ParseCSharpProjFile

using System.Reflection;

using Microsoft.Build.BuildEngine;

using Microsoft.Build.Framework;

using Microsoft.Build.Utilities;

using Mono.XBuild.Framework;

using Mono.XBuild.Utilities;





namespace ParseCSharpProjFile

{

class Class1

{


// Instantiate a new Engine object

Microsoft.Build.BuildEngine.Engine engine;

// Point to the path that contains the .NET Framework 2.0 CLR and tools

string binPath = "C:\\WINNT\\Microsoft.NET\\framework\\v2.0.50727";

engine = new Microsoft.Build.BuildEngine.Engine(binPath);


// Create a new empty project

Project project = new Project();


// Load a project

project.Load(@"c:\temp\validate.proj");



Console.WriteLine("Project Properties");

Console.WriteLine("----------------------------------");
 
Hi Joe,
Error 1 Invalid token '=' in class, struct, or interface member
declaration C:\Data\DotNet\CSharp\XML\ParseCSharpProjFile\Class1.cs 23 20
ParseCSharpProjFile

Your code must reside inside a method. I can't see you having one!

--
Regards,

Mr. Jani Järvinen
C# MVP
Helsinki, Finland
(e-mail address removed)
http://www.saunalahti.fi/janij/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top