I've created a number of addins using the community addin template. I haven't had any 'show stopper' issues using the template so far.
Now I think I may have hit a major problem. I want to distribute addins in Visual Studio 2015 Installers (if possible).
I thought I'd solved all the tricky stuff today, like registering some of my dependencies in the GAC and getting Microsoft Reporting to play nicely, but addin button images are creating a problem that I guess I should have seen coming...
Using the template, button images are getting embedded into the addin dll when it builds. I understand this and there is a comment in assemblyinfo confirming that "BMP|PNG images will be embedded as Win32 resources after build".
I (maybe wrongly) assumed that VS Installer would be picking up the 'Project Output' from the 'built' addin dll and would therefore contain the images, but this does not appear to be the case.
When I install the addin to a test machine, all the buttons are there and the addin functions correctly. However, there are no images on the buttons!
Please can someone try and help get me out of this very large hole I seem to have dug myself into!
The first thing I'd suggest is dragging\dropping the release build of your addin.dll into Visual Studio and verifying that the images are embedded into it. The installer shouldn't have anything to do with it.
Thanks for the reply.
Yup, checked that and the button images appear OK when the built add-in output is copied and registered on the test VM. So, it's definitely something that VS Installer is doing. I see the same behaviour with two independently developed addins.
What I've had to do is specify an 'exclude filter' for the installer, so it doesn't copy the add-in dll as part of the 'primary output' to the target application folder. Then, I get the installer to use the built dll from the add-in build folder instead. This solves the problem, but it's just a little messy.
To add, one of my developers has created a little dll to handle the regasm aspect of the install, as an installer 'custom action'. I could share that here if it's any use to others who may want to distribute their addins using VS Installer.
Jason, we got to the bottom of this and I have an update...
The problem is caused by the 'EmbedNativeResources.exe' call in the addin interop targets. This means the the resources are getting added to the assembly, but only AFTER the installer has built.
The way we're getting around this for now, is by modifying the SolidEdge.Community.Addin.Targets as follows...
<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <EmbedNativeResourcesPath>$(MSBuildThisFileDirectory)..\..\Tools\net40\EmbedNativeResources.exe</EmbedNativeResourcesPath> </PropertyGroup> </Project>
...and adding a post build compile event to the addin project instead, which calls a copy of the EmbedNativeResources.exe located in a common tools folder:
C:\MajentaPLM\Tools\EmbedNativeResources.exe "$(MSBuildProjectDirectory)" "$(TargetPath)"
This has fixed the problem, but it's a little fiddly. What's your thoughts?
I haven't looked at the VS installer projects in awhile and admittedly have not tested it with the AddIn NuGet package. I'd be interested in seeing what you have via Skype. I'll email you offline.
I have the same problem with my addin. No images on ribbon bar when I make a VB installer. I tried to follow DaveR guidelines with no success, First I made the exclude filter and included the addin.dll using "Add file" in Installer properties but when I installed the addin no addin was available, later I tried the other solution, editing targets file and adding a Post Compile Build Event with nativeresources.exe stored in other folder, no success again.