关于"The dependency was added by the project system and cannot be removed" Error

阅读一个简单地工程代码,其中一个工程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

时间: 2024-11-08 19:21:31

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

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

SAP一句话入门:Project System http://blog.vsharing.com/MilesForce/A621279.html 这是SAP ERP入门的最后一篇了. 我们这些死跑龙套的最喜欢项目了,是啊,有项目就有费用啊.万恶的资本家终于舍得拿钱出来让我们过家家了,虽然其目的是想攫取更多的社会财富.不过另一方面,这叫什么来着,叫社会财富的再分配.次级分配.三级分配,给的就是围在肥得流油的资本家身边的劳苦大众们.就像我有事没事就要用公家的钱打飞的往返不同的城市,多的一个月飞五六次

MarkDown的错误信息

Frequently Asked Questions General Questions What are the system requirements for MarkdownPad? Is there a portable version of MarkdownPad? What languages are available in MarkdownPad? Can I help translate MarkdownPad? Is the original version of Markd

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

摘要 前面介绍了使用vs2015新建asp.net core web的内容,这篇文章学习下project.json文件的内容. project.json 原文:https://docs.microsoft.com/zh-cn/dotnet/articles/core/tools/project-json project.json文件用来定义asp.net core项目的元数据,编译信息和依赖.在本篇文章中,你可以看到你能在project.json中定义的所有属性列表. Note .NET Cor

maven可选依赖(Optional Dependencies)和依赖排除(Dependency Exclusions)

我们知道,maven的依赖关系是有传递性的.如:A-->B,B-->C.但有时候,项目A可能不是必需依赖C,因此需要在项目A中排除对A的依赖.在maven的依赖管理中,有两种方式可以对依赖关系进行,分别是可选依赖(Optional Dependencies)以及依赖排除(Dependency Exclusions). 一.可选依赖 当一个项目A依赖另一个项目B时,项目A可能很少一部分功能用到了项目B,此时就可以在A中配置对B的可选依赖.举例来说,一个类似hibernate的项目,它支持对mys

Tutorial for adding a library project as git submodule and then using it as a studio Module

https://gitsubmoduleasandroidtudiomodule.blogspot.in/I'm writing this blog to make the development process easy and faster. This is specific to Android Studio, same can be used for any other project which used Gradle build system and GIT. I want to m

eclipse搭建maven project的spring4 spring mvc mybatis

一,先确定已经安装好了Eclipse Java EE IDE for Web Developers我用的是如下版本 Version: Neon.3 Release (4.6.3)Build id: 20170314-1500 然后新增一个Maven project如下图,勾选上前2个复选框 二,填写groupid和artifactid等,最关键的是要选war类型的packaging,如下图: 三,然后修改如下3个地方的jdk配置为1.8并且把Project Facets中的Dynamic web

Maven导出Project依赖的jar包

Maven导出Project依赖的jar包 从Maven仓库中导出jar包: mvn dependency:copy-dependencies 会导出到Project的targed/dependency 下面 可以在Project创建lib文件夹,输入以下命令: mvn dependency:copy-dependencies -DoutputDirectory=lib 这样jar包都会copy到Project目录下的lib里面 可以设置依赖级别,通常用编译需要的jar mvn dependen

The Simplified Project Management Process

One of the challenges of explaining project management to people who are unfamiliar with the approach, is that descriptions are often either so high-level as to be meaningless, or so detailed that they are overwhelming. Over the years, I have come to

maven 三个基本插件 clean dependency compiler

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersi