How to force Visual Studio to reference local Ente

2019-03-02 14:25发布

问题:

I've got a asp.net project that references Enterprise Library DLL's. I can build and deploy my project but the deployment build fails because it can't find the DLL's. I peeked at the properties for Microsoft.Practices.EnterpriseLibrary.Common, for example, and I notice that the file path is where it was installed in \Program Files\yada yada... I've attempted Add Reference to my project and specifically choose the dll from my /lib folder which gets deployed with my project. VS just seems to say "yeah, sure". The file path remains to be the one under "Program Files..."--what I am assuming is a GAC reference. I tried looking at the GAC to uninstall, but I don't see it there. Can someone help me explain to VS that I really do want this local file?

回答1:

Okay, I had to dig into the .proj files. Under are tags. You can add within the Reference tags to direct the project to a specific DLL instance.

<ItemGroup>
  <Reference Include="Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" >
    <HintPath>..\lib\Microsoft.Practices.EnterpriseLibrary.Common.dll</HintPath>
  </Reference>
  ...


回答2:

Highlight the reference in the Solution and change the "Copy Local" in the properties window to True, see if that helps.