Open olgaark opened 1 year ago
@olgaark I wrote a scratch python script to just re-Id these files. Do run it and see if it helps at all?
[Update]: I just updated the script to take projectIds from top level SLN files and just apply them.
import glob
GLOBAL_ID_DUP = '{997E0757-EA74-4A4E-A0FC-47D8C8831A15}'
def inPlaceReplace(fileName, oldString, newString):
if oldString == newString:
return
contents = None
with open(fileName) as fileRead:
contents = fileRead.read()
if oldString not in contents:
return
with open(fileName, 'w') as fileWrite:
newContents = contents.replace(oldString, newString)
fileWrite.write(newContents)
def reIdConsistentVcx(vcxFileName, newProjectId):
inPlaceReplace(vcxFileName, GLOBAL_ID_DUP, f"{{{newProjectId}}}")
slnFileName = vcxFileName.replace('vcxproj', 'sln')
inPlaceReplace(slnFileName, GLOBAL_ID_DUP, f"{{{newProjectId}}}")
def getVcxIdsInSln(slnFileName):
projectIds = {}
with open(slnFileName) as slnFileRead:
lines = slnFileRead.readlines()
for line in lines:
if not line or not line.startswith('Project("') or not "vcxproj" in line:
pass
else:
lineParts = line.split('"')
projectIdSln, projectName, vcxFileName, projectId = lineParts[1].lstrip('{').rstrip('}'), lineParts[3], lineParts[5], lineParts[7].lstrip('{').rstrip('}')
projectIds[vcxFileName] = projectId
return projectIds
def main():
for slnFileName in glob.glob('CUDA-Samples/*.sln'):
projectIds = getVcxIdsInSln(slnFileName)
for vcxFileName in projectIds:
projectId = projectIds[vcxFileName]
print("File: ", vcxFileName, projectId)
reIdConsistentVcx('CUDA-Samples\\'+vcxFileName, projectId)
if __name__ == '__main__':
main()
On Windows, I put this outside the CUDA-Samples
folder and ran it as: python3 ReId.py
... Then just loaded the sln file (top level and individual ones). Seems to build and run fine.
What seems to have happened is that all individual vcx/sln files have taken the same UUID as Samples\6_Performance\UnifiedMemoryPerf\UnifiedMemoryPerf_*
so this fix should do its job.
If it does solve the IDE issue, do comment, let's ask @rnertney to merge the new vcxproj/sln files in.
The issue was reported to Visual Studio https://developercommunity.visualstudio.com/t/First-opening-of-CUDA-samples-project-ta/10346825
The problem is caused by all vcxproj files having the same
<ProjectGuid>{997E0757-EA74-4A4E-A0FC-47D8C8831A15}</ProjectGuid>
which is used is project ID and supposed to be unique. Please fix your projects.