Search code examples
c#referencevisual-studio-2019

Do Visual Studio Reference gets compiled after build?


Do Visual Studio Reference gets compiled after build?

If not, do they have to be the same directory that the app is looking for?

For example, I have a reference in C:/somefolder/someref.dll, when I build it and pass it on someone's device, do they need to have the reference on the same exact folder or is that not needed (it gets compiled along with the app)

I'm building a C# class library app/plugin then upon adding a reference, PDFSharp to be specific, it tells me System.IO.FIlenotfound Exception even though the nuget package is added


Solution

  • When you build a class project, you can export referenced external DLLs to the output directory. However, the external DLL must also be present in the location where the startup project's executable file is located. Therefore, when a class project is referenced by an executable project, you must also reference the external DLLs referenced by the class project and export them to the output directory.