UWP和Xamarin生成失败,无输出 [英] UWP and Xamarin Builds Failing with no output

查看:221
本文介绍了UWP和Xamarin生成失败,无输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试创建使用Visual Studio中的Xamarin的Android项目和跨平台项目.当我构建甚至是一个空项目时,它似乎立即无法执行任何工作.

I have tried creating Android projects and cross platform projects that utilize Xamarin in Visual studio. When I build, even an empty project, it fails instantly without seeming to perform any work.

没有列出任何错误或警告.

There are no errors or warnings listed.

输出窗口具有项目名称和: Build: 0 succeeded, 2 failed, 0 up-to-date, 0 skipped

The output window has the project name and: Build: 0 succeeded, 2 failed, 0 up-to-date, 0 skipped

启动项目时,我会收到消息框,警告我有关意外的记录器故障,有时对话框会引用MuxLogger.这是不一致的,消息略有不同,有时甚至根本不显示.这是一个例子:

When I start the project I get message boxes warning me about unexpected logger failures and sometimes the dialogs reference the MuxLogger. This is inconsistent, the messages vary slightly and sometimes don't appear at all. Here is an example:

偶然地,我尝试手动构建以获取更多输出,并且得到了:

Incidentally I tried manually building to get more output and I get this:

Unhandled Exception: System.TypeLoadException: Could not load type 'Microsoft.Build.Logging.ProfilerLogger' from assembly 'Microsoft.Build, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
  at System.Signature.GetSignature(Void* pCorSig, Int32 cCorSig, RuntimeFieldHandleInternal fieldHandle, IRuntimeMethodInfo methodHandle, RuntimeType declaringType)
  at System.Reflection.RuntimeMethodInfo.FetchNonReturnParameters()
  at System.Reflection.RuntimeMethodInfo.GetParameters()
  at System.Diagnostics.StackTrace.ToString(TraceFormat traceFormat)
  at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
  at System.Exception.GetStackTrace(Boolean needFileInfo)
  at System.Exception.ToString(Boolean needFileLineInfo, Boolean needMessage)
  at System.Exception.ToString()
  at Microsoft.Build.CommandLine.MSBuildApp.Execute(String commandLine)
  at Microsoft.Build.CommandLine.MSBuildApp.Main()

请注意,我可以构建很多其他项目类型,例如Web项目和MonoGame项目.

Note that I can build many other project types such as web projects and MonoGame projects just fine.

推荐答案

最终,这证明与安装在全局程序集缓存(GAC)中的MSBuild的旧版本有关.要进行检查,请首先打开VS2017的Developer Command Prompt实例.然后将GAC中的程序集输出到文件中以便于查看:

Ultimately this turned out to be a problem with an old version of MSBuild installed in the Global Assembly Cache (GAC). To check for this, first open an instance of Developer Command Prompt for VS2017. Then output the assemblies in your GAC to a file for easy review:

gacutil -l >> someFile.txt

查找以Microsoft.Build开头的任何内容,尤其是包含Version=15.X的行(提示,这些行不会按顺序输出,因此请按字母顺序对行进行排序).

Look for anything that starts with Microsoft.Build, specifically lines that include Version=15.X (hint, these don't output in order so sort the lines alphabetically).

卸载所有以Microsoft.Build开头的内容,其中可能包括Microsoft.Build.Framework,Microsoft.Build等.这不应安装版本为<的Microsoft.Build版本. 15.命令:

Uninstall all things that start with Microsoft.Build which may include Microsoft.Build.Framework, Microsoft.Build and more. This should not install versions of Microsoft.Build with a version < 15. Command:

gacutil -u Microsoft.Build

gacutil -u Microsoft.Build.Framework

这应该使您的项目能够使用正确版本的MSBuild并成功编译.

This should allow your project to utilize the correct version of MSBuild and compile successfully.

这篇关于UWP和Xamarin生成失败,无输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆