从 netstandard 转换为框架后,Visual Studio 2017 未将 csproj 视为有效的项目文件 [英] Visual studio 2017 not treating csproj as a valid project file after conversion from netstandard to framework

查看:20
本文介绍了从 netstandard 转换为框架后,Visual Studio 2017 未将 csproj 视为有效的项目文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是在 VS Enterprise 2017 15.8.2 中完成的.我已将 .NET Framework 项目 (C#) 转换为 netstandard,然后由于构建问题不得不将其转换回来.转换是通过从 git 恢复以前的提交来完成的.但是,现在 VS 无法将该项目识别为有效项目.链接的单元测试项目生成警告

The following was done in VS Enterprise 2017 15.8.2. I had converted a .NET Framework project (C#) into netstandard and then had to convert it back due to a build issue. The conversion was done by restoring a previous commit from git. However, now VS does not recognize the project as a valid project. The linked unit test project generates the warning

引用的组件 '<项目名称 >' 找不到.

the referenced component '< project name >' could not be found.

尝试查看项目属性产生错误

Attempts to view the project properties produces the error

尝试加载项目属性窗口时出错.关闭窗口,然后再试一次.未找到成员.(来自 HRESULT 的例外:0x80020003 (DISP_E_MEMBERNOTFOUND))

An error occurred trying to load the project properties window. Close the window and try again. Member not found. (Exception from HRESULT: 0x80020003 (DISP_E_MEMBERNOTFOUND))

构建选择选项从构建菜单中消失,构建/调试选项从项目上下文菜单中消失.解决方案资源管理器的依赖项节点为空.我看过其他帖子,其中人们描述了类似的情况,该情况通过重新打开解决方案或将 vs 的模式更改为不同类型的开发或删除 bin/obj 来解决.这些都没有奏效,也没有完全重启.鉴于此项目文件曾经是框架,我怀疑我的 .gitignore 覆盖的某处缓存了一些需要删除的内容.

The build selection options disappear from the build menu and the build/debug options are gone from the project context menu. The dependencies node of the solution explorer is empty. I have seen other posts in which people describe a similar condition that is resolved by either reopenning the solution or changing the mode of vs to a different type of development or deleting bin/obj. None of these worked, nor a full reboot. Given that this project file used to be framework I suspect there is something cached somewhere that is covered by my .gitignore which needs to be deleted.

推荐答案

我自己也遇到了同样的问题.似乎是解决方案文件的问题.我从解决方案中删除了该项目,然后再次将其添加回来.这会导致 VS 将其识别为正确的项目类型.希望这有助于其他人在这个问题上花费太多时间.

Ran into the same issue myself. Appears to be an issue with the solution file. I removed the project from the solution then added it back again. This cause VS to recognize this as the correct project type. Hope this helps somebody else from spending too much time on this issue.

这篇关于从 netstandard 转换为框架后,Visual Studio 2017 未将 csproj 视为有效的项目文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆