1、vs15:记得在vs15配置opencv时候,按照毛星云的书籍《OpenCV3 编程入门》,通过配置
Microsoft.Cpp.x64.user.props,可以一次性永久配置OpenCV,不需要每次都配置。
2、vs19: 但在VS19的C:\Users\[Username]\AppData\Local\Microsoft 路径下中似乎没能找到MSBuild文件夹(该路径被隐藏了,需要在电脑端去隐藏)和在vs19的工程项目的属性管理器中都没能找到Microsoft.Cpp.x64.user.props。通过查找网上资料,部分人通过两种方法来加装MSBuild文件夹以达到永久配置OpenCVm目的:
1)先安装VS17后,再卸载,在C:\Users\[Username]\AppData\Local\Microsoft下文件路径下即可发现\MSBuild文件夹。
2)直接重从其他人已安装处,拷贝MSBuild文件夹放在自己电脑的该路径下。
vs19版本已经废除了MSBuild文件夹中的Microsoft.Cpp.x64.user.props
通过进一步查证,废了老大劲发现在该博主(https://www.it1352.com/1221770.html)中提到,VS19已经废除了MSBuild文件夹中的Microsoft.Cpp.x64.user.props,所以在配置opencv可以不用考虑上面方法1和2方式。但我没能在Microsoft官网的文档中找到进一步确认,所以放在这里有待大家考证。有找到可以在评论告诉我。
Up to and including Visual Studio 2017, we had been setting the default for all projects to /W3 /WX to override the installed defaults of /W1 /WX-. This had been done by use of the user props file typically found at:
C:\Users\[Username]\AppData\Local\Microsoft\MSBuild\v4.0\Microsoft.Cpp.x64.user.props
As noted here: https://docs.microsoft.com/en-us/cpp/build/create-reusable-property-configurations?view=vs-2019 this file has been deprecated in VS 2019, and with good reasons.
What mechanism exists to replace the .user.props file, preferably with something that will be system wide and can be installed as part of the rollout of Visual Studio on a new computer. The intention here is to be able to do this once so that it's "set and forget" and it'll work for all projects retrieved from the corporate git server, as well as any projects that might be created by the user.
Having a .props file we have to manually insert into every project is not an option, there are simply too many projects involved for that to be viable. It must have the same "automatic use" semantics as the .user.props file: install on the machine, and it starts working immediately, with no changes to the project file.