While I was learning Revit API through SDK samples, I see there is a huge Samples folder with about 180 project files.
I thought it will be good idea to quickly update the references of each project to correct Revit install folder.
There is an executable which does this and is included in SDK samples folder, for some reason it is not working for me.
I created a simple python script, which creates an .User object file having Projects references directed to Revit path.
#This simple app creates .user file corresponding to every .csproj | .vbproj ##With following text #<?xml version="1.0" encoding="utf-8"?> #<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> # <PropertyGroup> # <ReferencePath>D:\Program Files\Autodesk\Revit 2018\</ReferencePath> # </PropertyGroup> #</Project> #Created by moogalm(@galakar), ADN, Autodesk. import os,shutil import xml.etree.ElementTree as ET revitSampleDir = input("Revit SDK Samples Folder, for E.g \"D:\Revit2018\Samples\" :")#"D:\\Revit 2018 SDK\\Samples" userFile = revitSampleDir+"\\user.txt"#"D:\\Revit 2018 SDK\\Samples\\user.txt" revitInstallDir = input("Revit Install Folder :")#"D:\\Program Files\\Autodesk\\Revit 2018\\" project = ET.Element("Project",ToolsVersion="14.0",xmlns="http://schemas.microsoft.com/developer/msbuild/2003") propertyGroup = ET.SubElement(project,"PropertyGroup") referencePath = ET.SubElement(propertyGroup,"ReferencePath").text = revitInstallDir tree = ET.ElementTree(project) tree.write(userFile, encoding='utf-8',xml_declaration=True,method= 'xml') for root, dirs, files in os.walk(revitSampleDir): for filename in files: if filename.endswith(('.csproj', '.vbproj')): shutil.copy(userFile,os.path.join(root,filename +".user")) print(os.path.join(root,filename +".user"))