简体   繁体   English

表单设计器视图在 Visual Studio 2019 C# CMake 项目中不可用

[英]Form designer view is not available in visual studio 2019 C# CMake project

I'm trying to port my C# Windows Form project from.csproj to CSharp CMake CMakeLists.txt.我正在尝试将我的 C# Windows 表单项目从.csproj 移植到 CSharp CMake CMakeLists.txt。 I successfully made CMakeLists.txt similar to here .我成功地制作了类似于这里的 CMakeLists.txt 。 The only problem is when the project opened with CMakeLists.txt, the Form Designer is not available (as shown below).唯一的问题是使用 CMakeLists.txt 打开项目时,Form Designer 不可用(如下图所示)。 Is it any way to fix the problem?有什么办法可以解决这个问题吗?

csproj: csproj:

在此处输入图像描述

CMakeLists.txt: CMakeLists.txt:

在此处输入图像描述

Your second image (from your CMake-generated project) is in a different View than the first image.您的第二张图片(来自您的 CMake 生成的项目)与第一张图片位于不同的视图中。 The first image is the Solution View , in which the Form1.cs and Form1.Designer.cs files are grouped to show that the Form Designer is available.第一个图像是解决方案视图,其中Form1.csForm1.Designer.cs文件被分组以显示表单设计器可用。 The CMake (second) image is showing the Folder View , which does not group the two files together. CMake(第二个)图像显示的是文件夹视图,它不会将两个文件组合在一起。

CMake does not control what view you see in Visual Studio, your Visual Studio IDE controls this. CMake 不控制您在 Visual Studio 中看到的视图,您的 Visual Studio IDE 控制它。 The toolbar across the top of Solution Explorer has a button (called "Switch Views") to switch from a solution view to a folder view (and vice versa).解决方案资源管理器顶部的工具栏有一个按钮(称为“切换视图”),用于从解决方案视图切换到文件夹视图(反之亦然)。 You can use this to switch your perspective back to Solution View so the Form Designer is shown.您可以使用它来将您的视角切换回解决方案视图,以便显示表单设计器。


Note: This button has a bug in Visual Studio 2019 (see here ), so switching back to Solution View may not work as expected.注意:此按钮在 Visual Studio 2019 中存在错误(请参阅此处),因此切换回解决方案视图可能无法按预期工作。 I've worked around this issue by simply closing and re-opening the Solution.我通过简单地关闭并重新打开解决方案来解决此问题。

When you open the solution file (via File > Open > Project/Solution... ), your default View should be the Solution View , and the Form Designers for your forms sources should be accessible.当您打开解决方案文件(通过File > Open > Project/Solution... )时,您的默认视图应该是解决方案视图,并且您的 forms 源的表单设计器应该可以访问。 If you open the solution by doing File > Open > CMake... , your default View will be Folder View , which is not what you want.如果您通过执行File > Open > CMake...打开解决方案,您的默认视图将是Folder View ,这不是您想要的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM