无法创建WizardPage,类型的构造函数...未找到 [英] Cannot create WizardPage , Constructor on type ... not found

查看:154
本文介绍了无法创建WizardPage,类型的构造函数...未找到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了主题中的错误,我已经尝试修复它几个小时但到目前为止没有结果。
我有一个Visual Studio项目向导(创建新项目 - 选择项目模板)我想把这个向导实现到我的软件工厂。

我有点了解我在GAT中的方式,但我似乎无法解决这个问题。
在我已经指定的配方中自定义向导页面。像这样:
< GatheringServiceData>
< Wizard xmlns =" http://schemas.microsoft。 COM / PAG / GAX的向导" SchemaVersion =" 1.0">
< Pages>
< Page Type =" MyProject.CustomWizardPages.MyWizardPage,MyProject" />
< / Pages>
< /向导>
< / GatheringServiceData>

我知道引用是好的,否则我会得到一个不同的错误。 >所以看起来运行时找不到构造函数,而我可以验证它是否存在并标记为public。
它是否与自定义页面不继承自"CustomWizardPage"的事实有关。但来自"Microsoft.BizTalk.Wizard.WizardPage"?

任何人?

完整的例外是这样的:

Microsoft.Practices.WizardFramework.WizardExecutionException:向导失败执行。错误是:
无法创建WizardPage,类型为"MyProject.CustomWizardPages.MyWizardPage"的构造函数未找到.. ---> Microsoft.Practices.WizardFramework.WizardFrameworkException:无法创建WizardPage,类型为'MyProject.CustomWizardPages.MyWizardPage'的构造函数未找到.. ---> System.MissingMethodException:找不到类型'MyProject.CustomWizardPages.MyWizardPage'的构造函数。在System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr,Binder binder,Object [] args,CultureInfo culture,Object [] activationAttributes)
at System.Activator.CreateInstance(Type type,BindingFlags bindingAttr,Binder binder,Object [] args,CultureInfo culture,Object [] activationAttributes)
at Microsoft.Practices.WizardFramework.WizardForm.CreateWizardPage(Page page)
- - 内部异常堆栈跟踪的结束---
Microsoft.Practices.WizardFramework.WizardForm.CreateWizardPage(页面)
位于Microsoft.Practices的Microsoft.Practices.WizardFramework.WizardForm.EndInit()
。 WizardFramework.WizardForm..ctor(IServiceProvider提供程序,向导wizardConfig,String basePath)
at Microsoft.Practices.WizardFramework.WizardForm..ctor(IServiceProvider provider,Wizard wizardConfig)
at Microsoft.Practices.WizardFra mework.WizardGatheringService.Microsoft.Practices.Common.Services.IValueGatheringService.Execute(XmlElement data,Boolean allowSuspend)
---内部异常堆栈跟踪结束---
来自Microsoft.Practices.WizardFramework.WizardGatheringService.Microsoft .Practices.Common.Services.IValueGatheringService.Execute(XmlElement data,Boolean allowSuspend)
at Microsoft.Practices.RecipeFramework.Recipe.Execute(Boolean allowSuspend)
at Microsoft.Practices.RecipeFramework.GuidancePackage.Execute(String recipe) ,IAssetReference引用,IDictionary参数)
Microsoft.Practices.RecipeFramework.GuidancePackage.Execute(IAssetReference reference)
Microsoft.Practices.RecipeFramework.RecipeReference.OnExecute()
at Microsoft.Practices.RecipeFramework.AssetReference .Execute()
at Microsoft.Practices.RecipeFramework.VisualStudio.RecipeMenuCommand.OnExec()
at Microsoft.Practices.RecipeFramework.VisualStudio.AssetMenuCommand.Invoke()

I'm running into the error in the subject and I've tried to fix it for hours now but with no result so far.
I have a Visual Studio project wizard (Create new project - select project template) and I want to implement this wizard into my software factory.

I'm kind of know my way arround in the GAT but I can't seem to fix this.
In the recipe I've specified the custom wizard page. like this:
 <GatheringServiceData>
  <Wizard xmlns="http://schemas.microsoft.com/pag/gax-wizards" SchemaVersion="1.0">
   <Pages>
    <Page Type="MyProject.CustomWizardPages.MyWizardPage,MyProject" />
   </Pages>
  </Wizard>
 </GatheringServiceData>

I know the references are ok, otherwise I would get a different error.
So it looks like the runtime cannot find the constructor, while I can verify it is there and marked public.
Could it be it has something to do with the fact that the custom page doesn't inherit from "CustomWizardPage" but from "Microsoft.BizTalk.Wizard.WizardPage"?

Anyone?

The complete exception is this:

Microsoft.Practices.WizardFramework.WizardExecutionException: The wizard  failed to execute. The error was:
Cannot create WizardPage , Constructor on type 'MyProject.CustomWizardPages.MyWizardPage' not found.. ---> Microsoft.Practices.WizardFramework.WizardFrameworkException: Cannot create WizardPage , Constructor on type 'MyProject.CustomWizardPages.MyWizardPage' not found.. ---> System.MissingMethodException: Constructor on type 'MyProject.CustomWizardPages.MyWizardPage' not found.
   at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
   at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
   at Microsoft.Practices.WizardFramework.WizardForm.CreateWizardPage(Page page)
   --- End of inner exception stack trace ---
   at Microsoft.Practices.WizardFramework.WizardForm.CreateWizardPage(Page page)
   at Microsoft.Practices.WizardFramework.WizardForm.EndInit()
   at Microsoft.Practices.WizardFramework.WizardForm..ctor(IServiceProvider provider, Wizard wizardConfig, String basePath)
   at Microsoft.Practices.WizardFramework.WizardForm..ctor(IServiceProvider provider, Wizard wizardConfig)
   at Microsoft.Practices.WizardFramework.WizardGatheringService.Microsoft.Practices.Common.Services.IValueGatheringService.Execute(XmlElement data, Boolean allowSuspend)
   --- End of inner exception stack trace ---
   at Microsoft.Practices.WizardFramework.WizardGatheringService.Microsoft.Practices.Common.Services.IValueGatheringService.Execute(XmlElement data, Boolean allowSuspend)
   at Microsoft.Practices.RecipeFramework.Recipe.Execute(Boolean allowSuspend)
   at Microsoft.Practices.RecipeFramework.GuidancePackage.Execute(String recipe, IAssetReference reference, IDictionary arguments)
   at Microsoft.Practices.RecipeFramework.GuidancePackage.Execute(IAssetReference reference)
   at Microsoft.Practices.RecipeFramework.RecipeReference.OnExecute()
   at Microsoft.Practices.RecipeFramework.AssetReference.Execute()
   at Microsoft.Practices.RecipeFramework.VisualStudio.RecipeMenuCommand.OnExec()
   at Microsoft.Practices.RecipeFramework.VisualStudio.AssetMenuCommand.Invoke()

推荐答案

我找到了一个解决方案。

该类应继承自CustomWizardPage,但拥有正确的构造函数更为重要:

public MyCustomPage(WizardForm parent)
:base(parent)
{
// Windows窗体设计器需要此调用。
InitializeComponent();
}

如果没有这个构造函数,它会给出错误。
I sort of found a solution.

The class should inherit from CustomWizardPage but it is more important to have the correct constructor:

public MyCustomPage(WizardForm parent)
      : base(parent)
  {
   // This call is required by the Windows Form Designer.
   InitializeComponent();
   }

Without this constructor it gives the error.


这篇关于无法创建WizardPage,类型的构造函数...未找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆