473,772 Members | 2,478 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Custom Wizard Engine problem (C#)

Hi,
I am building a custom wizard engine in C# following the example in
"Mastering Visual Studio.NET" by Griffiths, Flanders and Sells (pg 304).
Unfortunately, I'm having several problems that the book isn't helping me
overcome. (It is a good book, but O'Reilly hasn't made code available and so
far not a single example I've tried from the book has worked!)

To build a COM server in C# that implements the IDTWizard interface, does
the assembly have to have a strong name? The book says yes. However, the
MSDN page at
http://msdn.microsoft.com/library/de...projectwiz.asp
indicates otherwise. The MSDN example shows only the following changes to
AssemblyInfo.cs :

//COM+ related settings
//
[assembly: ApplicationName ("Custom Component")]
[assembly: ApplicationID("[!output GUID_COMPLUS]")]
[assembly: Description("Cu stom component using C#.NET")]

Not being familiar with COM, I can only assume that either approach
(assigning an AssemblyKeyFile or using the GUID for the applicationID) will
work. I have tried both -- even both at the same time-- but without success.

When I try to run my wizard, I simply get a message box error saying "could
not run the '...' wizard".

My guess is that I have a COM registration problem. My project properties
have RegisterForComI nterop = "true" set. The build output window indicates
COM registration is being done. Still, I can't run the wizard.

I have tried running regasm manually, but that doesn't seem to change
anything.

To summarize, here are my questions:
1. To build a COM server in C# that implements the IDTWizard interface, do I
need to sign the assembly with a key pair?
2. Do I need 2 GUIDs (one for the class and one for the ApplicationID)? If
not, which GUIDs do I need?
3. How do I register my C# COM server? (And how can I validate that it is
registered properly?) I assume VS.NET 2003 is doing this automatically, but
if not it seems that running regasm should be good enough...
4. Does it matter which folder I place my dll in? (I am pretty sure it does
not matter, but just checking)
5. Given that I seem to be getting failure before my dll is found, my
breakpoints are never hit. What would be the appropriate debugging technique
at the stage where I'm having problems?

Thanks!
Mountain
Nov 16 '05 #1
7 1689
Mountain,

See inline:

To summarize, here are my questions:
1. To build a COM server in C# that implements the IDTWizard interface, do I need to sign the assembly with a key pair?
Yes, if you want to register the assembly for use from COM, it needs to
have a strong name.
2. Do I need 2 GUIDs (one for the class and one for the ApplicationID)? If
not, which GUIDs do I need?
You only need to have the Guid at the class level. Having it on the
assembly level is good practice as well, but at the least, make SURE it is
on the class level.
3. How do I register my C# COM server? (And how can I validate that it is
registered properly?) I assume VS.NET 2003 is doing this automatically, but if not it seems that running regasm should be good enough...
Yes, running regasm will register the assembly for COM.
4. Does it matter which folder I place my dll in? (I am pretty sure it does not matter, but just checking)
Yes, it does. When running from COM, it has to be able to find your
assembly. You have two options. You could place the assembly in the GAC,
which means that it will always be found. If your assembly will live in one
directory, then use the /codebase flag when running regasm. This will cause
the path of the assembly to be placed in the registry, so it can be found by
COM (and then by .NET).
5. Given that I seem to be getting failure before my dll is found, my
breakpoints are never hit. What would be the appropriate debugging technique at the stage where I'm having problems?
There is not much you can do at this point, because you would have to
have acess to the CLR code, which you do not.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

Thanks!
Mountain

Nov 16 '05 #2
Thanks for your responses. They are helpful.
However, I am still not able to solve this problem. It is baffling me.

I have reduced everything to the simplest case. I wrote a C# COM server that
implements the IDTWizard interface. My Execute method simply returns
success.

I have GUIDs at the class and assembly level. I am using a strong name. I
registered the dll with regasm /codebase.

Then, I simply took an existing VS.NET wizard and replaced the wizard = line
in the .vsz file with my custom wizard engine (in order to eliminate issues
with folders, .vsdir files, etc. as potential problems).

Now, when I run the wizard, I still get the exact same error:
---------------------------
Microsoft Development Environment
---------------------------
Could not run the 'C:\Program Files\Microsoft Visual Studio .NET
2003\VC#\CSharp ProjectItems\Lo calProjectItems \Code\..\..\CSh arpAddClassWiz. v
sz' wizard.
---------------------------
OK
---------------------------

I hope someone can suggest something that I'm overlooking or doing
incorrectly.
Thanks!
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in
message news:%2******** ********@tk2msf tngp13.phx.gbl. ..
Mountain,

See inline:

To summarize, here are my questions:
1. To build a COM server in C# that implements the IDTWizard interface, do
I
need to sign the assembly with a key pair?
Yes, if you want to register the assembly for use from COM, it needs

to have a strong name.
2. Do I need 2 GUIDs (one for the class and one for the ApplicationID)?
If not, which GUIDs do I need?


You only need to have the Guid at the class level. Having it on the
assembly level is good practice as well, but at the least, make SURE it is
on the class level.
3. How do I register my C# COM server? (And how can I validate that it is registered properly?) I assume VS.NET 2003 is doing this automatically,

but
if not it seems that running regasm should be good enough...


Yes, running regasm will register the assembly for COM.
4. Does it matter which folder I place my dll in? (I am pretty sure it

does
not matter, but just checking)


Yes, it does. When running from COM, it has to be able to find your
assembly. You have two options. You could place the assembly in the GAC,
which means that it will always be found. If your assembly will live in

one directory, then use the /codebase flag when running regasm. This will cause the path of the assembly to be placed in the registry, so it can be found by COM (and then by .NET).
5. Given that I seem to be getting failure before my dll is found, my
breakpoints are never hit. What would be the appropriate debugging

technique
at the stage where I'm having problems?


There is not much you can do at this point, because you would have to
have acess to the CLR code, which you do not.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

Thanks!
Mountain


Nov 16 '05 #3
Is the ProgID attribute required on the class that implements IDTWizard?

For example:
[ProgId("CSharpW izard1")]
public class Builder : IDTWizard

Also, I am seeing more examples of Custom Wizard Engines built as C# COM
Servers that are NOT signed with a key pair and that do not supply a value
in AssemblyKeyFile . For example:

[assembly: AssemblyKeyFile ("")]
[assembly: AssemblyKeyName ("")]

How is it that these COM Servers can be registered without having strong
names?

Regards,

Mountain

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in
message news:%2******** ********@tk2msf tngp13.phx.gbl. ..
Mountain,

See inline:

To summarize, here are my questions:
1. To build a COM server in C# that implements the IDTWizard interface, do
I
need to sign the assembly with a key pair?
Yes, if you want to register the assembly for use from COM, it needs

to have a strong name.
2. Do I need 2 GUIDs (one for the class and one for the ApplicationID)?
If not, which GUIDs do I need?


You only need to have the Guid at the class level. Having it on the
assembly level is good practice as well, but at the least, make SURE it is
on the class level.
3. How do I register my C# COM server? (And how can I validate that it is registered properly?) I assume VS.NET 2003 is doing this automatically,

but
if not it seems that running regasm should be good enough...


Yes, running regasm will register the assembly for COM.
4. Does it matter which folder I place my dll in? (I am pretty sure it

does
not matter, but just checking)


Yes, it does. When running from COM, it has to be able to find your
assembly. You have two options. You could place the assembly in the GAC,
which means that it will always be found. If your assembly will live in

one directory, then use the /codebase flag when running regasm. This will cause the path of the assembly to be placed in the registry, so it can be found by COM (and then by .NET).
5. Given that I seem to be getting failure before my dll is found, my
breakpoints are never hit. What would be the appropriate debugging

technique
at the stage where I'm having problems?


There is not much you can do at this point, because you would have to
have acess to the CLR code, which you do not.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

Thanks!
Mountain


Nov 16 '05 #4
For anyone who is interested, it looks like I found my answer. Adding the
ProgId attribute DID solve this problem. I no longer get the "Could not run
the ... wizard" error.

I wonder why no doc mentions this? Anyway, on to the next problem...

"Mr. Mountain" <mt*****@mediao ne.net> wrote in message
news:delyc.3256 5$Sw.11331@attb i_s51...
Is the ProgID attribute required on the class that implements IDTWizard?

For example:
[ProgId("CSharpW izard1")]
public class Builder : IDTWizard

Also, I am seeing more examples of Custom Wizard Engines built as C# COM
Servers that are NOT signed with a key pair and that do not supply a value
in AssemblyKeyFile . For example:

[assembly: AssemblyKeyFile ("")]
[assembly: AssemblyKeyName ("")]

How is it that these COM Servers can be registered without having strong
names?

Regards,

Mountain

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in message news:%2******** ********@tk2msf tngp13.phx.gbl. ..
Mountain,

See inline:

To summarize, here are my questions:
1. To build a COM server in C# that implements the IDTWizard
interface,
do
I
need to sign the assembly with a key pair?
Yes, if you want to register the assembly for use from COM, it needs

to
have a strong name.
2. Do I need 2 GUIDs (one for the class and one for the
ApplicationID)? If not, which GUIDs do I need?
You only need to have the Guid at the class level. Having it on the
assembly level is good practice as well, but at the least, make SURE it is on the class level.
3. How do I register my C# COM server? (And how can I validate that it is registered properly?) I assume VS.NET 2003 is doing this

automatically, but
if not it seems that running regasm should be good enough...


Yes, running regasm will register the assembly for COM.
4. Does it matter which folder I place my dll in? (I am pretty sure it

does
not matter, but just checking)


Yes, it does. When running from COM, it has to be able to find your
assembly. You have two options. You could place the assembly in the GAC, which means that it will always be found. If your assembly will live in

one
directory, then use the /codebase flag when running regasm. This will

cause
the path of the assembly to be placed in the registry, so it can be found by
COM (and then by .NET).
5. Given that I seem to be getting failure before my dll is found, my
breakpoints are never hit. What would be the appropriate debugging

technique
at the stage where I'm having problems?


There is not much you can do at this point, because you would have

to have acess to the CLR code, which you do not.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

Thanks!
Mountain



Nov 16 '05 #5
I am not a COM expert. However, after seeing some example of Custom Wizard
Engines developed as C# COM Servers that did NOT have strong names, I tested
this myself. (I was finally able to test this because I solved my earlier
problems by using the ProgId attribute, as described in another post.)

I found out that a strong name is *not* required. I do not know why there is
so much conflicting info on this, so I am just relating my experience.

As a summary, here are my own answers to my original 5 questions. These are
based on my own testing, and they conflict with what others have stated. I
can only share my experience. Hopefully someone will step in and provide a
deeper explanation about the conflicting info.
1. To build a COM server in C# that implements the IDTWizard interface, do I
need to sign the assembly with a key pair?
NO!

2. Do I need 2 GUIDs (one for the class and one for the ApplicationID)? If
not, which GUIDs do I need?
Prior response from Nicholas Paldino seems correct. I haven't found any
additional info.

3. How do I register my C# COM server? (And how can I validate that it is
registered properly?) I assume VS.NET 2003 is doing this automatically, but
if not it seems that running regasm should be good enough...
VS.NET does this automatically if the project properties have
RegisterForComI nterop = "true" set. Manually running regasm is NOT required.
I tested this by running regasm to unregister my dll, then building and
testing my custom wizard engine without manually running regasm.

4. Does it matter which folder I place my dll in? (I am pretty sure it does
not matter, but just checking)
NO. I left it in \bin\Debug under my project. It was referenced from a .vsz
file in the default VS.NET install folder (on another drive).

5. Given that I seem to be getting failure before my dll is found, my
breakpoints are never hit. What would be the appropriate debugging technique
at the stage where I'm having problems?
Prior response from Nicholas Paldino seems correct. I haven't found any
additional info.
Nov 16 '05 #6
Hi,
I'm not an expert also, as Nicholas is, but:

In article <vCmyc.32789$Sw .2671@attbi_s51 >, mt*****@mediaon e.net says...
I am not a COM expert. However, after seeing some example of Custom Wizard
Engines developed as C# COM Servers that did NOT have strong names, I tested
this myself. (I was finally able to test this because I solved my earlier
problems by using the ProgId attribute, as described in another post.)

I found out that a strong name is *not* required. I do not know why there is
so much conflicting info on this, so I am just relating my experience.


This is not required, i.e. you can install it, but ... what will happen
if someone else installs/has an assembly with the same name. Which one
will CLR load? This is very importatnt for addins, as all the addins are
imported in the same appdomain, and if there is already an assembly with
the same name, the loading will fail. That's why strong naming is highly
recommended. You can not control what users do install on their
machines, so there is a possible conflict.

Actually just few days ago I have discovered that point of view, so now
I'm going thru the process of strongly naming whole my COM interop
solution :). Thats very good that I have found it just before deployment
:)

Sunny
Nov 16 '05 #7
Good points. I should have mentioned that I am building this custom wizard
engine for my own use only on my development machine.

I'm also trying to find the most basic configuration possible, so I can
understand which settings are always optional, which are sometimes optional,
and which are always required under all circumstances.

Regards,
Mountain

"Sunny" <su******@icebe rgwireless.com> wrote in message
news:eh******** ********@TK2MSF TNGP12.phx.gbl. ..
Hi,
I'm not an expert also, as Nicholas is, but:

In article <vCmyc.32789$Sw .2671@attbi_s51 >, mt*****@mediaon e.net says...
I am not a COM expert. However, after seeing some example of Custom Wizard Engines developed as C# COM Servers that did NOT have strong names, I tested this myself. (I was finally able to test this because I solved my earlier problems by using the ProgId attribute, as described in another post.)

I found out that a strong name is *not* required. I do not know why there is so much conflicting info on this, so I am just relating my experience.


This is not required, i.e. you can install it, but ... what will happen
if someone else installs/has an assembly with the same name. Which one
will CLR load? This is very importatnt for addins, as all the addins are
imported in the same appdomain, and if there is already an assembly with
the same name, the loading will fail. That's why strong naming is highly
recommended. You can not control what users do install on their
machines, so there is a possible conflict.

Actually just few days ago I have discovered that point of view, so now
I'm going thru the process of strongly naming whole my COM interop
solution :). Thats very good that I have found it just before deployment
:)

Sunny

Nov 16 '05 #8

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

Similar topics

0
1072
by: tcr | last post by:
Hi, Not sure if this is the correct group so let me know. I am attempting to create a new custom app wizard that will output one solution that contains two projects. One is an MFC project and the other is a console. In the OnFinish function of the default.js file, I create the one solution and then cycle through the code twice to create the projects. Here is the code: var strProjectPath = wizard.FindSymbol('PROJECT_PATH'); var...
1
3974
by: The_Rave | last post by:
Hi everyone, I'm trying to add my own template columns to the property builder of ..NET. E.g. a checkbox column, or an image column. But I can't find the sources of the wizard, or a way to add them to the wizard, via add-in? I tried to capture it with a macro, but all I can't get out of it is the raise event of the wizard, nothing that happens during the wizard. "
1
1220
by: Shanthi | last post by:
I am trying to create custom project wizard in C#. It is working fine. But C# expects all the dependant assemblies needed for the Wizard need to be placed under C:\Program Files\Microsoft Visual Studio .NET\Common7\IDE\PublicAssemblies. I want to change this path. I want to give custom path for my custom wizard. How can I do that? Can anyone help me in this?
0
1058
by: tcr | last post by:
Hi, Not sure if this is the correct group so let me know. I am attempting to create a new custom app wizard that will output one solution that contains two projects. One is an MFC project and the other is a console. In the OnFinish function of the default.js file, I create the one solution and then cycle through the code twice to create the projects. Here is the code: var strProjectPath = wizard.FindSymbol('PROJECT_PATH'); var...
5
2017
by: john smithers | last post by:
I'm trying to modify the connection string made by the dataadapter wizard to a relative path. My current datasource is this: ""C:\Inetpub\wwwroot\database\database.mdb"" How can i change so when its on the server it will look for the directory "database" in the root of the virtual directory? cheers
2
3560
by: John | last post by:
Hi I was working fine with create user wizard and the default membership provider. I have now customised the membership provider as per attached web.config. The create user wizard picks up the custom membership provider fine and removes the security question/answer fields as designated in the custom provider. The problem is that when I try to create a new user in the create user wizard by entering the info and pressing the 'create...
2
2634
by: Mark Olbert | last post by:
So far, I am more than a little underwhelmed by the Membership API in ASPNET2, and the ASP.NET Configuration wizard in VS2005. The latter is slow as a pig whenever it does anything. Oh well, at least it's given me a chance to brush up on my Spider Solitaire game. In any event, I am trying to implement a custom MembershipProvider for a website. Why? Because the default one that gets created by the supplied wizard is way over the top, in...
0
1105
by: Damian | last post by:
I have created a custom calendar control for use in a VS 2005 wizard, which consists of a label, a textbox and a calendar control. When I select a date on the calendar control the textbox is updated with the date. If i move to a new wizardstep and select a date on the custom calendar control and select a date on one of the custom controls on that step I lose the instance of the custom calender control on the first wizard step. I...
2
8992
by: Greg | last post by:
Hello, I am trying to bind a GridView to a custom object I have created. First, here is what I'm trying to do: I have a wizard for adding/editing Users. When the wizard begins, a User object (custom class) is created, and properties are populated in each step of the wizard. In one of the steps, the User is assigned to 1 or more Programs. Assigned Programs are stored by the User object in a List, and displayed in a GridView in the...
0
9454
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10039
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9914
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7461
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6716
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5484
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4009
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 we have to send another system
2
3610
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.