简体   繁体   English

无法向vs2015项目添加系统引用

[英]unable to add system reference to vs2015 project

I am trying to add Microsoft.CSharp and other system references to ac# class library in vs 2015 community edition bound to tfs. 我正在尝试将Microsoft.CSharp和其他系统引用添加到绑定到tfs的vs 2015社区版中的ac#类库。 when i add it doesn't persist the path for this particular class library. 当我添加它不会持久保存此特定类库的路径。 All the references i add are highlighted in yellow !. 我添加的所有参考均以黄色突出显示! The same references and paths I am able to add to other projects but not this current one I am facing an issue with. 我可以为其他项目添加相同的参考和路径,但当前遇到的问题与之不同。

I have created a new solution and tried. 我创建了一个新的解决方案并尝试过。 it still doesn't work. 它仍然无法正常工作。 However I would not want to create a new project file. 但是,我不想创建一个新的项目文件。 Any suggestions or workarounds to solve this problem? 有什么建议或解决方法可以解决此问题?

Your .csproj files might be "corrupted" somehow. 您的.csproj文件可能会以某种方式“损坏”。 I would create a new project file and then overwrite your existing project file so that it can be checked into TFS. 我将创建一个新的项目文件,然后覆盖您现有的项目文件,以便可以检入TFS。

Create a new project and copy all of your source files into the folder. 创建一个新项目并将所有源文件复制到该文件夹​​中。 If you have folders use Visual Studio to re-create them. 如果您有文件夹,请使用Visual Studio重新创建它们。 Use the show hidden button in Solution Explorer to show all the files. 使用解决方案资源管理器中的“显示隐藏”按钮显示所有文件。 Now include the files by right clicking and selecting include in project (you can use Shift to select multiple files). 现在,通过右键单击并选择包含在项目中来包含文件(您可以使用Shift选择多个文件)。 Check your project properties and make sure you copy anything important. 检查项目属性并确保复制任何重要内容。

I tried a few things- 我试了几件事 -

I changed from community edition to professional edition 2015. the same problem persisted. 我从社区版更改为专业版2015。相同的问题仍然存在。

I created a new csproj file and added back the files manually. 我创建了一个新的csproj文件并手动添加了文件。 It got added fine. 它得到了很好的补充。 However I am pulling the references from a nuget packages folder and updating. 但是我从nuget包文件夹中提取引用并进行更新。 if we have the wrong path to the nuget packages, even though we add the references, they were being shown as not referenced. 如果我们有一个错误的nuget包路径,即使我们添加了引用,它们也显示为未引用。

The nuget packages needed to be correctly mapped or else VS2K15 acts weird. nuget包需要正确映射,否则VS2K15会很奇怪。 So bottom line, because my nuget references were incorrect it was throwing these errors. 所以底线,因为我的nuget引用不正确,它抛出了这些错误。 I know This is very weird!!! 我知道这很奇怪!

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

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