惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
Darknet – Hacking Tools, Hacker News & Cyber Security
T
Troy Hunt's Blog
P
Palo Alto Networks Blog
N
News and Events Feed by Topic
Hacker News - Newest:
Hacker News - Newest: "LLM"
T
Threatpost
C
Cyber Attacks, Cyber Crime and Cyber Security
S
Schneier on Security
Google Online Security Blog
Google Online Security Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Spread Privacy
Spread Privacy
NISL@THU
NISL@THU
Cisco Talos Blog
Cisco Talos Blog
The GitHub Blog
The GitHub Blog
S
SegmentFault 最新的问题
量子位
L
Lohrmann on Cybersecurity
酷 壳 – CoolShell
酷 壳 – CoolShell
Attack and Defense Labs
Attack and Defense Labs
Y
Y Combinator Blog
Project Zero
Project Zero
AWS News Blog
AWS News Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Last Week in AI
Last Week in AI
博客园 - 聂微东
MyScale Blog
MyScale Blog
aimingoo的专栏
aimingoo的专栏
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
S
Securelist
Latest news
Latest news
C
CXSECURITY Database RSS Feed - CXSecurity.com
B
Blog RSS Feed
Webroot Blog
Webroot Blog
Blog — PlanetScale
Blog — PlanetScale
Recent Announcements
Recent Announcements
V2EX - 技术
V2EX - 技术
Schneier on Security
Schneier on Security
F
Full Disclosure
Apple Machine Learning Research
Apple Machine Learning Research
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
P
Proofpoint News Feed
Recent Commits to openclaw:main
Recent Commits to openclaw:main
月光博客
月光博客
L
LINUX DO - 最新话题
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
H
Heimdal Security Blog
F
Fortinet All Blogs
博客园_首页
N
News | PayPal Newsroom
P
Proofpoint News Feed

博客园 - vibration

ATL3.0组件注册bug的解决方法 OLE2T在VS2003中转换中文失败的问题及解决方法 标题栏按钮的WTL实现 AppBar的WTL实现 招聘C++和C#开发工程师 ATL组件中文路径注册问题(转载) 关于C++模板的连接问题 - vibration - 博客园 用窗口消息解决COM接口的多线程访问问题 用全局接口表实现COM接口在不同线程中的传递 MyMSN支持自定义内容了 自画菜单的WM_MEASUREITEM只会发送一次 悼念皮皮 上了点照片 一个测试记忆力的小游戏 老板该如何向核心员工许诺 ActiveScript SkinX界面换肤框架更新 反射获取定制Attribute Skin技术实现框架(完)
奇怪的引用错误及解决方法
vibration · 2005-11-16 · via 博客园 - vibration

碰到一个奇怪的问题。

症状
在一个.net workspace中包含多个project,其中两个project应用了同一个.net assamply。这两个project其中一个编译正常,另一个则报错:

error CS0246: The type or namespace name '***' could not be found (are you missing a using directive or an assembly reference?)
居然说我没有正确引用,可是检查项目设置都没有问题。关闭workspace在打开,好了。第二天再编译,又有问题,晕了

错误原因

google半天未果,自己研究。发现被引用的项目有一个Copy Local属性,默认为true,就是把应用的assamply拷贝到输出目录下。原来两个project都企图把同一个assamply拷贝过来,而拷贝成功后还锁定了这个文件。这样第一个项目操作成功并锁定文件后,第二个项目拷贝就失败了,因为无法覆盖被锁定的文件。

解决方法

原因找到了,解决就不难了,把其中一个项目中的引用assambly的Copy Local属性改成false,再编译,就一切OK了 同理,如果有多个project引用同一assamply,除了其中一个的Copy Local属性为true,其他改成false就行了。GAC中的assambly不存在此问题,因为默认Copy Local属性为false。