Snippets and templates

Snippets and templates

Old forum URL: forums.lhotka.net/forums/t/5672.aspx


tkd posted on Friday, October 24, 2008

I'm using the very latest 3.6 2 release in VS2008.

In the cslacs dir there are snippets, templates and visual studio templates directories. How are these used?

In VS2008 I used Tools| Snippet Manager to import the snippets files. I can see them. Back in my code I can start to type say cslaprop. It comes up in intellisense. But when I press Tab or Enter it simply puts in the word cslaprop. It doesn't actually expand them out.

And the template directories, I'm not sure what to do with them at all :-(

 

sergeyb replied on Saturday, October 25, 2008

Try to hit Ctrl+K+X.  This should open up snippets drop down, select your imported folder, and try to expand the same snippet.  This will verify that snippet is working correctly.  Templates are sample code files for each CSLA stereotype – such as root or child object.  They are intended to show you how to properly write code.  You will need to customize them of course to fit your needs.

 

 

 

Sergey Barskiy

Principal Consultant

office: 678.405.0687 | mobile: 404.388.1899

cid:_2_0648EA840648E85C001BBCB886257279
Microsoft Worldwide Partner of the Year | Custom Development Solutions, Technical Innovation

 

From: tkd [mailto:cslanet@lhotka.net]
Sent: Saturday, October 25, 2008 1:00 AM
To: Sergey Barskiy
Subject: [CSLA .NET] Snippets and templates

 

I'm using the very latest 3.6 2 release in VS2008.

In the cslacs dir there are snippets, templates and visual studio templates directories. How are these used?

In VS2008 I used Tools| Snippet Manager to import the snippets files. I can see them. Back in my code I can start to type say cslaprop. It comes up in intellisense. But when I press Tab or Enter it simply puts in the word cslaprop. It doesn't actually expand them out.

And the template directories, I'm not sure what to do with them at all :-(

 



jgamba replied on Saturday, October 25, 2008

I have the same problem with the code snippets...

As for install templates as follows:

1. Open file deploy.sln (.. \ cslacs \ deploy)
2. Generate the complete solution
3. Run setup.exe (.. \ cslacs \ deploy \ Setup \ Debug) and follow the instructions

At the moment there is only Item Templates, so that you can use them in the same way you add a new element to an existing project, like when you add a new class, in the Add New Item dialog you'll see a new category "CSLA.NET" , There you'll find the templates that correspond to all types of business objects that you can use.

If desired, check the Change Log 3.6.0 (Beta 2), below "Beta 2 3.6.0-081021:".

http://www.lhotka.net/Article.aspx?id=9b0ca1dd-3640-4088-9034-11538a0504f9

RockfordLhotka replied on Saturday, October 25, 2008

I haven't used the snippet wizard - maybe that's the issue?

I always just copy the snippet files into the "my documents"\VS2008\Code Snippets\C# (or VB) directory and they just show up.

But then again, you have them showing up in Intellisense, so they should be working for you.

ozhug replied on Thursday, January 08, 2009

All i needed to do was double click the vsi file found in

cslacs-3.6.0-081217\\cslacs\Visual Studio Templates\VSI\cs

cslacs.vsi

The Visual Studio Wizard asked me were to place the code snippets and the templates appeared as expected. 

Great Job Nermin, well done!

 

jgamba replied on Thursday, January 08, 2009

I have returned to test the Deploy of the latest version of Csla.Net and works perfect, there was no problem with IntelliSense.

Jorge

jgamba replied on Thursday, January 08, 2009

Just one more simple concern, looking the code snippets for properties, There are three labels that are identical.

Define a Csla Property
Define a Csla Property
Define a Csla Property

The issue is in 'DefineACslaConvertProperty.snippet' and 'DefineACslaSmartDateProperty.snippet', IMHO should alter these two code snippets files, specifically the titles

DefineACslaConvertProperty.snippet
<Title>Define a Csla Convert Property</Title>

DefineACslaSmartDateProperty.snippet
<Title>Define a Csla SmartDate Property</Title>

Jorge

RockfordLhotka replied on Friday, January 09, 2009

Thank you for pointing this out, I’ll add it to the bug list.

 

Rocky

 

From: jgamba [mailto:cslanet@lhotka.net]
Sent: Thursday, January 08, 2009 7:08 AM
To: rocky@lhotka.net
Subject: Re: [CSLA .NET] Snippets and templates

 

Just one more simple concern, looking the code snippets for properties, There are three labels that are identical.

Define a Csla Property
Define a Csla Property
Define a Csla Property

The issue is in 'DefineACslaConvertProperty.snippet' and 'DefineACslaSmartDateProperty.snippet', IMHO should alter these two code snippets files, specifically the titles

DefineACslaConvertProperty.snippet
<Title>Define a Csla Convert Property</Title>

DefineACslaSmartDateProperty.snippet
<Title>Define a Csla SmartDate Property</Title>

Jorge



RTime replied on Friday, January 16, 2009

I was able to install the templates & snippets via the cslacs.vsi, but when trying to use several of the templates I receive the following error;

"Error: this template attempted to load an untrusted component CslaTemplateItemWizards, ....

It errors out when attempting to add DynamicRootList, EditableChildList, EditableRootList, ReadOnlyChildList, EditableRootParent, & ReadOnlyList.

I was able to successfully add CommandObject, DynamicRoot, EditableChild, EditableRoot, NameValueList, ReadOnlyChild, ReadOnlyRoot, and SwitchableObject.

 

Thanks in advance for any and all help,

Ralph

jgamba replied on Saturday, January 17, 2009

Have you installed the Visual Studio 2008 SP1 Beta at this time?

Jorge

RTime replied on Saturday, January 17, 2009

Thanks for your response.  Yes I have installed 2008 sp1.  Here is the complete error. 


Error: this template attempted to load an untrusted component 'CslaItemTemplateWizards, Version=1.0.0.0, Culture=Neutral, PublicKeyToken=93be5fdc093e4c30'.  For more information on this problem and how to enable this template, please see documentation on Customizing Project Templates.

Ralph

 

jgamba replied on Saturday, January 17, 2009

About your VS2008 SP1 install, is Beta, Release Candidate or final version?

RTime replied on Sunday, January 18, 2009

Final version

mobile5guy replied on Monday, February 02, 2009

Compile the project "CslaItemTemplateWizards" found in "Visual Studio Templates\Wizards\CslaItemTemplateWizards\CslaItemTemplateWizards".

Toss the assembly in the GAC.

Copyright (c) Marimer LLC