我也遇到了同样的错误。
Visual Studio Professional 2015。已安装版本:14.0.25431.01 Update 3(带有KB3165756)
在安装Azure SDK 2.9.6之后,出现了这种错误行为,它会将.NET Core工具和.NET Core模板安装到Visual Studio 2015中(实际上安装了.NET Core Tools(Preview 2)14.1.21111.0)
如果您向C#解决方案添加Class Library(.NET Core)或Console Application(.NET Core),则forms.cs将再次在解决方案资源管理器中可见
在添加Class Library(.NET Core)之前:
在解决方案中添加Class Library(.NET Core)之后:
.NET Core工具存在问题。希望未来的修补程序可以解决这个问题。
/project_directory/project_name.csproj
这个文件,确保你的表单名字为your_form_name.cs
像这样:注意:首先删除该文件中所有现有your_form_name.cs
的记录,然后添加以下内容:
`<Compile Include="your_form_name.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="your_form_name.Designer.cs">
<DependentUpon>your_form_name.cs</DependentUpon>
</Compile>
<EmbeddedResource Include="your_form_name.resx">
<DependentUpon>your_form_name.cs</DependentUpon>
</EmbeddedResource>`
我正在使用VS2019,遇到了同样的问题。 但是我解决了这个问题。 我使用了Visual Assist for VS2019,在它过期后我卸载了它。 然后我就遇到了这个问题。 所以我重新安装了它并进行了授权。 现在,它可以正常工作了。
.cs
文件吗?为什么会有另一个与之相关的.cs
文件? - Claies