Click here to Skip to main content
15,905,587 members
Please Sign up or sign in to vote.
4.00/5 (2 votes)
See more:
Can any one help me in building a web application using ms build programmatically step by step using C#.net but not through command line.
I am breaking my head seeing different posts on MSbuild but no one explained it clearly.I have done a sample using the below code, it is working only for .csproj kind of extension but not for .sln extension.


XML
var project = projectCollection.LoadProject(solution_name);
          var fileLogger = new FileLogger();
          fileLogger.Parameters = @"logfile=" + logfile;
          projectCollection.RegisterLogger(fileLogger);

          bool result = project.Build();
          projectCollection.UnregisterAllLoggers();
          return result.ToString();</pre>




For .sln it is throwing an error as below
The project file could not be loaded. Data at the root level is invalid. Line 2, position 1.

Please let me know the solution for this and I will be thankful to them.
Posted

1 solution

I found this discussion on an msdn forum post[^] which covers this scenario
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900