c# - UWP 值不能为空。参数名称 : path1

标签 c# visual-studio uwp windows-10-universal uwp-xaml

我正在使用 Visual Studio 2015 创建一个空白的 UWP

我每次尝试构建时都会收到以下错误

Error   CS1061  'MainPage' does not contain a definition for 'InitializeComponent' and no extension method 'InitializeComponent' accepting a first argument of type 'MainPage' could be found (are you missing a using directive or an assembly reference?)


Error       Value cannot be null.
Parameter name: path1

enter image description here

我尝试卸载 Windows 软件开发工具包,然后安装它,但没有成功

我有一个工作项目,但现在它给出了同样的错误

.csproj中的目标如下

<TargetPlatformVersion>10.0.14393.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.14393.0</TargetPlatformMinVersion>

最佳答案

确保命名空间在文件 MainPage.xaml.cs 和 MainPage.xaml 中都是正确的。

例子:-

XAML

C#

交叉检查后,如果同样的问题仍然存在,则从解决方案中删除 obj 和 bin 文件夹,然后再次重建解决方案。

关于c# - UWP 值不能为空。参数名称 : path1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41347428/

相关文章:

c# - 带有用于搜索的文本框的 DataTemplate

c# - 跨平台应用程序 WPF、ASP.NET、Silverlight、WP7、XAML

javascript - 如何在 Asp.Net 按钮单击事件上将值从 C# 发送到 javascript?

c# - 为什么 Visual Studio 和 Resharper 无法识别这种死代码?

c++ - 如何将一个项目的构建文件复制到第二个项目的 include/library 目录?

python - 如何调试我使用 ctypes 从 Python 调用的 Visual Studio 中的 DLL?

c# - 当开关不处理一个或多个枚举值时,我可能会出现 C# 编译时错误吗?

c# - Orchard 的 IContentManager.BuildDisplay 方法中的 groupId 参数是干什么用的?

xaml - 如何在UWP中设置RatingControl星星的颜色?

UWP 应用与 Windows 服务的通信