简体   繁体   中英

C# library is not automatically updated. Compile succeeded but auto-complete failed

I have a library LibA referenced by a console application program AppB. LibA and AppB are not in the same solution. I revised LibA by adding a new static method MethodC to ClassD and recompile LibA. Then I tried to use MethodC in AppB. Auto-complete in the editor failed, that is after I type "ClassD.", I cannot find MethodC in the auto-complete list. Well, no problem, despite this I still continue to typed "MethodC" and compile. Somehow it succeeded! but with a red line under the code in the editor indicating something wrong in the code. But how come compile succeeded. And I open the object browser, LibA is still the old version. Even after I removed the reference and re-referenced LibA, I got the same result.

How can I use the new methods in LibA? What is the correct steps? Thanks.

There are 2 reasons it may not be working as it should.

1.You have referenced a compiled DLL as a dependency from one particular disk path but now compiling to a different place. This may happen if you start playing with AnyCpu, x86, x64 targets. They normally change output from default to target platform specific.

  1. The second reason is that you forgot to tick "Build" checkbox in build configuration for the DLL, which is no longer updating. Check both Release and Debug modes, as it can be set in one, but be cleared in another.

The good starting point is to check to what folder your dependency compiles to. In order to do that you can do a right click on the project, click "Properties", then select "Build" tab, and look for "Target Folder" property.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM