Unable to use PDFNet UWP VSIX package with Visual Studio Team Server

Question:

I am trying to deliver our app through Visual Studio Team Services.

The problem I am facing right now is that I can not install the PdfTron for UWP on the CI because it is distributed as a Visual Studio extension (.vsix) and our CI uses a hosted agent. The hosted agent is a prepared Windows image that we don’t have full control over, and that doesn’t allow any kind of administrative rights on the build definitions.

How can we use PDFNet UWP VSIX package in this case?

Answer:

One solution would be to unzip/extract the VSIX file, which is just a ZIP.

Once unzipped you have access to the PDFNet.dll files in the Redist/CommonConfiguration folder.

Since there are different DLL’s for each platform, you will need to work around this using a project variable to change the referenced DLL accordingly to the right architecture.

Extract the VSIX package and copy all the content of each platform (in Configuration and Redist folders) to the same platform folder.
Then add a reference to the .winmd file directly to the UWP project, just changing the architecture.

The referenced dependency in the UWP project is now the following:

Take a look at the $(Platform) variable, that will change the reference to x86, x64 or ARM as needed, to point the reference to the correct folder.

<Reference Include="pdftron, Version=255.255.255.255, Culture=neutral, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\references\pdfnet\uwp\$(Platform)\pdftron.winmd</HintPath> </Reference>