We have a .NET application for Windows which is installed locally by Microsoft Installer. Now we have the need to use additional assemblies which are located online at our Web Servers. We'd like to refer to a remote uri like https://www.ourserver.com/OurProductName/ExternalLib.dll and reveal additional functionality, which is described roughly by a known common ("AddIn/Plugin") Interface. These are not 3rd Party Plugins, we just want be able to exchange parts of the application frequently, without the need to have frequent software updates.
Our first idea was to add some kind of "remote refence" in Visual Studio by setting the path to the remote assembly uri. But Visual Studio downloaded the assembly immediately to a temporary directory, adding a reference to it.
Our second attempt then, is simply using a WebRequest
(or WebClient
) to retrieve a binary stream of the Assembly, loading it "from image" by using Assembly.Load(...)
. This actually works, but is not very elegant and requires more additional programming for verification etc.
We hoped Clickonce would provide useful techniques but apparently it's suitable for standalone applications only. (Correct me?)
Is there a way (.net native or by framework/api) to reference remotely located assem开发者_高级运维blies?
Thanks in advance and have a happy easter!
You can add the reference in Visual Studio, then call Assembly.Load
to load it from the URL in your code.
As long as you set Copy Local
and Specific Version
to false on the reference, it will not be tied to that particular version.
Upvoting SLaks
(no accept since it didnt get me any further) and "closing" the question as it seems that there is no better way (at the moment) then doing it the manual way.
精彩评论