Code Red > .NET

Updating Add-ins from server

(1/5) > >>

Jeff H:
I will go more detail in later post if needed but attached is project that should work for 2016 and from description below and looking at code should be able to figure out how it works.

This has worked well for me for everyone getting the latest dlls, cuix, etc..  in an environment where there is a
* local server
* everyone has access to the server, and are mapped with same drive letter
* for installation just sent out email with link to app.bundle folder to copy and paste into their %appdata%\Autodesk\ApplicationPlugins
* a machine for development is connected to the serverThe attachment contains the following folders with short description.

* Server Folder - This is meant to mimic the server folder and there are few things you need to change to path of this folder
* TheSwamp - This contains the Solution with 3 projects
*
* TheSwampAddinLoader - This just opens the TheSwampAddinLoader.loadconfig file to get the "UpdateDirectory" value which should be the path of where the TheSwampAddInLoaderData.loadData file and all files that need to be copied or updated are located
* TheSwampAddin1 - all files for this project are first copied and overwritten if newer then is loaded by TheSwampAddinLoader
* TheSwampAddin2 - all files for this project are first copied and overwritten if newer then is loaded by TheSwampAddinLoader
* TheSwamp.AddinLoader.bundle  This contains the app.bundle folder with TheSwampAddinLoader.loadconfig fileHere is how it works.

* The TheSwamp.AddinLoader.bundle uses the AutoLoader functionality to load in TheSwampAddinLoader.dll.
* It looks in same folder as TheSwampAddinLoader.dll for TheSwampAddinLoader.loadconfig file which is an xml file with "UpdateDirectory"with the location of TheSwampAddInLoaderData.loadData file. It will copy all files from "UpdateDirectory" into the TheSwamp.AddinLoader.bundle folder using the parameters set by .loadata file. In the attached project UpdateDirectory="%userprofile%\Documents\Visual Studio 2015\Projects\Server Folder\TheSwampApps\v20.1" which contains the TheSwampAddInLoaderData.loadData file and files to be copied
* The TheSwampAddInLoaderData.loadData file tells what files type of files to copy, if it should copy sub-directories, and which files to Load into AutoCAD.

How to get it working after download and unziping.

* Edit the ~\TheSwamp.AddinLoader.bundle\Contents\Windows\2016\TheSwampAddinLoader.loadconfig file by changing the value of "UpdateDirectory" to the location of ~\Server Folder\TheSwampApps\v20.1 where  where it resides on your computer now
* Copy and paste the TheSwamp.AddinLoader.bundle folder to %appdata%\Autodesk\ApplicationPlugins folder
* Start AutoCAD
* Edit TheSwampAddin1 and/or TheSwampAddin2
* Use the ServerRelease configuration to build project(The ServerRelease is just the Release build with output folder set to location of .loaddata file so it puts dll and any referenced dll into folder to be copied)
* Close and Start AutoCAD

TheSwampAddinLoader.loadconfig

--- Code: ---<?xml version="1.0" encoding="utf-8" ?>
<AddInLoaderUpdatePath
  UpdateDirectory="%userprofile%\Documents\Visual Studio 2015\Projects\Server Folder\TheSwampApps\v20.1">
</AddInLoaderUpdatePath>

--- End code ---
TheSwampAddInLoaderData.loadData

--- Code: ---<?xml version="1.0" encoding="utf-8" ?>
<AddInLoaderData CopySubDirectories ="false" ExtensionFilter =".dll|.cuix|.mnr">
  <LoadFiles>
     <LoadFile>TheSwampAddin1.dll</LoadFile>
    <LoadFile>TheSwampAddin2.dll</LoadFile>   
  </LoadFiles>
</AddInLoaderData>

--- End code ---

MexicanCustard:
Nice work Jeff.  I've been working on something similar that uses FileSystemWatcher to look for folder changes then prompts the user. If the user chooses to update, it spins up the updater, and shuts down Autocad.  The updater waits for Autocad to shut down and copies over the files then fires up Autocad again and shuts down.

Jeff H:

--- Quote from: MexicanCustard on March 31, 2017, 08:00:38 AM ---Nice work Jeff.  I've been working on something similar that uses FileSystemWatcher to look for folder changes then prompts the user. If the user chooses to update, it spins up the updater, and shuts down Autocad.  The updater waits for Autocad to shut down and copies over the files then fires up Autocad again and shuts down.

--- End quote ---
Thanks,
If it was used for something main stream or commercially available app then would need something like you got.

Atook:
Great stuff Jeff, thanks for posting example code and an explanation.

pBe:
Hi Jeff H,

Great code, one question though. I change  R20.1 to 19.0...


--- Code - C#: ---<RuntimeRequirements OS="Win32|Win64" Platform="AutoCAD|AutoCAD*" SeriesMin="R19.0" SeriesMax="R21.0" />
It worked with versions 14,16 and 17 but not with Autocad 2015? Is it just me or there's something else that needs changing?

Thank you in advance.

pBe

Navigation

[0] Message Index

[#] Next page

Go to full version