Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

References and external class use problems

Using Visual Studio 2015 on an ASP.NET project. Everything works fine except now I have a block of code (A common AD utility function) that I want all the pages to be able to access. The original language (inherited project) is VB.NET, but it should work just fine either way.

I created a class file, named it CommonADFunctions.vb. The file uses System.DirectoryServices, and there's a reference in the project to that assembly. However, there are two problems:

  1. I can't reference the new class to call the functions from any of the page code files. This includes attempts to instantiate a new variable as the class type.
  2. When I move the new .VB file into App_Code, the reference to System.DirectoryServices breaks, and it refuses to build.

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

like image 819
Jaaz Cole Avatar asked Feb 14 '18 15:02

Jaaz Cole


1 Answers

Turns out this was a simple property on the file itself I created a new Class File, and somehow the Build Action got set to Content rather than Compile. Setting this to Compile allowed the object to be referenced and instantiated properly. It doesn't fix the IDE intelliSense from APP_Code for DirectoryServices references in the code, but it compiles and runs, which is what I needed.

EDIT: Received external help which pointed this out.

like image 142
Jaaz Cole Avatar answered Oct 16 '22 17:10

Jaaz Cole