CodeSmith and Visual Studio.Net 2005 beta 2 story

by Miha Markič 3. June 2005 22:21

I already blogged about CodeSmith being a wonderful tool so I won't repeat my ode again. While CodeSmith is a great tool it doesn't yet support integration into Visual Studio.Net 2005 beta 2. By integration I mean CodeSmith AddIn window and CodeSmithGenerator. I never find the former particulary useful thus I won't bother with it. The later it is another story.

Generators are those tools that transform a data file into a source file whenever data file changes or on demand. A typical generator is DataSetGenererator that ships with Visual Studio.Net itself and takes care of transforming dataset schema into strong typed dataset source file. To find which generator is used for transformation you might take a look at data file properties, field Custom Tool. That was a brief description of generators. If you are wondering what does CodeSmithGenerator do it is pretty simple. It takes a properly defined xml file that defines which template to use with which property sets and accordingly produces a source file - basically what CodeSmith does, but this time right within Visual Studio IDE. I won't elaborate here as it is not in the scope of this post.

So, what's the problem. As mentioned CodeSmith doesn't support Visual Studio.Net 2005 and doesn't install its CodeSmithGenerator to work with it. Fear not, there is a simple solution. Let's say you are installing CodeSmith on a computer with only Visual Studio.Net 2005 installed.

1. Install .net framework 1.1 which is required by CodeSmith (I am not sure if this step if required).
2. Install CodeSmith 3.0.
3. Add the following data into registry (paste it to a file named something.reg and double click on it).

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Generators\{FAE04EC1-301F-11D3-BF4B-00C04F79EFBC}\CodeSmithGenerator]
@="CodeSmith C# Code Generator"
"CLSID"="{7F0B8122-49AC-4939-AB97-BBAD7B442D55}"
"GeneratesDesignTimeSource"=dword:00000001

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Generators is path to Visual Studio generators registry entries and {FAE04EC1-301F-11D3-BF4B-00C04F79EFBC} stands for C# generators (that work in C# projects). If you want to register generator for VB you should use this guid: instead (you can safely enter both versions) {164B10B9-B200-11D0-8C61-00A0C91E29D5}.

4. You'll need a CodeSmith installed on a computer with Visual Studio.Net 2003 (if it doesn't find Visual Studio.Net 2003 it won't install necessary files). Copy files from C:\Program Files\CodeSmith\v3.0\bin (assuming CodeSmith is installed in C:\Program Files\CodeSmith\v3.0 folder) into target computer.
5. Run Visual Studio .NET 2003 Command Prompt and change directory to C:\Program Files\CodeSmith\v3.0\bin. Run installutil CodeSmith.VisualStudio.CodeGenerators.dll to register the dll as an ActiveX class (that CLSID entry from registry entry in step 3).

That's it. You are free to run the CodeSmithGenerator now. Ah, yes, there is a minor issue. For some reason you won't be able to register the CodeSmithGenerator - it will always run in trial mode. That said, I hope Eric will add support for Visual Studio.Net 2005 to avoid these problems in future.

Tags:

.net

Comments (1) -

Jeff
Jeff
11/30/2005 11:08:28 PM #

Rock on!

This worked like a charm.  Hopefully, we can find a way to work out the licensing bug before my 30-days is up!

Reply

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

Miha Markic

About me
Righthand
 
Microsoft MVP
 
Developer Express' DXSquad
INETA Country Leader for Slovenia
INETA Country Leader for Slovenia

Slovene Developer Users Group Lead
Friends of Red-Gate
LLBLGenPro Partner

Miha currently works as a free lance consultant and software developer specialized in .net area.
He graduated in Computer and information science at the University of Ljubljana, Slovenia. He has accumulated experience in various programming languages such as Java, Visual Basic 3-6 (MCP), Visual C++, Delphi, C# and VB.Net through years.
He has experience in practically all (technical) stages of project development, including planning, framework development, user interface, business processes, as well as testing and documenting. He has worked on big and small projects in Slovenia and abroad (e.g. participated in completing level 3 IS for the Nucor steel plant, Hertford, USA).
Currently he enjoys programming in .net environment using C#. Since 2000 he has been active in Developer Express' DX Squad and has been ECDL trainer and tester. He also gives lectures on conferences and other events in Slovenia.

Month List

Tag cloud

Most comments

Paulius Paulius
1 comments
us United States
Meh Meh
1 comments
us United States
bart dm bart dm
1 comments
nl Netherlands

RecentComments

Comment RSS