安装了vs2019之后,发现有的项目中引用的其他项目的源码,但是无法识别了。

最后发现是因为project guid是大写导致的。

https://stackoverflow.com/questions/36204515/vs-project-references-broken-on-case-sensitivity-of-guid

TL;DR

Visual Studio isn't entirely consistent about how it assigns GUIDs to projects or how it specifies those GUIDs in project references. I was able to resolve the problem by using upper case GUIDs with braces for ProjectGuid elements and lower case with braces for Project elements (in references).

Background

We have a large solution (60+ C# projects), and were having regular issues with solution Rebuild as incorrect build order would cause failure to resolve referenced projects that had not yet been built (but should have been). Build Dependencies and Build Order appeared correct. MSBuild batch build worked fine, it was only a problem when rebuilding from Visual Studio.

Forcing all project GUIDs to upper case with braces and all project reference GUIDs to lower case with braces fixed the problem. This is usually how Visual Studio generates these GUIDs, but not always.

Doing some investigation in a brand new test solution, it turns out that:

  1. Generated GUIDs for console application projects are upper case with braces.
  2. Generated GUIDs for class library projects are initially lower case with no braces.
  3. If a new project reference is added a class library project with a lower case GUID, then not only is the reference GUID added, but the project GUID is converted to upper case with braces.
  4. If a copy of a class library project is made and then added to the solution then its GUID is replaced with a new one that uses upper case and braces. (But if a copy is made and its GUID manually removed, Visual Studio does not insert a replacement GUID into the .csproj file.)
  5. Project references GUIDs are usually use lower case and braces, but somehow our project had accumulated a bunch of upper case GUID references.
  6. GUIDs in the .sln always use upper case and braces.

I was able to fix our broken rebuild by replacing the reference GUIDs with either all upper case or all lower case -- it's something about the mix of upper and lower case that was giving Visual Studio problems (perhaps case-sensitive string keys in a dictionary somewhere?) Since Visual Studio normally adds references with lower case GUIDs, that is the option I chose to go with.

Regex Search & Replace

To fix this, I used Notepad++ regex-based search and replace in files to force all ProjectGuids in .csproj files to be upper case with braces (the default for console applications, and the style Visual Studio will apply after adding any project reference to the project):

替换项目本身的guid(这目前没有问题,所以不需要执行)

Find what: (<ProjectGuid>)\{?([0-9a-f-]+)\}?(</ProjectGuid>)
Replace with: \1{\U\2}\E\3 这里是确保guid大写
Search in: *.csproj

Be sure to turn on regular expression search, and turn off match case. And don't search all files, or you may make changes you don't want, for example in *.xproj files, as noted by @AspNyc. (See this answer for additional info on use of regular expressions for changing case.)

替换引用的其他项目的guid

I then replaced all references to projects to use lower case with braces (which is what Visual Studio usually does):

Find what: (<Project>)\{?([0-9a-f-]+)\}?(</Project>)
Replace with: \1{\L\2}\E\3
这里是确保guid小写
Search in: *.csproj

Having made these changes, Visual Studio solution rebuild now works reliably. (At least until next time rogue upper case reference GUIDs sneak into our project.)

visual studio中csproj文件中的project guid改为小写的更多相关文章

  1. 在 Visual Studio 等编辑器/IDE中自动切换输入法,不需要手动的有没有?

    使用Visual Studio写代码,经常遇到的一个问题就是切换中文输入法麻烦,输入完注释//,要切换到中文,输入完引号,要输入中文,然后还需要切换回来,有没有? 有时候中文输入法忽然失效有没有?明明 ...

  2. 【转】【UML】使用Visual Studio 2010 Team System中的架构师工具(设计与建模)

    Lab 1: 应用程序建模 实验目标 这个实验的目的是展示如何在Visual Studio 2010旗舰版中进行应用程序建模.团队中的架构师会通过建模确定应用程序是否满足客户的需求. 你可以创建不同级 ...

  3. Visual Studio下Qt编程中对中文的处理

    Visual Studio下Qt编程中对中文的处理 本文为原创文章,原文地址http://www.cnblogs.com/c4isr/p/qt_develop_in_vs.html Visual St ...

  4. 在visual studio的工程项目应用中打开console控制窗口

    在visual studio的工程项目应用中打开console控制窗口,这个可以方便我们在console中输出参数的值检查错误. 只需要在需要打开console的地方加入下面的代码即可. AllocC ...

  5. 用DebuggerDisplay在Visual Studio的调试器中定制类的显示方式

    博客搬到了fresky.github.io - Dawei XU,请各位看官挪步.最新的一篇是:用DebuggerDisplay在Visual Studio的调试器中定制类的显示方式.

  6. 使用visual studio把xsd文件转成xml格式文件

    使用visual studio把xsd文件转成xml格式文件 最近一段时间都在做Amazon的mws api的对接工作,mws api的描述文件都是使用的xsd文件来进行的,之前确实也没有接触过,也花 ...

  7. Visual Studio 生成DLL文件

    新建一个项目,在菜单栏中选择“项目”/“**属性”选项,该页面中将“输出类型”下拉列表中的选项选择为“类库”,然后重新生成一下该项目,或者在“Visual Studio 2008命令提示”中输入以下命 ...

  8. rpm 系 linux 系统中 repo 文件中的 $release 到底等于多少?

    rpm 系 linux 系统中 repo 文件中的 $release 到底等于多少? 结论 对于 8 来说,通过以下命令 #/usr/libexec/platform-python -c 'impor ...

  9. 解决visual studio 2013编译过程中存在的无法打开kernel.lib问题

    1. 出现此类问题的原因 由于原visual studio文件中的安装中出现问题,所以原有的SDK(soft development kits)文件出现缺失: 2. 解决方法1 重新下载SDK工具,安 ...

随机推荐

  1. jquery和ajax和springmvc

    <script type="text/javascript" src="js/jquery-1.11.1.js"></script> $ ...

  2. css 调转180度:transform: rotate(180deg);

    css 调转180度:transform: rotate(180deg);

  3. 四、XML语言学习(2)

    XML约束之DTD 1.XML都是用户自定义标签,若出现小小的错误,软件程序将不能正确地获取文件中的内容而报错.XML技术中,可以编写一个文档来约束一个XML的书写规范,这个文档称之为约束格式良好的X ...

  4. mysql5.7.17安装配置图文教程

    My SQL的特点: MySQL是一个关系型数据库管理系统,由瑞典MySQL AB 公司开发,目前属于 Oracle 旗下产品.MySQL 是最流行的关系型数据库管理系统之一,在 WEB 应用方面,M ...

  5. Mybatis连接配置文件详解

    <?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE configurationPUBLIC &q ...

  6. linux--- python3环境部署篇

    环境部署 我们在pycharm上都是自己设置的python3解释器的环境变量,使得代码能够正常执行!可是怎么能让我们的python代码在LINUX上跑起来呢? linux是内置python,可是内置的 ...

  7. Eclipse+pydev+手动安装

    1.Eclipse中手动安装pydev插件 解决:Eclipse版本中的windows-performance下面无法显示pydev的情况 1.Eclipse版本是:Version: Luna Ser ...

  8. js--单选按钮赋值

    var sex='${userInfo.sex}'; if(sex=="女"){ $("input[name=sex][value='女']").attr(&q ...

  9. websocket作用

    1.即时通讯 web即时通讯(网页的QQ,聊天系统等)可以通过websocket实现. 2.轮询 web开发中,有时需要通过轮询(比如时间间隔5秒)去服务器读取数据. 使用HTTP协议向服务器发送re ...

  10. 外星人入侵——安装Pygame

    本文以win10和Python3为例来介绍如何安装Pygame. 安装Pygame需要使用pip,我们首先检查pip是否已被安装. 打开一个终端窗口,并执行如下命令 C:\Users\hys>p ...