The type or namespace name 'Core' does not exist in the namespace 'AuntieDot'

a 夏天 提交于 2019-12-07 03:53:59

问题


I have 4 PCL's, and they are all targeted at the same Frameworks:

AuntieDot:

AuntieDot.Authentication:

AuntieDot.Core:

AuntieDot.Models:

But for some reason, the usage of 'AuntieDot.Core.Helpers' in the 'AuntieDot.Authentication' namespace (despite 'AuntieDot.Core' being added as a reference into 'AuntieDot.Authentication', it's saying it doesn't exist. I've googled around and the only replies I've gotten is that I need to make sure the other libraries are targeted at the same frameworks, which they are.

The only external code I'm using is JSON.net, which I added via NuGet so I don't think that is the issue.

The code in the 'AuntieDot.Core';

The code that is throwing the issue is only complaining in the error list and on compile, it doesn't have a Red-Underline, like usual:

I just thought that maybe posting the Build Output might help; http://pastebin.com/raw.php?i=wn74UKyc


回答1:


Found the Issue, it seems there is a bug with VS when targeting the frameworks I'm targeting. I found this by googleing the The currently targeted framework ".NETPortable,Version=v4.5,Profile=Profile78" does not include "System.Net.Requests, Version=4.0.0.0, Culture=neutral error in the Build Output, this brought me to someone having the same issue on Microsoft's Connect Site. Seems they are fixing this bug soon, but until then Microsoft released this Workaround, thanks to Dave on the VS Team,

Thanks once again for the bug report. We've found another workaround that does not require you to change the frameworks you are targeting. To workaround this, edit the project in a text editor, and add the following underneath the last "Import" element:

<Target Name="_SetFullFrameworkFolderToProfile"
 AfterTargets="GetReferenceAssemblyPaths">

<PropertyGroup>
 <_FullFrameworkReferenceAssemblyPaths>$(TargetFrameworkDirectory)</_FullFrameworkReferenceAssemblyPaths>
</PropertyGroup>
</Target>

Andddd boom:




回答2:


I've had this problem before when referencing other projects in the same solution. My problem was simply that I had that ONE project set to build as Release while the rest of the solution was set as Debug. This meant that even though I referenced the project correctly, the compiler wasnt finding the compiled DLL in the debug directory. Any chance that is it?



来源:https://stackoverflow.com/questions/14527042/the-type-or-namespace-name-core-does-not-exist-in-the-namespace-auntiedot

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!