Get the filename of my current file with my specific extension
-
Tuesday, November 22, 2011 5:22 PM
Hey
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:
- http://social.msdn.microsoft.com/Forums/en-MY/dslvsarchx/thread/83e86a13-e9b4-4e15-bac2-4ae9c6b2ba35Is there an other way to get the current filename?
schoggibob
Exception:
All Replies
-
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) ?
Pascal
blog.mexedge.com -
Wednesday, December 07, 2011 12:06 PM
Hi,
Maybe you could try in T4 the ResolvePath method :
Regards,
Alex.- Marked As Answer by DuncanPMicrosoft Employee, Owner Monday, April 16, 2012 4:53 PM

