in

CodeSmith Community

Your Code. Your Way. Faster!

Type or Assembly name missing

Last post 04-22-2008 8:12 AM by blake05. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 04-15-2008 6:48 AM

    Type or Assembly name missing

    Hi,

    I have Created a new custom class file inside samplecustomtemplate folder. when i try to use the reference of the class i have created in my cst file,it is giving me error as 'The type or namespace name 'SNEventList' does not exist in the namespace 'CodeSmith.SampleCustomProperties' (are you missing an assembly reference?)'
    I have tried to replicate the same procedure as purchaseorder.cs. but still it is giving me error.please Reply

    Filed under:
    • Post Points: 35
  • 04-22-2008 8:12 AM In reply to

    • blake05
    • Top 25 Contributor
    • Joined on 04-03-2008
    • Wisconsin
    • Posts 166
    • Points 2,790

    Re: Type or Assembly name missing

    Hello,

    I would take a look at the BasicSamples\CSharp\CodeBehind.cst for other examples of using a custom class in your template. However to solve your issue, you need to make sure you have the assemblies referenced and the namespaces imported in your template that you are using.

    Example:

    <%-- Assembly References --%>
    <%@ Assembly Name="SchemaExplorer" %>
    <%@ Assembly Name="CodeSmith.BaseTemplates" %>
    <%@ Assembly Name="CodeSmith.CustomProperties" %>
    <%@ Assembly Name="System.Data" %>
    <%-- Namespace Imports --%>
    <%@ Import Namespace="SchemaExplorer" %>
    <%@ Import Namespace="CodeSmith.CustomProperties" %>
    <%@ Import Namespace="CodeSmith.BaseTemplates" %>
    <%@ Import Namespace="System.Data" %>

    Then set the SRC to your class file and inherits set to the class name (look at the CodeBehind.cst for reference).

    <%@ CodeTemplate Language="C#" TargetLanguage="Text" src="SampleCustomProperties.cs" Inherits="main" Debug="False" Description="Template description here." %>

    Thanks

    -Blake Niemyjski

    Blake Niemyjski
    CodeSmith Tools, LLC
    Support Specialist
    Filed under:
    • Post Points: 5
Page 1 of 1 (2 items)
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems