本文介绍了使用 Microsoft.Build API 构建项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!
问题描述
我正在尝试使用 Microsoft.Build 中的类构建项目.
I'm trying to build a project using the classes in Microsoft.Build.
代码是:
但是它抛出了以下异常:
However it's throwing the following exception:
我尝试将以下内容添加到包中(在 net452 和 net7 项目中):
I've tried adding the following to the packages (both in a net452 and a net7 project):
- id="Microsoft.Build" 版本="15.1.1012"
- id="Microsoft.Build.Framework" version="15.1.1012"
- id="Microsoft.Build.Runtime" version="15.1.1012"
- id="Microsoft.Build.Tasks.Core" version="15.1.1012"
- id="Microsoft.Build.Utilities.Core" version="15.1.1012"
仍然得到相同的结果.
我也尝试过像这样使用 BuildManager
:
I've also tried using the BuildManager
like this:
推荐答案
我安装后遇到同样的错误:
I hit the same error after I installed:
但后来我安装了:
事情开始奏效了.
有点混乱……
dasMulli"在以下位置向我指出了这个 stackoverflow 问题:
I was pointed to this stackoverflow question by "dasMulli" at:
https://github.com/Microsoft/msbuild/issues/1889
这篇关于使用 Microsoft.Build API 构建项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!
本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!