MS编程以编程方式

编程入门 行业动态 更新时间:2024-10-12 01:24:35
本文介绍了MS编程以编程方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

任何人都可以帮助我使用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 = @&quot;logfile=&quot; + 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编程以编程方式

本文发布于:2023-11-02 09:53:29,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1552064.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:方式   MS

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!