Developer forum

Forum » Development » Namespace Dynamicweb.Notifications not found!

Namespace Dynamicweb.Notifications not found!

Rob Lohmann
Reply
I'm busy developing a NuGet Package which should contain Dynamicweb functionality. I've currently got the following structure;
- Solution
  - VB.Net Class library
     - JS Directory
        - MyJsFile.js
     - CookieNotificationNotificationSubscriber.vb

This last file contains the following small piece of code. And i've added the references to Dynamicweb.dll, Dynamicweb.Admin.dll, Dynamicweb.Controls.dll and Dynamicweb.Diff.dll. In the reference section of the projectproperties I've selected Dynamicweb.Notifications as an Imported namespace, but this doesn't help

Imports Dynamicweb.Frontend
Imports Dynamicweb.Extensibility
Imports Dynamicweb

'The line below gives an error saying 'Cannot resolve symbol notifications'
<Subscribe(Dynamicweb.Notifications.Standard.Page.PageTitle)> _
Public Class CookieNotificationNotificationSubscriber
    Inherits NotificationSubscriber

    Public Overrides Sub OnNotify(ByVal notification As String, ByVal args As Object())
        Dim pageView As PageView = TryCast(args(0), PageView)

        pageView.AddJavascript("Js/cookie-settings.js")
    End Sub
End Class
However I keep getting Build- and ReSharper error because Dynamicweb.Notifications can't be resolved. What can this be?

Replies

 
Pavel Volgarev
Reply
Hi Rob,

Which version of .NET framework are you targeting within your project? And which version of Dynamicweb.dll are you referencing?

-- Pavel
 
Rob Lohmann
Reply
Hi Pavel,

The package is intended for DW 7.2 at the moment, but later on maybe also for DW8. So i've targeted the .NET 3.5 framework and the references dll files are from core version 19.2.9.4, with versionnumber 18.9.1.1.

- Rob
 
Pavel Volgarev
Reply
Hi Rob,

Could you upload the project?

-- Pavel
 
Rob Lohmann
Reply
Hi Pavel, 

See the attached file. Hope you can help!

-- Rob
 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply
This post has been marked as an answer
Hi Rob,

The reason for this issue is that you have Dynamicweb in your root namespace for the project. If you type Dynamicweb. in the editor, you'll only see Cookies appear, and not the Dynamicweb namespaces. Either change the root namespace to something like Innovadis.DW.Cookies or Innovadis.Cookies or explicitly refer to the Global DW namespace like this in your subscriber:

<Subscribe(Global.Dynamicweb.Notifications.Standard.Page.PageTitle)>

Hope this helps,

Imar

Votes for this answer: 0
 
Rob Lohmann
Reply
Hi Imar,

That did it. Thanks! Will keep it in mind for future development.

Rob

 

You must be logged in to post in the forum