Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Import Statement Causing Compiler Error CS0246 - Type or Namespace Cannot be found

$
0
0

I have two projects in a solution. One is a Web Part and the other a C# Class.  I have added the reference to the C# class into the Web Part project and am able to see it and reference it via the code by adding a

using ReportingServices;

in the ascx.cs file. This runs and compiles with no issues.

I recently found need to reference the class file directly from the ascx file. I added the import statement

<%@ Import Namespace='ReportingServices' %>

I was able to add the text to the label using:

<Text='<%#ReportingServices.Common.formatMultiField(Eval("MylanCompanyName")) %>' 

Intellisense recognizes the namespace and shows me the public functions. I cleaned the solution and rebuilt it with no errors or issues. However once it is running and I navigate to the page containing the web part I am receiving the CS0246 Type or Namespace ReportingServices Cannot be found.

I know the reference is there because the Using ReportingServices is working fine. So what am I missing that I cannot add an Import Statement?



Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>