我有5个项目的解决方案。其中之一:" project.core.common"(.NET Framework 3.5)。我有问题。当我尝试编译时,我会收到错误:
错误79类型或名称名称"服务器"不存在 命名空间'dllfile.logging'(您是否缺少一个组件 参考?)d: solution project.core.common
但是存在此名称空间DllFile.Logging.Server
。我可以通过在对象浏览器中打开DllFile.dll
来看到它。
参考我的项目中添加的DllFile.dll
。
DllFile.dll
具有.NET FW 2.0.50727运行时版本。
我收到有关此DllFile.dll
的74个警告:
警告4主要参考" dllfile.logging.server,版本= 6.3.1.0, 文化=中性,加工结构= MSIL无法解决 因为它对.NET框架组件有间接依赖性 " Mscorlib,版本= 4.0.0.0,culture =中性, publicKeyToken = B77A5C561934E089"具有更高版本的" 4.0.0.0" 比当前目标中的版本" 2.0.0.0" 框架。project.core.common
,但是DllFile.dll
不使用任何依赖关系到第四框架。它以2.0框架写入。
和重要的一件事:此项目对除了我的任何计算机都没有任何错误进行编译。我在以下环境中进行了检查以进行编译:
VS 2010 (Windows XP SP3 x86)
VS 2010 (Windows 7 x86)
VS 2010 (Windows 7 x64)
VS 2013 (Windows 8.1 x64)
在每台计算机上,此项目都可以满足。但是在我的计算机上(VS 2010 Windows XP SP3 X86),我会收到此错误和警告。
我尝试做的事情:
- 我完全卸载了与2010年的所有组件,然后再次安装。
- 我删除了以下文件夹:
c: documents and Settings user 本地设置 application 数据汇编
c:文档和设置 user 本地设置 application data cache (以防万一删除)
c: documents and Settings user 本地设置 application 数据 Microsoft Team Foundation
c: documents and Settings user 本地设置 application 数据 Microsoft VisualStudio
c: documents and Settings user 本地设置 application 数据 Microsoft VScommon
c: documents and Settings user 本地设置 application 数据 websitecache
c:文档和设置 user vswebcache
c:文档和设置所有用户应用程序 Data Microsoft Vstahost SSIS_ScriptTask 9.0 itemTemplatesCache
c:文档和设置所有用户应用程序数据 Microsoft vstahost ssis_scriptTask 9.0 projectTemplatesCache
c:文档和设置所有用户 application data vs vs10sp1 setupcache
- 删除以下文件:
C:Documents and SettingsAll UsersApplication DataMicrosoftVisualStudio10.0vs000223.dat C:Documents and SettingsAll UsersApplication DataMicrosoftVisualStudio10.01033devenv.CTM C:Documents and SettingsAll UsersApplication DataMicrosoftVisualStudio10.01033ResourceCache.dll C:Documents and SettingsAll UsersApplication DataMicrosoftVSA9.01033ResourceCache.dll C:Documents and SettingsAll UsersApplication DataMicrosoftVSA9.01033vsaenv10.CTM C:Documents and SettingsAll UsersApplication DataMicrosoftVSTAHostSSIS_ScriptComponent9.01033ResourceCache.dll C:Documents and SettingsAll UsersApplication DataMicrosoftVSTAHostSSIS_ScriptTask9.01033ResourceCache.dll
- 清除以下文件夹:
C:Documents and SettingsUserLocal SettingsTemp
- 我也试图清除缓存。我在CMD中执行了以下命令:
cd C:Program FilesMicrosoft Visual Studio 10.0Common7IDE devenv /resetuserdata
,但没有任何帮助。
我还能做些什么来解决我的奇怪问题?(除了重新安装Windows)
编辑:
更改属性'复制local'(true/false)为参考'dllfile.dll'无用。
我尝试创建新的空项目,并添加对此库" dllfile.dll"的引用,并且此错误也存在于空项目中。所以问题不在我的真实项目中。
转到您的解决方案资源管理器,然后选择显示所有文件。然后进入您的项目bin并展开dllfile.dll,然后查看有dllfile.dll.refresh文件,如果是,则删除并清洁解决方案并重建项目应该成功构建。
这是一个旧的错误,即使在Visual Studio 2019(社区版)中也存在。IDE不会更新您从中引用另一个项目的项目文件。但是,在您看到的设置中,好像链接在那里。您应该手动添加参考:
将其写入项目文件(或可以从链接正常工作的另一个项目中复制):
<ItemGroup>
<ProjectReference Include="...path...YourProject.csproj" />
</ItemGroup>
这解决了问题。