unity如何配置Form对象

reformer 2012-03-29 03:56:44
在Unity中配置Form到容器中,出现下面问题:

启动程序后出现错误,提示:The type name or alias Form could not be resolved. Please check your configuration file and verify this type name.

内容和下面这位朋友的一样。
http://topic.csdn.net/u/20100521/11/cffb6421-a3bc-445c-b1a2-e50b9e40b293.html

哪位熟悉Unity的朋友支持一下,谢谢了

App.config内容如下:

<?xml version="1.0"?>
<configuration>
<configSections>
<section name="unity" type="Microsoft.Practices.Unity.Configuration.UnityConfigurationSection, Microsoft.Practices.Unity.Configuration"/>
</configSections>

<unity xmlns="http://schemas.microsoft.com/practices/2010/unity">
<assembly name="mscorlib, 2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
<assembly name="winApp"/>
<namespace name="System.Windows.Forms"/>
<namespace name="winApp"/>
<container>
<register type="Form" name="startup" mapTo="Form1"/>
</container>
</unity>
</configuration>


Program.cs内容如下:

using System;
using System.Windows.Forms;
using Microsoft.Practices.Unity;
using Microsoft.Practices.Unity.Configuration;

namespace winApp {
static class Program {
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main() {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);

IUnityContainer unityContainer = null;
unityContainer = new UnityContainer().LoadConfiguration();
Application.Run(unityContainer.RegisterType<Form>().Resolve<Form>("startup"));
}
}
}

...全文
337 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
yanwen119 2012-05-02
  • 打赏
  • 举报
回复
请问如何解决的呢,我也碰到了同样的问题
reformer 2012-03-30
  • 打赏
  • 举报
回复
没有人愿意指导一下吗?继续等
reformer 2012-03-30
  • 打赏
  • 举报
回复
已解决

17,748

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 .NET Framework
社区管理员
  • .NET Framework社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧