本文转自:https://github.com/Microsoft/msbuild/issues/364

After uninstall Visual Studio 2015 Update 1 RC and reinstall VS 2015 RTM I can't compile any of my projects any more. Following error occurs:

1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(2718,5): error MSB4018: The "GenerateResource" task failed unexpectedly.
1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(2718,5): error MSB4018: System.NullReferenceException: Object reference not set to an instance of an object.

https://github.com/Microsoft/msbuild/pull/314

This fixes the scenario of switching builds using RTM and Update 1.

Normal usage this should only be for an uninstall scenario since MSBuild is typically in the GAC,

but in cases of a checked in toolset or using the open source version we should be backwards compatible.

This is just renaming the fields back for the cache classes.

https://github.com/Microsoft/msbuild/pull/466

Update ResGen Serialization Compat for RTM and U1

602201c When reverting the CodeFormatter private field name changes (#314), the Dependencies class was missed. This causes an incompatibility going from  Update 1 back to RTM and causes a null ref. This change fixes the compat issue (rename the field) and updates the serialization version to ensure U1 -> U2 works as expected.

Rename field for internal build.

c863538 Looks like the field was renamed for STANDALONEBUILD but not otherwise.Correcting this.

http://stackoverflow.com/questions/31608319/msbuild-error-msb4018-in-vs2015-the-link-task-failed-unexpectedly

9down voteaccepted

I've managed to fix this issue myself and would like to document the solution here for future reference.

The following error was caused by an empty XML element in the project file:

  • MSB4018: System.NullReferenceException: Object reference not set to an instance of an object.

The empty element was accessed by the 'Link' task, which just failed:

  • MSB4018: 'The "Link" task failed unexpectedly.

Removing the respective element fixed the issue:

<Link><GenerateDebugInformation></GenerateDebugInformation></Link>

Hint: As it can be seen in other posts, many of the MSB4018 errors seem to be related to project files containing unexpected values.

Another solution is to delete all generated files from the last build through an explorer window.

Delete all files in:

.\Project\bin

.\Project\obj

While you can "Clean" or "Rebuild" directly through Visual Studio, this only captures some of the files. By forcing to recompile all files, all memory locations will now correctly align and the issue should be resolved.

https://blogs.msdn.microsoft.com/visualstudio/2013/07/24/msbuild-is-now-part-of-visual-studio/?replytocom=73743

MSBuild and its Toolset now Version with Visual Studio

最新文章

  1. Matlab实现均匀量化
  2. swift:入门知识之枚举和结构体
  3. 遵守GPL的开源软件能用于商用吗?
  4. 【转】二叉树 VS hashtable
  5. 使用Parse内付费服务出现的Error Domain=Parse Code=146 &quot;The operation couldn’t be completed. (Parse error 146.)
  6. SQL性能优化没有那么神秘
  7. Ubuntu下配置smb服务器
  8. jquery实现导航栏效果
  9. js 作用域,作用域链,闭包
  10. log4cxx用环境变量设置输出文件名
  11. SQLite 分离数据库(http://www.w3cschool.cc/sqlite/sqlite-detach-database.html)
  12. day5 模拟用户登录
  13. jquery接触初级-----juqery DOM操作 之一
  14. JQ_One()函数特效
  15. 3:C#异步WaitAll的使用
  16. “全栈2019”Java异常第七章:try-catch-finally组合方式
  17. [实战]MVC5+EF6+MySql企业网盘实战(24)——视频列表
  18. Java+selenium+Fitnesse
  19. 判断序列是否为二叉排序树的后序遍历 python
  20. SSH登陆响应慢的问题

热门文章

  1. Asp.Net Core下的两种路由配置方式
  2. Python在Android系统上运行
  3. [转贴]VC编译器版本号_MSC_VER and _MSC_FULL_VER
  4. JMeter—监听器
  5. h5聊天工具的开发过程及思路
  6. CocoaPods的PodSpec.json文件用法
  7. 从零开始完整搭建 Spring-Boot 项目开发框架的教程
  8. 大数据-hadoop HA集群搭建
  9. python学习,day3: 文件的读写
  10. Sklearn,TensorFlow,keras模型保存与读取