1. 程式人生 > >vs clean或rebuild時自動刪除dll的解決方法

vs clean或rebuild時自動刪除dll的解決方法

The bin folder is just the binary output from a build, so when you clean your solution, all the assemblies in the bin folder get deleted. You should reference the assemblies from some other location. One suggestion is to create a Shared Resources folder within your project, copy your assemblies to that folder, then reference them from that folder. This way they won't get deleted from  bin on a clean/rebuild and Visual Studio will copy them there as needed.


1.Right-click on the References folder in your project and choose Add Reference...
2.Use the browse functionality to locate the assemblies you want to reference (don't worry about manually copying them to/from your bin folder)
3.After the reference is added, right-click on the reference in your references list and choose Properties
4.Make sure the Copy Local property is set to True

This will ensure that assembly is copied to your bin folder on every build.

確保不要在bin下面儲存需要持久化的dll或其他檔案,有可能(但並非一定)會被刪除。

引用dll後,右鍵該dll,確保Copy Local property 設定為true。

外記:突然就崩了,鬱悶死了......