Author Topic: "Hello World" AddIn example  (Read 4876 times)

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8595
  • Karma: +256/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
"Hello World" AddIn example
« on: October 13, 2020, 10:25:30 pm »
I have an "ancient" C# AddIn (last compiled/created in 2012 - in whatever VS version was extant at the time).  I am trying to "resuscitate" it To run under the latest .Net framework and VS 2019).  But encountering problems.

The main issue is that we are unable to get the breakpoints to trigger - because the debug symbol files aren't being created.

I believe the best approach (after a couple of days of frustration) is to start with a really simple AddIn and then try to absorb the ancient code into the working AddIn - hopefully not breaking anything on the way.

Can anyone point me at a simple "Hello World" type AddIn source code in C#?  I tried creating my own, but in trying to simplify the existing complex AddIn, I've failed.  The C# sample code is for a standalone EXE and (as far as I can see) can't be converted to a normal AddIn.  All of the AddIns I've previously built use the same architecture and are complex sharing common code[1].  As I've discovered, trying to untangle this (after nearly a decade) is not simple.

Many Thanks in Advance,
Paolo

[1] In case, you're wondering, I've been reusing the same executables for the AddIns since those days (in the main).  Unfortunately, trying to do the same for this one, triggers a encryption protection error which I can't seem to get around.  Things have obviously changed... Language, Compiler, OS   :'(
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: "Hello World" AddIn example
« Reply #1 on: October 13, 2020, 11:59:09 pm »
Well, Geert has one. First Google hit...

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13241
  • Karma: +554/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8595
  • Karma: +256/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: "Hello World" AddIn example
« Reply #3 on: October 14, 2020, 12:16:28 am »
Well, Geert has one. First Google hit...

q.
How we are manipulated by Google...
It was on page 2 for me...

I'll check it out!   Thanks, qwerty (and, of course, Geert)!

BTW, should it work with the latest and greatest VS Community 2019, .Net framework 4.7.2  and Packagers?  I note that the previous packagers didn't make it during the "upgrade".

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: "Hello World" AddIn example
« Reply #4 on: October 14, 2020, 12:17:43 am »
I once created my add-in based on that and use the current VS without issues.

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13241
  • Karma: +554/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: "Hello World" AddIn example
« Reply #5 on: October 14, 2020, 01:40:34 am »
Well, Geert has one. First Google hit...

q.
How we are manipulated by Google...
It was on page 2 for me...

I'll check it out!   Thanks, qwerty (and, of course, Geert)!

BTW, should it work with the latest and greatest VS Community 2019, .Net framework 4.7.2  and Packagers?  I note that the previous packagers didn't make it during the "upgrade".

Paolo
Yes, you can use the latest greatest of both VS as the .Net framework.
Not sure what you mean by "Packagers"

Geert

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8595
  • Karma: +256/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: "Hello World" AddIn example
« Reply #6 on: October 14, 2020, 08:43:52 am »
[SNIP]

Yes, you can use the latest greatest of both VS as the .Net framework.
Not sure what you mean by "Packagers"

Geert
Packagers are the projects that create the MSIs, installers etc.  My setup project (that creates an MSI) was deemed incompatible.

Anyway, a new day here and I'll give it a go when I start work.

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13241
  • Karma: +554/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: "Hello World" AddIn example
« Reply #7 on: October 14, 2020, 02:53:29 pm »
I use WIX to do that. You have to install that as a separate add-in for VS

Geert

Ian Mitchell

  • EA User
  • **
  • Posts: 506
  • Karma: +22/-4
  • The eaDocX and Model Expert guy
    • View Profile
Re: "Hello World" AddIn example
« Reply #8 on: October 14, 2020, 09:27:14 pm »
If it's any consolation, I still go back to Geert's example at least once a year, when I need to create a brand new addin - @Geert - please don't ever remove this page :-)
Ian Mitchell, Designer, eaDocX


www.eaDocX.com
www.theartfulmodeller.com

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13241
  • Karma: +554/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: "Hello World" AddIn example
« Reply #9 on: October 14, 2020, 09:44:04 pm »
If it's any consolation, I still go back to Geert's example at least once a year, when I need to create a brand new addin - @Geert - please don't ever remove this page :-)
Wasn't planning to remove it, don't worry.
It might need some updating though, since it dates back to 2011

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: "Hello World" AddIn example
« Reply #10 on: October 14, 2020, 10:46:20 pm »
Some things never get old.

q.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8595
  • Karma: +256/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: "Hello World" AddIn example
« Reply #11 on: October 14, 2020, 11:01:42 pm »
Some things never get old.

q.
Well, after a long, but ultimately successful day, I've managed to resuscitate the AddIn to the point where I'm able to execute and debug the AddIn.

So a big thanks to Geert!

I was able to get his AddIn up and running and then, bit by bit (like cooking) add in each sub-project - resuscitating it along the way.  Lots of things have changed in the interim, but once I got the "hang of it" it was fairly easy.  Ultimately, I was able to substitute my main Add-In mainline to recreate the AddIna nd allow me to debug things.

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13241
  • Karma: +554/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: "Hello World" AddIn example
« Reply #12 on: October 14, 2020, 11:29:23 pm »
Good to hear that you got it running again.

Geert