[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Problem with namespaces in my T4 templates

Posted on 2011-02-16
2
Medium Priority
?
945 Views
Last Modified: 2012-05-11
I am having trouble getting the T4 template to compile sine it finds a problem with the namespace.

I add a second import after the working one.  

<#@import namespace="System.Collections.Generic" #>
<#@import namespace="RDDBWebAdmin.Models" #>

The error is:

Compiling transformation: The type or namespace name 'RDDBWebAdmin' could not be found (are you missing a using directive or an assembly reference?)

'RDDBWebAdmin' is the project which contains the T4 template. Yet it can not find it.  Know why?


<#@import namespace="System.Collections.Generic" #> 
<# 
Dictionary<string,Type> properties = new Dictionary<string,Type>(); 
properties.Add("Age",typeof(int)); 
properties.Add("Firstname", typeof(string)); 
properties.Add("Surname", typeof(string)); 
#> 
using System; 

public class <#="MyClass"#>{ 
<# foreach(string name in properties.Keys) { #> 
    public <#=properties[name].Name#> <#=name#>{ 
        get; set; 
    } 
<# } #> 
} 

//// Generated code ///////
using System; 

public class MyClass{ 
      public Int32 Age{ 
            get; set; 
      } 
      public String Firstname{ 
            get; set; 
      } 
      public String Surname{ 
            get; set; 
      } 
}

Open in new window

0
Comment
Question by:newbieweb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 3

Accepted Solution

by:
chandra_darbha earned 2000 total points
ID: 34913995
you need to add assembly reference to the assembly like this before the namespace import -

<#@ assembly name="RDDBWebAdmin.dll" #>

Thanks,
Chandra
0
 

Author Closing Comment

by:newbieweb
ID: 34916436
Thanks.
0

Featured Post

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question