Visio Guy

Visio Discussions => Programming & Code => Topic started by: jnk on November 06, 2017, 10:25:44 AM

Title: .Net Framework 4.6.1 upgrade
Post by: jnk on November 06, 2017, 10:25:44 AM
Hi All,

Long time lurker, first time poster.

I have over the past few years been playing around with a VSTO add-in which has been working well. I recently re-built my machine and reinstalled Visual Studio which and when I opened my solution I am getting a few errors which I think I have worked out is due to a .Net upgrade from version 4 to version 4.6.1. I am not a developer and have seemed to have fumbled my way around well enough but this one has me stumped and was wondering if anyone has experienced this.
A sample of the errors I get are:

Error   BC30590   Event 'Startup' cannot be found.
Error   BC30456   'ActiveWindow' is not a member of 'Application'.

I would love any insights that can save me from having to create a new solution and migrate all the code. Oh I should have mentioned, if I create a new VSTO solution I don't get the same errors...

Cheers
JnK
Title: Re: .Net Framework 4.6.1 upgrade
Post by: Paul Herber on November 06, 2017, 10:56:27 AM
Could you post the lines of code that generates these errors?
Title: Re: .Net Framework 4.6.1 upgrade
Post by: jnk on November 07, 2017, 05:54:12 AM
Certainly. The following code snippets cause the error. This was working perfectly before Visual Studio upgraded the solution to .Net Framework 4.6.1. The following code also works perfectly on a new solution that I create from scratch on .Net framework 4.6.1. It seems that something "breaks" when Visual Studio upgrades the solution.

I have tested this on multiple machines and multiple versions of identical code. The only difference is that as soon as VS upgrades the framework, these errors appear.

Code snippet 1

    Private Sub ThisAddIn_Startup() Handles Me.Startup
        _panelManager = New PanelManager(Me)

        visioApplication = GetObject(, "Visio.Application")

    End Sub

Code snippet 2

    Public Sub TogglePanel()
        _panelManager.TogglePanel(Application.ActiveWindow)
    End Sub
Browser ID: smf (is_webkit)
Templates: 1: Printpage (default).
Sub templates: 4: init, print_above, main, print_below.
Language files: 1: index+Modifications.english (default).
Style sheets: 0: .
Hooks called: 51 (show)
Files included: 25 - 922KB. (show)
Memory used: 747KB.
Tokens: post-login.
Cache hits: 8: 0.00164s for 22,301 bytes (show)
Cache misses: 2: (show)
Queries used: 11.

[Show Queries]