Tuesday, November 22, 2011 5:22 PM
I'm trying to get the current filename of my open file with my specific extension (.ldx) which I created. I need the filename to send it to my T4 template as a parameter.
I already tried the solution of the following thread but I get an exception:
Is there an other way to get the current filename?
Sunday, November 27, 2011 5:03 PMOwnerAt what point are you calling that method? From the exception, it looks like the file hasn't been loaded yet.
- Alan -MSFT
Monday, November 28, 2011 9:25 AM
If your file has already been loaded. Only two domain models have been loaded. I'm afraid that the CoreDesignSurfaceDomainModel is not in the game.
To load your model, Did you use LoadModel method ? If yes, you cannot use diagrams to get the filename.
And, can you confirm that you host your model in Visual Studio (and not in a third party application as wpf application) ?
Wednesday, December 07, 2011 12:06 PM
Maybe you could try in T4 the ResolvePath method :
- Marked As Answer by DuncanPMicrosoft Employee, Owner Monday, April 16, 2012 4:53 PM