0
有我的csproj文件中下面的代码:UnitTask错误尝试使用Microsoft.Build.Evaluation
<UsingTask TaskName="HelloWorld" TaskFactory="CodeTaskFactory"
AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<Task>
<!--Microsoft.Build.dll-->
<Using Namespace="Microsoft.Build.Evaluation" />
<Code Type="Fragment" Language="cs">
<![CDATA[
var p = new Project("$(MSBuildProjectFullPath)");
]]>
</Code>
</Task>
</UsingTask>
在我AfterBuild
我这样称呼它:
<Target Name="AfterBuild">
<HelloWorld />
</Target>
我正的错误是:
error CS0246: The type or namespace name 'Project' could not be found (are you missing a using directive or an assembly reference?)
参照变种p值=新项目
此解决这个问题,谢谢你,我现在得到一个错误: System.InvalidOperationException:有相当于项目(以项目项目集合中已存在相同的全局属性和工具版本,路径为“C:\ Users \ stal \ Documents \ Visual Studio 2015 \ Projects \ ConsoleApplication1 \ MyClassLibrary \ MyClassLibrary.csproj”。要将等效项加载到此项目集合中,请先卸载此项目。 – Pacman
@Pacman你可以为这个问题打开一个新的线程。 –