任何人都可以帮助我使用C#以编程方式逐步构建一个Web应用程序,而不是通过命令行。 我在MSbuild看到不同的帖子但我没有一个人解释清楚。我使用下面的代码完成了一个示例,它只适用于.csproj类扩展,但不适用于.sln扩展名。
Can any one help me in building a web application using ms build programmatically step by step using C# 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.
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它抛出如下错误 无法加载项目文件。根级别的数据无效。第2行,第1位。 请让我知道解决方案,我将感谢他们。
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.
推荐答案我在 msdn forum post [ ^ ]涵盖了这种情况 I found this discussion on an msdn forum post[^] which covers this scenario
更多推荐
MS编程以编程方式
发布评论