“Are you missing an assembly reference?” compile error - Visual Studio

后端 未结 9 635
悲&欢浪女
悲&欢浪女 2020-12-09 08:48

I am currently working on a server control for other applications in our company to interface with a WCF service. Every time I make a change code change and recompile the c

相关标签:
9条回答
  • 2020-12-09 09:03

    Right-click the assembly reference in the solution explorer, properties, disable the "Specific Version" option.

    0 讨论(0)
  • 2020-12-09 09:06

    I encountered this error with an Azure DevOps Services (MS-hosted) build pipeline on a TFVC repo.

    In my case, I was working within a branch and had accidentally added the reference from the package folder in trunk instead of from the branch. Once I added the reference from within the branch, it started compiling successfully.

    I.e., while working on \branch-beta\sierra.csproj, I accidentally referenced \trunk\packages\delta.dll. Obviously, I needed to reference \branch-beta\packages\delta.dll instead. The mixup occurred because the path is not prominently displayed in the Add Reference window and I didn’t check carefully enough.

    0 讨论(0)
  • 2020-12-09 09:10

    In my case it was a project defined using Target Framework: ".NET Framework 4.0 Client Profile " that tried to reference dll projects defined using Target Framework: ".NET Framework 4.0".

    Once I changed the project settings to use Target Framework: ".NET Framework 4.0" everything was built nicely.

    Right Click the project->Properties->Application->Target Framework

    0 讨论(0)
  • 2020-12-09 09:16

    I bumped the answer that pointed me in the right direction, but...

    For those who are using Visual C++:

    If you need to turn off auto-increment of the version, you can change this value in the "AssemblyInfo.cpp" file (all CLR projects have one). Give it a real version number without the asterisk and it will work the way you want it to.

    Just don't forget to implement your own version-control on your assembly!

    0 讨论(0)
  • 2020-12-09 09:19

    Are you strong-naming your assemblies? In that case it is not a good idea to auto-increment your build number because with every new build number you will also have to update all your references.

    0 讨论(0)
  • 2020-12-09 09:19

    I found this issue in Visual Studio 2019 Version 16.4.4

    I resolved most issues by discovering that the

    packages.config
    

    was missing the appropriate reference

    eg:

    <package id="System.Runtime" version="4.3.0" targetFramework="net461" />
    
    0 讨论(0)
提交回复
热议问题