Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / Extensibility / December 2005

Tip: Looking for answers? Try searching our database.

Custom Project Template: Custom Parameters that use scripts?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Chuck Heatherly - 30 Nov 2005 09:39 GMT
I posted this question to the new Microsoft Forums in the Visual Studio
Extensibility forum, but didn't get an answer, so I'll try again here since this
is a managed newsgroup and I am a MSDN subscriber.

I am converting a Visual Studio .NET 2003 custom project template to VS 2005.
So far it is working except for a tiny detail, and the new format is going to be
much much easier for me to maintain, thanks for all the hard work the VS team
has put into the redesign!

With VS 2003, I had to make changes to a JScript file and if I called the method
wizard.AddSymbol, I could create a variable that I could easily access in the
program's source file.

How can I do that with the new 2005 template format?  I really don't want to
write any wizard code with C#, I don't need any forms, I just need to use some
very short JScript code that grabs the current user name (the network full name,
not the value available as $username$), and the current date in a format that I
want.

I have copied the common.js file from the VC# Wizards directory and added my
functions to it, but I can't figure out how to reference the symbols I've
created from my source file now.  Or, can I put the script code in a CDATA
section right in the .vstemplate file, under the CustomParameter item?  It seems
like the Value field there is just a simple text value.

Thanks for any help with this,
Chuck
"Gary Chang[MSFT]" - 01 Dec 2005 09:40 GMT
Hi Chuck,

>I am converting a Visual Studio .NET 2003 custom project
>template to VS 2005.So far it is working except for a tiny
>detail, and the new format is going to be much much easier
>for me to maintain, thanks for all the hard work the VS team
>has put into the redesign!

Very thanks for your appreciation, I will forward it to our product team:)

>How can I do that with the new 2005 template format?  I really
>don't want towrite any wizard code with C#, I don't need any forms,
>I just need to use some very short JScript code that grabs the
>current user name (the network full name, not the value available
>as $username$), and the current date in a format that I want.

>I have copied the common.js file from the VC# Wizards directory
>and added my functions to it, but I can't figure out how to reference
>the symbols I'vecreated from my source file now.

Those JScript function should be called from your wizards Html script, how
could you do this in VS2003's Add-in, the corresponding methods haven't
changed a lot in VS2005...

Thanks!

Best regards,

Gary Chang
Microsoft Community Support
--------------------
Get Secure! ¡§C www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp
&SD=msdn

This posting is provided "AS IS" with no warranties, and confers no rights.
Chuck Heatherly - 01 Dec 2005 16:19 GMT
>Hi Chuck,
>
[quoted text clipped - 5 lines]
>
>Very thanks for your appreciation, I will forward it to our product team:)

You're welcome.  Let me actually describe for others all the yucky stuff I had
to do for VS 2003 projects that is totally eliminated for VS 2005:

I had to create a project template directory tree structure like this:

Root
+-----Scripts
|-----------1033
+-----Templates
|-----------1033

And store in each locale (1033) subdir the actual files I needed, like the
project source and the JScripts involved (default.js).  And then there were the
.vsz and .vsdir files.

And, the really yucky part was that I had to modify the registry, create a new
GUID, and add it into
SOFTWARE\Microsoft\VisualStudio\7.1\NewProjectTemplates\TemplateDirs.

With 2005, I just put all the project source files into a single Zip file and
put that in a path under My Documents.

>Those JScript function should be called from your wizards Html script, how
>could you do this in VS2003's Add-in, the corresponding methods haven't
>changed a lot in VS2005...

Gary,

I was hoping that I could take the code that I had added into default.js above
in the Scripts\1033 directory and put it into the common.js file that the CSharp
projects seem to use (located at C:\Program Files\Microsoft Visual Studio
8\VC#\VC#Wizards\1033), and then put that new version of common.js into my Zip
file in My Documents.

I don't have a wizard.  I am just trying to figure out how I can use script of
some kind to use to supply a value for a custom parameter in the .vstemplate
file.  But I really don't want to have to create a wizard, it seems like a ton
of overkill just to do what was working for me before in 2003 without a wizard.

Could Craig Skibo maybe answer this?  I wish I could read his new book that is
going into the retail boxes for VS 2005, but I have a MSDN subscription, and
MSPress's stance now is that they won't even sell his book separately.

Thanks,
Chuck
Ed Dore [MSFT] - 02 Dec 2005 06:18 GMT
Hi Chuck,

The new .vstemplate based wizards don't support scripting like the older
style .vsz/.html based wizards. No webpages are utilized in the execution of
a .vstemplate based wizard, so there's no base to execute that jscript code
from. The new .vstemplate based wizards do support invocation of custom
code, but it's through a managed object that implements the IWizard
interface, as designated by a <WizardExtension> element added to your
.vstemplate file.

Hiren Shah has posted a starter kit at the following address which may be
helpful in getting you started on building a custom IWizard extension.

  http://www.dotnetjunkies.com/VSContent/5A9AC916-B95F-4C58-9505-9937546FFCBA.dcik

Also if you search the documentation on IWizard and .vstemplate, you'll find
the requisite info on how to build these. One thing that the docs might not
actually over well is that the assembly that implements the IWizard
interface must be strongnamed, and you must place the assembly in the GAC,
or in the same directory as DevEnv.exe (or the PrivateAssemblies or
PublicAssemblies directory). And if you opt to go the non-GAC route (you'll
still need to regasm the assembly with the /codebase switch).

That all being said, the older style wizards are still supported and work
just as they did in VS 2003.

P.S. I'm anxiously awaiting Craig's book as well <g>. Be sure to make your
voice heard on Craig's blog, as it sounds like MS Press may not make the
book available for purchasing at your friendly neighborhood bookstore.
http://blogs.msdn.com/craigskibo/archive/2005/11/29/498111.aspx.

Sincerely,
Ed Dore [MSFT]

This post is "AS IS" with no warranties, and confers no rights.
Chuck Heatherly - 02 Dec 2005 13:17 GMT
>Hi Chuck,
>
[quoted text clipped - 5 lines]
>interface, as designated by a <WizardExtension> element added to your
>.vstemplate file.

[snippage]

>Sincerely,
>Ed Dore [MSFT]
>
>This post is "AS IS" with no warranties, and confers no rights.

Ed,

I just wanted to say thanks for this very comprehensive answer.  I downloaded
the Starter Kit from Hiren, and it looks like it will give me what I need to get
started.

Chuck

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.