After even more digging on a customers computer, I tried to reinstall Revit hoping to solve the problem.
It did the trick, so it seems like @Revitalizer was totaly correct in pointing out that the path wasn't correct
written to registry.
The problem, visually, was that the path was written to the registry but maybe there were someting wrong with the part that got the path through the installed Revit products.
The customer I tried this things on, had installed versjon: 21.1.1.109, installed through the web installer on 02.09.20.
When reinstalling he got 21.1.11.27 installed, using the webistaller on 07.10.2020
The issue seems to be solved in the installer, but there might be other cases like this, so it might be usefull to post something about it , @jeremytammik ?
I use this code to get the product;
public static RevitProduct FindRevitProduct(Guid productCode)
{
string substring = productCode.ToString().Substring(0, 18);
List<RevitProduct> prods =
RevitProductUtility.GetAllInstalledRevitProducts();
if (prods == null || prods.Count <= 0) return null;
return (from prod in prods let substringThisProd =
prod.ProductCode.ToString().Substring(0, 18) where substring ==
substringThisProd select prod).FirstOrDefault();
}
this returns the Revit2021 product, as excpected.
Then I aske the returned RevitProduct about it's Installpath:
var installPath = OneRevitProduct.InstallLocation;
//the result of this call is:
"/Revit 2021"
This produces the result as shown, wich is not the excpected path, and causes my problems.
-Daniel