我对Visual Studio 2010已经发生了很长一段时间的烦恼.我有一个类文件,我将VS保存为类型"组件",我无法辨别.如果我忘记并尝试打开文件,它会查找不存在的设计器.
我查看了Google并发现了VS 2005的一些类似问题,但问题似乎与从GUI组件类(listbox,combobox等)派生有关.这个课不这样做.
该文件是GpsUtilities.cs.它如下,出现在的csproj文件SubType中Component.没有其他对该文件的引用,即没有任何声称它DependentUpon.
<Compile Include="Utilities\GpsUtilities.cs">
<SubType>Component</SubType>
</Compile>
Run Code Online (Sandbox Code Playgroud)
即使我删除SubType标记,即使我明确地将其设置为Code替代Component,它仍然将其保存为SubType的Component.
这是类结构(所有代码都被删除).正如我所说,它不会继承,甚至不导入与GUI相关的任何名称空间.
using System;
using System.ComponentModel;
using System.IO.Ports;
using System.Text.RegularExpressions;
using System.Timers;
using System.Xml.Serialization;
namespace AppNamespace
{
public class GpsUtil : INotifyPropertyChanged
{
public GpsUtil() { }
public static GpsUtil CreateInstance() { }
public bool IsGpsReady { get; }
public GPSPort GpsSerialPort { get; private set; }
public Timer GpsTimer { get; …Run Code Online (Sandbox Code Playgroud) Print.cs当我需要看到它的Code View(F7)时,我有一个名字,它总是在Design View中顽固地打开.它在解决方案资源管理器中的其他类也有不同的图标.
我查看了属性,看不到任何相关内容.我也试过删除并重新创建课程,但图标又回来了.
如何强制Print.cs始终在代码视图中打开?
(点击放大)
注意:忽略绿色波浪线,这只是一个警告,检测到无法访问的代码.