WSDL generated type does not take COM attributes
I have a WSDL generated class
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public partial class FVZServicesClient : System.ServiceModel.ClientBase<FVZScanningDocumentInfo.FVZServices.FVZServices>, FVZScanningDocumentInfo.FVZServices.FVZServices {
...
}
I need to provide a library that is used in VB6. I use a COM Interface which happens to use the above class.
When I register the assembly with
regasm MyAssembly.dll /tlb:MyAssembly.tlb
I get the error message
Microsoft .NET Framework Assembly Registration Utility version
4.7.3062.0 for Microsoft .NET Framework version 4.7.3062.0 Copyright (C) Microsoft Corporation. All rights reserved.
Types registered successfully Type library exporter warning processing
'MyAssembly.FVZServices.FVZServicesClient, MyAssembly'. Warning: Type
library exporter encountered a type that derives from a generic class
and is not marked as [ClassInterface(ClassInterfaceType.None)]. Class
interfaces cannot be exposed for such types. Consider marking the type
with [ClassInterface(ClassInterfaceType.None)] and exposing an
explicit interface as the default interface to COM using the
ComDefaultInterface attribute. Assembly exported to
'C:UsersMyNameDocumentsScanLibraryPacketMyAssembly.tlb', and the
type library was registered successfully
When I add the Attribute [ClassInterface(ClassInterfaceType.None)]
as suggested to FVZServicesClient, I still get the same error message the next time I try the regasm. I know that the generated code can be overwritten at any time, but I verified with DotPeek that the ClassInterface-attribute was still in the compiled code.
Another thing I tried, was to create a partial class of FVZServicesClient that had the ClassInterface-attribute. I also marked the default interface with COMDefaultInterface as the message suggests. The result was the same. Adding the Attribute [ComVisible(false)]
for the FVZServicesClient did not help either.
When the library is referenced in VB6, the compile results in an error: "User-defined type not defined".
How can I exclude FVZServicesClient from the COM interface?
c# com vb6 wsdl
add a comment |
I have a WSDL generated class
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public partial class FVZServicesClient : System.ServiceModel.ClientBase<FVZScanningDocumentInfo.FVZServices.FVZServices>, FVZScanningDocumentInfo.FVZServices.FVZServices {
...
}
I need to provide a library that is used in VB6. I use a COM Interface which happens to use the above class.
When I register the assembly with
regasm MyAssembly.dll /tlb:MyAssembly.tlb
I get the error message
Microsoft .NET Framework Assembly Registration Utility version
4.7.3062.0 for Microsoft .NET Framework version 4.7.3062.0 Copyright (C) Microsoft Corporation. All rights reserved.
Types registered successfully Type library exporter warning processing
'MyAssembly.FVZServices.FVZServicesClient, MyAssembly'. Warning: Type
library exporter encountered a type that derives from a generic class
and is not marked as [ClassInterface(ClassInterfaceType.None)]. Class
interfaces cannot be exposed for such types. Consider marking the type
with [ClassInterface(ClassInterfaceType.None)] and exposing an
explicit interface as the default interface to COM using the
ComDefaultInterface attribute. Assembly exported to
'C:UsersMyNameDocumentsScanLibraryPacketMyAssembly.tlb', and the
type library was registered successfully
When I add the Attribute [ClassInterface(ClassInterfaceType.None)]
as suggested to FVZServicesClient, I still get the same error message the next time I try the regasm. I know that the generated code can be overwritten at any time, but I verified with DotPeek that the ClassInterface-attribute was still in the compiled code.
Another thing I tried, was to create a partial class of FVZServicesClient that had the ClassInterface-attribute. I also marked the default interface with COMDefaultInterface as the message suggests. The result was the same. Adding the Attribute [ComVisible(false)]
for the FVZServicesClient did not help either.
When the library is referenced in VB6, the compile results in an error: "User-defined type not defined".
How can I exclude FVZServicesClient from the COM interface?
c# com vb6 wsdl
If your WSDL generated code was in VB.net rather than C#, you could try changing thePublic
declaration toFriend
orFriend Protected
, then perhaps the generated code wouldn't be included in the exported interface. Can't tell if that would be allowable with the small amount of code posted. Unfortunately, there's no matching declaration in C# to VB'sFriend
. Can you use VB.net instead of C# for this generated class (and associated code)?
– MarkL
Nov 20 '18 at 16:44
I tried to generate the WSDL generated code as internal in C#. It made no difference. No VB.net is not an option.
– tobre
Nov 20 '18 at 18:48
add a comment |
I have a WSDL generated class
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public partial class FVZServicesClient : System.ServiceModel.ClientBase<FVZScanningDocumentInfo.FVZServices.FVZServices>, FVZScanningDocumentInfo.FVZServices.FVZServices {
...
}
I need to provide a library that is used in VB6. I use a COM Interface which happens to use the above class.
When I register the assembly with
regasm MyAssembly.dll /tlb:MyAssembly.tlb
I get the error message
Microsoft .NET Framework Assembly Registration Utility version
4.7.3062.0 for Microsoft .NET Framework version 4.7.3062.0 Copyright (C) Microsoft Corporation. All rights reserved.
Types registered successfully Type library exporter warning processing
'MyAssembly.FVZServices.FVZServicesClient, MyAssembly'. Warning: Type
library exporter encountered a type that derives from a generic class
and is not marked as [ClassInterface(ClassInterfaceType.None)]. Class
interfaces cannot be exposed for such types. Consider marking the type
with [ClassInterface(ClassInterfaceType.None)] and exposing an
explicit interface as the default interface to COM using the
ComDefaultInterface attribute. Assembly exported to
'C:UsersMyNameDocumentsScanLibraryPacketMyAssembly.tlb', and the
type library was registered successfully
When I add the Attribute [ClassInterface(ClassInterfaceType.None)]
as suggested to FVZServicesClient, I still get the same error message the next time I try the regasm. I know that the generated code can be overwritten at any time, but I verified with DotPeek that the ClassInterface-attribute was still in the compiled code.
Another thing I tried, was to create a partial class of FVZServicesClient that had the ClassInterface-attribute. I also marked the default interface with COMDefaultInterface as the message suggests. The result was the same. Adding the Attribute [ComVisible(false)]
for the FVZServicesClient did not help either.
When the library is referenced in VB6, the compile results in an error: "User-defined type not defined".
How can I exclude FVZServicesClient from the COM interface?
c# com vb6 wsdl
I have a WSDL generated class
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public partial class FVZServicesClient : System.ServiceModel.ClientBase<FVZScanningDocumentInfo.FVZServices.FVZServices>, FVZScanningDocumentInfo.FVZServices.FVZServices {
...
}
I need to provide a library that is used in VB6. I use a COM Interface which happens to use the above class.
When I register the assembly with
regasm MyAssembly.dll /tlb:MyAssembly.tlb
I get the error message
Microsoft .NET Framework Assembly Registration Utility version
4.7.3062.0 for Microsoft .NET Framework version 4.7.3062.0 Copyright (C) Microsoft Corporation. All rights reserved.
Types registered successfully Type library exporter warning processing
'MyAssembly.FVZServices.FVZServicesClient, MyAssembly'. Warning: Type
library exporter encountered a type that derives from a generic class
and is not marked as [ClassInterface(ClassInterfaceType.None)]. Class
interfaces cannot be exposed for such types. Consider marking the type
with [ClassInterface(ClassInterfaceType.None)] and exposing an
explicit interface as the default interface to COM using the
ComDefaultInterface attribute. Assembly exported to
'C:UsersMyNameDocumentsScanLibraryPacketMyAssembly.tlb', and the
type library was registered successfully
When I add the Attribute [ClassInterface(ClassInterfaceType.None)]
as suggested to FVZServicesClient, I still get the same error message the next time I try the regasm. I know that the generated code can be overwritten at any time, but I verified with DotPeek that the ClassInterface-attribute was still in the compiled code.
Another thing I tried, was to create a partial class of FVZServicesClient that had the ClassInterface-attribute. I also marked the default interface with COMDefaultInterface as the message suggests. The result was the same. Adding the Attribute [ComVisible(false)]
for the FVZServicesClient did not help either.
When the library is referenced in VB6, the compile results in an error: "User-defined type not defined".
How can I exclude FVZServicesClient from the COM interface?
c# com vb6 wsdl
c# com vb6 wsdl
edited Nov 27 '18 at 15:22
tobre
asked Nov 20 '18 at 7:39
tobretobre
6432829
6432829
If your WSDL generated code was in VB.net rather than C#, you could try changing thePublic
declaration toFriend
orFriend Protected
, then perhaps the generated code wouldn't be included in the exported interface. Can't tell if that would be allowable with the small amount of code posted. Unfortunately, there's no matching declaration in C# to VB'sFriend
. Can you use VB.net instead of C# for this generated class (and associated code)?
– MarkL
Nov 20 '18 at 16:44
I tried to generate the WSDL generated code as internal in C#. It made no difference. No VB.net is not an option.
– tobre
Nov 20 '18 at 18:48
add a comment |
If your WSDL generated code was in VB.net rather than C#, you could try changing thePublic
declaration toFriend
orFriend Protected
, then perhaps the generated code wouldn't be included in the exported interface. Can't tell if that would be allowable with the small amount of code posted. Unfortunately, there's no matching declaration in C# to VB'sFriend
. Can you use VB.net instead of C# for this generated class (and associated code)?
– MarkL
Nov 20 '18 at 16:44
I tried to generate the WSDL generated code as internal in C#. It made no difference. No VB.net is not an option.
– tobre
Nov 20 '18 at 18:48
If your WSDL generated code was in VB.net rather than C#, you could try changing the
Public
declaration to Friend
or Friend Protected
, then perhaps the generated code wouldn't be included in the exported interface. Can't tell if that would be allowable with the small amount of code posted. Unfortunately, there's no matching declaration in C# to VB's Friend
. Can you use VB.net instead of C# for this generated class (and associated code)?– MarkL
Nov 20 '18 at 16:44
If your WSDL generated code was in VB.net rather than C#, you could try changing the
Public
declaration to Friend
or Friend Protected
, then perhaps the generated code wouldn't be included in the exported interface. Can't tell if that would be allowable with the small amount of code posted. Unfortunately, there's no matching declaration in C# to VB's Friend
. Can you use VB.net instead of C# for this generated class (and associated code)?– MarkL
Nov 20 '18 at 16:44
I tried to generate the WSDL generated code as internal in C#. It made no difference. No VB.net is not an option.
– tobre
Nov 20 '18 at 18:48
I tried to generate the WSDL generated code as internal in C#. It made no difference. No VB.net is not an option.
– tobre
Nov 20 '18 at 18:48
add a comment |
2 Answers
2
active
oldest
votes
Try adding the attribute [ComVisible(false)]
to class FVZServicesClient
.
I'm not sure how your code generation process works, but as noted in the question you can at least try adding this manually and seeing if it has the desired effect.
I did try this already before I posted the question. It made no difference.
– tobre
Nov 27 '18 at 15:19
add a comment |
The error message was deceiving. In FVZServicesClient there is a method that expects a parameter to be passed by reference.
public ScanBatchItemType CheckBatch(ref ScanBatchItemType scanBatchItemTypes)
I did not pass it by ref. Once I corrected that, the error message disappeared. At the moment there is no COMVisibility or ClassInterface Attribute on FVZServicesClient and COM is Ok with that.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53388279%2fwsdl-generated-type-does-not-take-com-attributes%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Try adding the attribute [ComVisible(false)]
to class FVZServicesClient
.
I'm not sure how your code generation process works, but as noted in the question you can at least try adding this manually and seeing if it has the desired effect.
I did try this already before I posted the question. It made no difference.
– tobre
Nov 27 '18 at 15:19
add a comment |
Try adding the attribute [ComVisible(false)]
to class FVZServicesClient
.
I'm not sure how your code generation process works, but as noted in the question you can at least try adding this manually and seeing if it has the desired effect.
I did try this already before I posted the question. It made no difference.
– tobre
Nov 27 '18 at 15:19
add a comment |
Try adding the attribute [ComVisible(false)]
to class FVZServicesClient
.
I'm not sure how your code generation process works, but as noted in the question you can at least try adding this manually and seeing if it has the desired effect.
Try adding the attribute [ComVisible(false)]
to class FVZServicesClient
.
I'm not sure how your code generation process works, but as noted in the question you can at least try adding this manually and seeing if it has the desired effect.
answered Nov 26 '18 at 12:48
DaveInCazDaveInCaz
3,07131735
3,07131735
I did try this already before I posted the question. It made no difference.
– tobre
Nov 27 '18 at 15:19
add a comment |
I did try this already before I posted the question. It made no difference.
– tobre
Nov 27 '18 at 15:19
I did try this already before I posted the question. It made no difference.
– tobre
Nov 27 '18 at 15:19
I did try this already before I posted the question. It made no difference.
– tobre
Nov 27 '18 at 15:19
add a comment |
The error message was deceiving. In FVZServicesClient there is a method that expects a parameter to be passed by reference.
public ScanBatchItemType CheckBatch(ref ScanBatchItemType scanBatchItemTypes)
I did not pass it by ref. Once I corrected that, the error message disappeared. At the moment there is no COMVisibility or ClassInterface Attribute on FVZServicesClient and COM is Ok with that.
add a comment |
The error message was deceiving. In FVZServicesClient there is a method that expects a parameter to be passed by reference.
public ScanBatchItemType CheckBatch(ref ScanBatchItemType scanBatchItemTypes)
I did not pass it by ref. Once I corrected that, the error message disappeared. At the moment there is no COMVisibility or ClassInterface Attribute on FVZServicesClient and COM is Ok with that.
add a comment |
The error message was deceiving. In FVZServicesClient there is a method that expects a parameter to be passed by reference.
public ScanBatchItemType CheckBatch(ref ScanBatchItemType scanBatchItemTypes)
I did not pass it by ref. Once I corrected that, the error message disappeared. At the moment there is no COMVisibility or ClassInterface Attribute on FVZServicesClient and COM is Ok with that.
The error message was deceiving. In FVZServicesClient there is a method that expects a parameter to be passed by reference.
public ScanBatchItemType CheckBatch(ref ScanBatchItemType scanBatchItemTypes)
I did not pass it by ref. Once I corrected that, the error message disappeared. At the moment there is no COMVisibility or ClassInterface Attribute on FVZServicesClient and COM is Ok with that.
answered Nov 30 '18 at 13:42
tobretobre
6432829
6432829
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53388279%2fwsdl-generated-type-does-not-take-com-attributes%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
If your WSDL generated code was in VB.net rather than C#, you could try changing the
Public
declaration toFriend
orFriend Protected
, then perhaps the generated code wouldn't be included in the exported interface. Can't tell if that would be allowable with the small amount of code posted. Unfortunately, there's no matching declaration in C# to VB'sFriend
. Can you use VB.net instead of C# for this generated class (and associated code)?– MarkL
Nov 20 '18 at 16:44
I tried to generate the WSDL generated code as internal in C#. It made no difference. No VB.net is not an option.
– tobre
Nov 20 '18 at 18:48