473,472 Members | 1,746 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Add A Module Template To Project

I'm trying to add a module template to a project programmatically. I've tried
many documented (w/o examples) ways of doing it to no avail. For example, I
tried using Project.ProjectItems.AddFromTemplate("C:\Program Files\Microsoft
Visual Studio .NET 2003\Vb7\VBWizards\Module\Templates\1033\Module.vb ",
"Common.vb") and this adds it ok. Problem is, it does not replace the [!
directives with the proper values. ([!output SAFE_FILE_NAME] stays as such). So
I tried the DTE.LaunchWizard method and passed in the "proper" values, but I keep
getting an error "Unspecified Error" message with 1 of two return codes
(0x80004004 or 0x80041FFF). Looked up both error values on google and msdn and
found 1 (more but all same thing) result, "Unspecified Error". Doesn't help.

Any help would be appreciated.

Thank you,
Mythran
Nov 21 '05 #1
2 2740
Mythran,

Did you ever resolve this? I would like to run nunit tests to verify
my output, something like:

Public Sub BusinessExceptionTest()
Dim proj As Project = DTE.ActiveSolutionProjects(0)

Dim params() As Object = New Object()
{EnvDTE.Constants.vsWizardAddItem,
proj.Name,
proj.ProjectItems,
tempDirectory,
"nUnitItem",
VS_NET_INSTALL_DIR, True}

Dim result As EnvDTE.wizardResult
result = DTE.LaunchWizard("test.vsz"), params)

Dim verified As String = GetFileText("")
Dim created As String = GetFileText("")

Assert.AreEqual(verified, created)
End Sub
I am getting the same error :(

Thank you,

Steve

On Wed, 15 Sep 2004 08:55:02 -0700, "Mythran" <ki********@hotmail.com>
wrote:
I'm trying to add a module template to a project programmatically. I've tried
many documented (w/o examples) ways of doing it to no avail. For example, I
tried using Project.ProjectItems.AddFromTemplate("C:\Program Files\Microsoft
Visual Studio .NET 2003\Vb7\VBWizards\Module\Templates\1033\Module.vb ",
"Common.vb") and this adds it ok. Problem is, it does not replace the [!
directives with the proper values. ([!output SAFE_FILE_NAME] stays as such). So
I tried the DTE.LaunchWizard method and passed in the "proper" values, but I keep
getting an error "Unspecified Error" message with 1 of two return codes
(0x80004004 or 0x80041FFF). Looked up both error values on google and msdn and
found 1 (more but all same thing) result, "Unspecified Error". Doesn't help.

Any help would be appreciated.

Thank you,
Mythran


Nov 21 '05 #2
Yes...

I found that it is a problem...bug...I believe. Haven't had anyone else test it
though...

1.) Use AddFromTemplate with parameter of the path to the vbscript.vsz file.
2.) Delete the returned item.
3.) Use AddFromTemplate with parameter of the path to the VSZ file for the
project item you want to add.
The same problem that you had with the LaunchWizard function is fixed if you
first add a blank wizard first...the fix is basically to first use
AddFromTemplate or LaunchWizard and give the parameter to a VSZ file that
corresponds to a file without any [!output] directives in it...such as the
vbscript.vsz (the vbscript.vbs file doesn't have any [!output] directives in it,
therefore it works)...

I have no other workarounds at this time :(

Mythran

P.S. I might have a working solution, but haven't tried it...in the default.js
script, try placing the following before selObj or selProj is accessed:

selProj = (selProj == null ? selObj.ContainingProject : selProj);

It might work....if selObj.ContainingProject is undefined, try
selObj.Parent.ContainingProject...

"Steve Baker" <cu*************@hotmail.com> wrote in message
news:74********************************@4ax.com...
Mythran,

Did you ever resolve this? I would like to run nunit tests to verify
my output, something like:

Public Sub BusinessExceptionTest()
Dim proj As Project = DTE.ActiveSolutionProjects(0)

Dim params() As Object = New Object()
{EnvDTE.Constants.vsWizardAddItem,
proj.Name,
proj.ProjectItems,
tempDirectory,
"nUnitItem",
VS_NET_INSTALL_DIR, True}

Dim result As EnvDTE.wizardResult
result = DTE.LaunchWizard("test.vsz"), params)

Dim verified As String = GetFileText("")
Dim created As String = GetFileText("")

Assert.AreEqual(verified, created)
End Sub
I am getting the same error :(

Thank you,

Steve

On Wed, 15 Sep 2004 08:55:02 -0700, "Mythran" <ki********@hotmail.com>
wrote:
I'm trying to add a module template to a project programmatically. I've tried
many documented (w/o examples) ways of doing it to no avail. For example, I
tried using Project.ProjectItems.AddFromTemplate("C:\Program Files\Microsoft
Visual Studio .NET 2003\Vb7\VBWizards\Module\Templates\1033\Module.vb ",
"Common.vb") and this adds it ok. Problem is, it does not replace the [!
directives with the proper values. ([!output SAFE_FILE_NAME] stays as such). SoI tried the DTE.LaunchWizard method and passed in the "proper" values, but I keepgetting an error "Unspecified Error" message with 1 of two return codes
(0x80004004 or 0x80041FFF). Looked up both error values on google and msdn andfound 1 (more but all same thing) result, "Unspecified Error". Doesn't help.

Any help would be appreciated.

Thank you,
Mythran

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Fahd Khan | last post by:
The web-based Python software I've written thus far lacks a consistent approach to generating output. After reading Graham Fawcett's endorsement of Zope Template Pages in the recent web programming...
2
by: James S | last post by:
Hi, Basically I've been fighting with this code for a few days now and can't seem to work around this problem. Included is the output, the program I use to get this error and the source code for...
0
by: F. GEIGER | last post by:
py2exe and datetime -> No module named datetime I've begun to use the stdlib module datetime instead of my home brewn classes. Since then a py2exe app doesn't run anymore: Traceback (most...
0
by: Gabriele | last post by:
For didactical purposes I'm trying to create a C Template Item (an empty *.c file) (the header template file is already included) and a C empty project with all the settings to allow only C...
2
by: Thelma Lubkin | last post by:
I do a lot of my code writing for Access forms at home, where I have no access to Access. While in Access, I export the entire primary code module, xxx.cls where xxx begins "Frm_" and includes...
11
by: Steve | last post by:
Hi All, I'm having a tough time converting the following regex.compile patterns into the new re.compile format. There is also a differences in the regsub.sub() vs. re.sub() Could anyone lend...
6
by: JonathanOrlev | last post by:
Hello everyone, I have a newbe question: In Access (2003) VBA, what is the difference between a Module and a Class Module in the VBA development environment? If I remember correctly, new...
1
by: gabe | last post by:
Hi, Is it possible to store the project name in an Item Template? I can use $safeprojectname$ in a Project Template, and the correct name is replaced. However, if I do the same in an Item...
6
by: James T. Dennis | last post by:
Tonight I discovered something odd in the __doc__ for tempfile as shipped with Python 2.4.4 and 2.5: it says: This module also provides some data items to the user: TMP_MAX - maximum number...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.