简体   繁体   English

转换的C#proj(来自vb)不允许添加文件

[英]Converted c# proj(from vb) doesnt allow to add files

I have ac# project converted from VB. 我有从VB转换的ac#项目。

When I say converted, I did not create a new project from scratch but I took the VB project changed all the file names, code and the proj file. 当我说转换时,我并没有从头开始创建一个新项目,而是让VB项目更改了所有文件名,代码和proj文件。

Project builds and works fine but when I try to add a new item it shows all the VB items in the list and not C#. 项目可以正常运行,但是当我尝试添加新项目时,它会在列表中显示所有VB项目,而不是C#。 Sorry I couldn't post the image (it requires at least 10 posts) 抱歉,我无法发布图片(至少需要发布10条帖子)

Any thoughts? 有什么想法吗?

your 'Create new project should look something like (this is for 2012): 您的“创建新项目应类似于(2012年): 在此处输入图片说明

      ^ ^ ^
      | | |
      | | |
       Here

Down the left hand side, you should see 'Visual C#'. 在左侧,您应该看到“ Visual C#”。

Selecting 'Visual Basic' will create a vb project, but you want to create a C# project. 选择“ Visual Basic”将创建一个vb项目,但是您想创建一个C#项目。

EDIT 编辑

Following these steps would allow you to install further templates: 执行以下步骤将允许您安装更多模板:

To install project templates from the New Project dialog box 从“新建项目”对话框安装项目模板

On the File menu, click New, and then click Project. 在文件菜单上,单击新建,然后单击项目。 The New Project dialog box opens. 将打开“新建项目”对话框。

In the left pane, click Online Templates and expand the Templates list. 在左窗格中,单击“在线模板”,然后展开“模板”列表。

In the Templates list, select the category of templates to search for 在模板列表中,选择要搜索的模板类别

-- OR -- - 要么 -

Type one or more keywords in the Search box. 在搜索框中键入一个或多个关键字。

A list of templates appears in the middle pane. 模板列表显示在中间窗格中。

More information can be found here 更多信息可以在这里找到

EDIT 2 编辑2

To Help others coming across this question in the future; 帮助将来其他人遇到这个问题;

The OP used Sharp Develop to convert from C# -> VB -> C# OP使用Sharp Develop从C#-> VB-> C#转换

The OP noted that the (main) difference in both the project files that they found was the initial C# project had below line immediately below the tag: OP指出,他们发现的两个项目文件中的(主要)区别是初始C#项目在标签正下方的下面一行:

Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props' 

If this approach may help others: I converted my converted C# project to VB using SharpDevelop and then converted it back to C#. 如果该方法可能对其他人有所帮助:我使用SharpDevelop将转换后的C#项目转换为VB,然后将其转换回C#。 The difference in both the project files that I found is the initial C# project had below line immediately below the tag: Exists('$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props' 我发现的两个项目文件之间的区别是,初始C#项目在标签正下方的下面一行显示:Exists('$(MSBuildExtensionsPath)\\ $(MSBuildToolsVersion)\\ Microsoft.Common.props'

Below is from jbutler 下面是来自jbutler

As said in the comments, if they are 'converted' already, once you're in a new c# project it'll be a matter of 'Add->Existing item' and choosing the 'converted' classes – 如评论中所述,如果它们已经“转换”,那么一旦进入新的C#项目,就可以通过“添加->现有项目”并选择“转换”类来解决–

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

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