References and problems using an external class

Using Visual Studio 2015 in an ASP.NET project. Everything works fine, except that now I have a block of code (a common AD AD function) and I want all pages to have access. The source language (inherited project) is VB.NET, but it should work just fine anyway.

I created a class file named CommonADFunctions.vb. The file uses System.DirectoryServices, and there is a link in the project to this assembly. However, there are two problems:

  • I cannot reference the new class to call functions from any of the page code files. This includes trying to create a new variable as a class type.
  • When I move the new .VB file to App_Code, the link to System.DirectoryServices breaks and it refuses to build.

This may seem like trivial demand, but what am I missing?

+6
source share
2 answers

It turns out that this was a simple property in the file itself, I created a new class file, and somehow the Build action was set to Content, not compilation. Setting this parameter to compilation allows the object to be referenced and created accordingly. It does not fix the intelliSense IDE from APP_Code for DirectoryServices links in the code, but it compiles and runs what I need.

EDIT: Got external help that pointed this out.

+1
source

Without code and screenshots to illustrate, I can only recommend a few things to try.

. .

  • Private Friend.

  • static ( VB.Net), .

  • - DLL, . AD , "Referenced" Project.

.VB App_Code, System.DirectoryServices , .

. , .suo, obj bin.

CommonADFunctions.vb App_Code DLL System.DirectoryServices. CommonADFunctions.vb App_Code .

0

All Articles