WPF编程之找不到资源“window1.xaml”之谜
来源:互联网 发布:唯唯诺诺的性格知乎 编辑:程序博客网 时间:2024/06/05 03:51
当你运行程序时提示:
找不到资源“window1.xaml”。
System.IO.IOException was unhandled
Message="找不到资源“window1.xaml”。"
Source="PresentationFramework"
StackTrace:
在 MS.Internal.AppModel.ResourcePart.GetStreamCore(FileMode mode, FileAccess access)
在 System.IO.Packaging.PackagePart.GetStream(FileMode mode, FileAccess access)
在 System.IO.Packaging.PackWebResponse.CachedResponse.GetResponseStream()
在 System.IO.Packaging.PackWebResponse.GetResponseStream()
在 System.IO.Packaging.PackWebResponse.get_ContentType()
在 MS.Internal.WpfWebRequestHelper.GetContentType(WebResponse response)
在 MS.Internal.WpfWebRequestHelper.CreateRequestAndGetResponseStream(Uri uri, ContentType& contentType)
在 System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
在 SDKSample.Window1.InitializeComponent()
在 SDKSample.Window1..ctor()
在 SDKSample.app.AppStartingUp(Object sender, StartupEventArgs e)
在 System.Windows.Application.OnStartup(StartupEventArgs e)
在 System.Windows.Application.<.ctor>b__0(Object unused)
在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
在 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
在 System.Windows.Threading.DispatcherOperation.InvokeImpl()
在 System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
在 System.Threading.ExecutionContext.runTryCode(Object userData)
在 System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
在 System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
在 System.Windows.Threading.DispatcherOperation.Invoke()
在 System.Windows.Threading.Dispatcher.ProcessQueue()
在 System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
在 MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
在 MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
在 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
在 System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)
在 System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)
在 MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
在 MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
在 System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
在 System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
在 System.Windows.Threading.Dispatcher.Run()
在 System.Windows.Application.RunInternal(Window window)
在 System.Windows.Application.Run(Window window)
在 System.Windows.Application.Run()
在 SDKSample.app.Main()
在 System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
在 System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
在 System.Threading.ThreadHelper.ThreadStart_Context(Object state)
在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
在 System.Threading.ThreadHelper.ThreadStart()
InnerException:
这个问题可以说是有点牛
为什么呢?
她在以前winform出现过,就是没有设定解决方案或是项目启动(窗体)
这个设定在VS中为解决方案或是项目属性中设置
但是你会问 我新建一个WpfApplication 时候 那里设定为空啊(Not Set)
呵呵 这个就不要问我 了,找不到资源“window1.xaml”解决方法就是设定解决方案启动为window1.xaml(启动窗体)
有时候VS很霸道,他就不给你设定window1.xaml为启动窗体,就是下拉列表就没有window1.xaml
怎么办?
直接用记事本打开项目文件比如Visual C# Project file
那个是个XML格式文件(不要问我什么是XML)
修改
<StartupObject>Window1.xaml</StartupObject>
如果还是不行就新建一个工程,导入文件........
- WPF编程之找不到资源“window1.xaml”之谜
- WPF——找不到资源window1.xaml
- WPF——找不到资源mainwindow.xaml
- WPF介绍之XAML
- WPF 之 XAML语法
- WPF之XAML积累
- WPF初学者之XAML的资源(Resources)结构
- WPF初学者之 XAML的资源(Resources)结构
- WPF入门之XAML初窥
- wpf之二:xaml详解
- WPF 之 XAML、WPF核心程序集
- WPF指南之二(XAML概述)
- WPF指南之二(XAML概述)
- WPF学习之二:XAML学习
- WPF指南之XAML的名字空间
- WPF乱炖之 3: XAML 概览
- WPF学习笔记1:XAML之NameSpace
- 【WPF编程】XAML
- 如何破解XP密码
- 几个css按钮样式
- 项目风险之人员流动风险
- DOS命令大全
- java中回调的实现
- WPF编程之找不到资源“window1.xaml”之谜
- 中国地震局已将汶川地震震级从7.8级修订为8级
- 最先进的技术:Windows Workflow Foundation
- linux驱动指南
- 完美结束EXCEL进程
- RegularExpressionDemo.java
- 逻辑代码与呈现代码分离原则
- Zju 2971 Give Me the Number不再困惑
- fedora8 无法上网