Release of the program with a third-party library. C#

Question:

I connected a third-party library via NuGet(OxyPlot). How to release? What files are needed to run the program on other PCs?

Answer:

To work on other PCs, several conditions must be met:

  1. The .NET Framework must be installed, version no lower than the target version specified in the project (see project properties).

  2. Third-party library files must be located next to the executable, or be available for loading into memory in any other way, such as through the GAC, as system assemblies, or a more complex folder structure in the project. It is not at all necessary to dump everything in one folder, you can carefully decompose it into nested ones, here the main thing is to correctly register the links in the project.

With a regular installation via NuGet, a third-party library is linked into the project with the Copy local parameter set to true . This setting specifies whether to copy the included DLL to the application's output directory. So you can force the system assemblies to be copied, but this is not necessary. If you doubt that your included DLL will end up in the application folder, just check this setting in the properties of the included assembly.

In principle, to distribute your application, it is enough to switch the project configuration to Release and build the project, then simply copy the /bin/Release folder to the target machine or pack the folder into an archive and put it on the network. If you need an installer, then you can use the ClickOnce technology (a link to the documentation was given by @Bulson in the comment under the question) or any other installer that you are more familiar with or just like.

In favor of ClickOnce, we can attribute the built-in automatic update mechanism with the appropriate setting of publishing rules. However, if you have a large project, then you should not use Visual Studio for publishing, because. its built-in publishing does not allow for a partial update and customers will have to download everything with every update. Manual publishing of a ClickOnce application is also possible, but that is beyond the scope of this question.

UPD: The ClickOnce installer has one bad interface feature. Despite the full support for partial updates, in which only changed libraries are downloaded from the source, and the rest are simply copied locally to a new folder, you might think that the entire application is downloaded by the appearance and behavior of the interface, but this is not so. The mechanism works as expected and no extra traffic is consumed, it's just that the interface solution is not very successful, although it doesn't matter to anyone. This fact was checked personally, at the urgent request of one of the users.

Scroll to Top