阅读一个简单地工程代码,其中一个工程BaseCode是 static lib,另一个工程RunBaseCode使用该lib,但在工程设置的“Linker\Input\AdditionalDependencies” 中并没有添加对该lib的引用,而在“Linker\Command Line”中却发现BaseCode.lib已经添加进来了,这是怎么回事呢?

首先怀疑是Solution中设置的 “Project Dependencies”编译依赖,隐含的添加了lib,因此想把RunBaseCode对BaseCode的依赖去掉试试看。取消依赖时,却发现取消不了,出现"The dependency was added by the project system and cannot be removed" 错误。那这个编译依赖是在哪里添加的呢?

原来是在“Project References”中设置的。

右键\Properties\Common Properties\Framework and References\Add New Reference。

设置Reference后,该工程就自动加上了“Project Dependencies”。

那默认添加对BaseCode.lib的引用,是否是由于设置了“Project Dependencies”呢?不是的,是由于上面所述的设置“Reference”导致的。验证的情况如下:

1. 点击“Remove Reference”去掉工程关联后,默认的“Project Dependencies”也取消掉了。这时,手动添加“Project Dependencies”,发现“Linker\Command Line”中没有自动添加BaseCode.lib。

2. 将上一步骤中的“Project Dependencies”去掉,然后“右键\Properties\Common Properties\Framework and References\Add New Reference”,这时“Linker\Command Line”中自动添加了BaseCode.lib。

References

【1】Error while removing project dependency in VS2010 (http://stackoverflow.com/questions/12818315/error-while-removing-project-dependency-in-vs2010)

【2】VS项目依赖(http://www.cppblog.com/mythma/archive/2011/08/05/this_dependency_was_added_by_the_project_system_and_cannot_be_removed.html

关于"The dependency was added by the project system and cannot be removed" Error的更多相关文章

  1. Android Studio添加应用作为依赖时报错Error:Dependency MonthText:xlistview:unspecified on project app resolves to an APK archive which is not supported as a compilation dependency. File: 及其解决方案

    Error:Dependency MonthText:xlistview:unspecified on project app resolves to an APK archive which is ...

  2. [转]A reference to a higher version or incompatible assembly cannot be added to the project

    If you face this error message while adding a reference to your project in Visual Studio try the fol ...

  3. [转帖]SAP一句话入门:Project System

    SAP一句话入门:Project System http://blog.vsharing.com/MilesForce/A621279.html 这是SAP ERP入门的最后一篇了. 我们这些死跑龙套 ...

  4. Fix: Compile project encounter undefined reference to“xxx”error

    Need to add all the new cpp files to jni/Andriod.mk folder:

  5. How to: Modify a Project System So That Projects Load in Multiple Versions of Visual Studio

    http://msdn.microsoft.com/en-us/library/hh266706(v=VS.110).aspx

  6. Adding a custom jar as a maven dependency

    Using maven in a Java project is great. It manages builds (as customized as you may need), execution ...

  7. 软件工程 week 02

    一.地址链接 1.作业地址:https://edu.cnblogs.com/campus/nenu/2016CS/homework/2110 2.git仓库地址:https://git.coding. ...

  8. [asp.net core]project.json(1)

    摘要 前面介绍了使用vs2015新建asp.net core web的内容,这篇文章学习下project.json文件的内容. project.json 原文:https://docs.microso ...

  9. maven 三个基本插件 clean dependency compiler

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/20 ...

随机推荐

  1. C#设计模式(15)——命令模式(Command Pattern)

    一.前言 之前一直在忙于工作上的事情,关于设计模式系列一直没更新,最近项目中发现,对于设计模式的了解是必不可少的,当然对于设计模式的应用那更是重要,可以说是否懂得应用设计模式在项目中是衡量一个程序员的 ...

  2. TypeScript的全部资料,以后都放这儿了

    很早之前就听说TypeScript了(以下简称TS),但总是用难以抽出时间给自己找到这个冠冕堂皇的理由.最近又心血来潮,打算写TS的博客了,毕竟TS核心开发者也是C#之父,像我这么热爱C#的人,怎么可 ...

  3. [ACM_水题] ZOJ 3706 [Break Standard Weight 砝码拆分,可称质量种类,暴力]

    The balance was the first mass measuring instrument invented. In its traditional form, it consists o ...

  4. JSLint JavaScript代码质量审查工具汉化中文版隆重发布

    JSLint是一款JavaScript代码质量审查工具,它可以指出代码中错误.不规范的地方,非常之严格,甚至多写一个空格都会发出警告. JSLint的审查规则,根据众多前辈多年编程经验而写,字字珠玑, ...

  5. 深究JS异步编程模型

    前言  上周5在公司作了关于JS异步编程模型的技术分享,可能是内容太干的缘故吧,最后从大家的表情看出"这条粉肠到底在说啥?"的结果:(下面是PPT的讲义,具体的PPT和示例代码在h ...

  6. JS原型链简单图解

    JS中原型链,说简单也简单. 首先明确: 函数(Function)才有prototype属性,对象(除Object)拥有__proto__. 首先,我画了一张图. 所谓原型链,指的就是图中的proto ...

  7. autocomplete实现联想输入,自动补全

    jQuery.AutoComplete是一个基于jQuery的自动补全插件.借助于jQuery优秀的跨浏览器特性,可以兼容Chrome/IE/Firefox/Opera/Safari等多种浏览器. 特 ...

  8. winform下重画ListBox

    Windows Forms是由Win32 API封装的开发组件,最初是为了替代mfc,但却没有体现与Model View Controller架构对应的特色,进而在.net framework 3.0 ...

  9. atitit.编辑表单的实现最佳实践dwr jq easyui

    atitit.编辑表单的实现最佳实践dwr jq easyui 1. 提交表单 1 2. 表单验证 1 3. 数据保存使用meger方式取代save&update方式 1 3.1. Filte ...

  10. node.js WebService异常处理(domain)以及利用domain实现request生命周期的全局变量

    成熟的Web Service技术,例如Fast CGI.J2EE.php,必然会对代码异常有足够的保护,好的Web必然会在出错后给出友好的提示,而不是莫名其妙的等待504超时.而node.js这里比较 ...