visual studio中csproj文件中的project guid改为小写
安装了vs2019之后,发现有的项目中引用的其他项目的源码,但是无法识别了。
最后发现是因为project 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:
- Generated GUIDs for console application projects are upper case with braces.
- Generated GUIDs for class library projects are initially lower case with no braces.
- 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.
- 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.)
- Project references GUIDs are usually use lower case and braces, but somehow our project had accumulated a bunch of upper case GUID references.
- 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改为小写的更多相关文章
- 在 Visual Studio 等编辑器/IDE中自动切换输入法,不需要手动的有没有?
使用Visual Studio写代码,经常遇到的一个问题就是切换中文输入法麻烦,输入完注释//,要切换到中文,输入完引号,要输入中文,然后还需要切换回来,有没有? 有时候中文输入法忽然失效有没有?明明 ...
- 【转】【UML】使用Visual Studio 2010 Team System中的架构师工具(设计与建模)
Lab 1: 应用程序建模 实验目标 这个实验的目的是展示如何在Visual Studio 2010旗舰版中进行应用程序建模.团队中的架构师会通过建模确定应用程序是否满足客户的需求. 你可以创建不同级 ...
- Visual Studio下Qt编程中对中文的处理
Visual Studio下Qt编程中对中文的处理 本文为原创文章,原文地址http://www.cnblogs.com/c4isr/p/qt_develop_in_vs.html Visual St ...
- 在visual studio的工程项目应用中打开console控制窗口
在visual studio的工程项目应用中打开console控制窗口,这个可以方便我们在console中输出参数的值检查错误. 只需要在需要打开console的地方加入下面的代码即可. AllocC ...
- 用DebuggerDisplay在Visual Studio的调试器中定制类的显示方式
博客搬到了fresky.github.io - Dawei XU,请各位看官挪步.最新的一篇是:用DebuggerDisplay在Visual Studio的调试器中定制类的显示方式.
- 使用visual studio把xsd文件转成xml格式文件
使用visual studio把xsd文件转成xml格式文件 最近一段时间都在做Amazon的mws api的对接工作,mws api的描述文件都是使用的xsd文件来进行的,之前确实也没有接触过,也花 ...
- Visual Studio 生成DLL文件
新建一个项目,在菜单栏中选择“项目”/“**属性”选项,该页面中将“输出类型”下拉列表中的选项选择为“类库”,然后重新生成一下该项目,或者在“Visual Studio 2008命令提示”中输入以下命 ...
- rpm 系 linux 系统中 repo 文件中的 $release 到底等于多少?
rpm 系 linux 系统中 repo 文件中的 $release 到底等于多少? 结论 对于 8 来说,通过以下命令 #/usr/libexec/platform-python -c 'impor ...
- 解决visual studio 2013编译过程中存在的无法打开kernel.lib问题
1. 出现此类问题的原因 由于原visual studio文件中的安装中出现问题,所以原有的SDK(soft development kits)文件出现缺失: 2. 解决方法1 重新下载SDK工具,安 ...
随机推荐
- 创建一个抽象的员工类, 抽象开发累继承员工类,JavaEE ,和安卓继承开发类在测试类中进行测试
/* 1 定义一个员工类 所有的子类都抽取(抽象类) Employee 属性:姓名 工号(生成get set ) 方法:工作 抽象 2 定义一个研 ...
- 公众号对接绑定视频教程<推荐>【申明:来源于网络】
公众号对接绑定视频教程<推荐>[申明:来源于网络] 地址: http://www.456wx.com/bbs/thread-123-1-1.html
- 怎么把mkv转成mp4,有什么方法
Mkv怎样转换成MP4呢?mkv是一种开放标准的自由的容器和文件格式,是一种多媒体封装格式,能够在一个文件中容纳无限数量的视频.音频.图片或字幕轨道.所以其不是一种压缩格式,而是Matroska定义的 ...
- 泡泡一分钟:Cubic Range Error Model for Stereo Vision with Illuminators
Cubic Range Error Model for Stereo Vision with Illuminators 带有照明器的双目视觉的三次范围误差模型 "链接:https://pan ...
- socket 编程中。 服务端用到多线程
客户端连接服务端之后, 服务端会生成与客户端交换信息的socket. 在服务端实现多线程: 为每个连接创建一个线程进行信息交换. import threading from socket import ...
- CentOS 7.6 安装Oracle 12c
下载地址: http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html https://www ...
- 架构4(lvs lb集群解决方案二 lvs+keepalived)
keepalived 1.实现调度器的HA 2.对realserver做健康检测 3.动态维护ipvs路由表
- 图->有向无环图->求关键路径
文字描述 与AOV-网相对应的是AOE-网(Activity on Edge)即边表示活动的网.AOE-网是一个带权的有向无环图.其中,顶点表示事件Event,弧表示活动,权表示活动持续的时间.通常, ...
- python_打包成exe
1. 安装pyinstaller pip install pyinstaller 或通过国内镜像下载(较快): pip install pyinstaller -i http://pypi.douba ...
- 第四章 DOM节点操作
1.什么是DOM:DOM(document object model)文档对象模型,把每一个元素看做是一个节点,然后对节点进行增删改查的操作 2.DOM的分类:(1)Core Dom:可以对html, ...