locked
The type or namespace name 'DbContext' could not be found (are you missing a using directive or an assembly reference? RRS feed

  • Question

  • Hello everybody,

    i have some issues with building on tfs service. The solution builds locally with vs, but not in den cloud. I think the issue is, that the package restore seems to not work. The log file tells:

    "C:\a\src\.nuget\nuget.exe" install "C:\a\src\myProject .Models\packages.config" -source ""  -RequireConsent -o "C:\a\src\packages"
    All packages listed in packages.config are already installed.

    and then somewhat later:

    Primary reference "EntityFramework".
    C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "EntityFramework". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [C:\a\src\myProject.Models\myProject.Models.csproj]
              For SearchPath "C:\a\src\myProject.Models\FakesAssemblies".
              Considered "C:\a\src\myProject.Models\FakesAssemblies\EntityFramework.winmd", but it didn't exist.
              Considered "C:\a\src\myProject.Models\FakesAssemblies\EntityFramework.dll", but it didn't exist.
              Considered "C:\a\src\myProject.Models\FakesAssemblies\EntityFramework.exe", but it didn't exist.
              For SearchPath "{HintPathFromItem}".
              Considered "..\packages\EntityFramework.5.0.0\lib\net45\EntityFramework.dll", but it didn't exist.

    For me it seems to check the packages but later it does not find the entityframework. The packages config for that project looks like this

    <?xml version="1.0" encoding="utf-8"?>
    <packages>
      <package id="EntityFramework" version="5.0.0" targetFramework="net45" />
    </packages>

    Any ideas? The solution consist of 4 projects. One is only for ressources, one is for the models, one is for services (including dbcontext) and one is the mvc project.Every project has the nuget package entityframework enabled.

    Kind regards

    Andi



    • Edited by Rudsen Sunday, June 30, 2013 10:15 AM
    Sunday, June 30, 2013 10:12 AM

Answers

  • Hi Andi,

    From your post, we can see it just a warning. It said:

    Could not resolve this reference. Could not locate the assembly "EntityFramework". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.

    It seems you add a wrong reference or computer can't find the dll in the gac. Please check the reference you added in the project. I am suggesting you add the hintpath like:

    <Reference Include="EntityFramework">
        <HintPath>..\..\..\EntityFramework.dll</HintPath>
    </Reference>
    Best regards,

     


    Ego [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, July 2, 2013 7:29 AM

All replies

  • Hi Andi,

    From your post, we can see it just a warning. It said:

    Could not resolve this reference. Could not locate the assembly "EntityFramework". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.

    It seems you add a wrong reference or computer can't find the dll in the gac. Please check the reference you added in the project. I am suggesting you add the hintpath like:

    <Reference Include="EntityFramework">
        <HintPath>..\..\..\EntityFramework.dll</HintPath>
    </Reference>
    Best regards,

     


    Ego [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, July 2, 2013 7:29 AM
  • Hi,

    Since we haven't heard from you for a long time, I temporarily close this case. I mark useful reply as answer. If you have any concerns, please free feel to reopen it or submit a new question. Thanks for your understanding.

    Regards,


    Lily Wu
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, July 5, 2013 9:24 AM
    Moderator