1

I'm currently struggling with a issue I'm having with a custom defined project property, which is supposed to be imported from an external build target file.

The property is defined as such in the imported file:

<Project>
  <!-- ... --> 
  <PropertyGroup>
    <!-- ... --> 
    <MyCustomPath>$(MyOtherCustomPath)\MyRelativePath</MyCustomPath>
    <!-- ... --> 
  </PropertyGroup>
  <!-- ... --> 
</Project>

Appearantly though, what I'm trying to do with this variable doesn't seem to be working. Leading me to guess that for some reason the property isn't loaded with the project as it should.

So I would like to be able, from Visual Studio, to check on this property's current value to make sure it is set correctly.

Isn't there a way I can get the list of a given project's properties and their in-memory values?

Crono
  • 10,211
  • 6
  • 43
  • 75
  • Not sure doing this 'from Visual Studio' is the best idea as that might not be the same as what you really want to know, namely what happens *during a build*. And for the latter there are multiple solutions posted on SO already. Simple one: add a target with a Message task to print just properties of interest (basically MyCustomPath and MyOtherCustomPath in this case). More advanced: write a task to do it for you http://stackoverflow.com/a/2773086/128384 – stijn Jul 22 '15 at 16:43
  • @stjin I don't need to know what the values are when the project is built, I want to know what they are when the project is *loaded*. Here's an example: you are using a T4 template and use a project property as part of an include path. Somehow VS knows what this value happens to be *without* building anything. I want to be able to see what VS sees at this point. – Crono Jul 22 '15 at 16:47
  • In that case: afaik VS uses Project and other classes from the Microsoft.Build.Evaluation namespace. So if no suitable answer comes up you could write an extension using them. I don't know anything about T4 templates, but for C++ and C# projects for example, you can get a list with a lot (all?) properties+values, including custom ones, when editing values in the project properties (click the 'Macros>>') button. Maybe you have something similar? – stijn Jul 22 '15 at 16:58
  • @stijn Yeah that namespace came up a few times when I was googling. I just hoped there would already be a tool for such a trivial task and that I wouldn't have to make one myself. :s – Crono Jul 22 '15 at 17:27
  • 2
    http://www.msbuildexplorer.com/. – Tom Blodget Jul 22 '15 at 23:57
  • @TomBlodget Thanks, this seems to do exactly what I want (and more!). If you add this as an answer I'll gladly accept it. – Crono Jul 23 '15 at 11:46
  • Glad to help but actually, I voted to close this questions because [questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic](http://stackoverflow.com/help/on-topic). – Tom Blodget Jul 23 '15 at 11:50
  • I did add it to the [tag wiki](http://stackoverflow.com/tags/msbuild/info), though. (It could be still pending approval.) – Tom Blodget Jul 23 '15 at 11:57
  • @TomBlodget To be pedantic, I *didn't* specifically asked for a tool recommendation; I wanted to know if *Visual Studio* could allow me to do what I wanted to do - maybe in one of these obscure tool window almost nobody uses. So technically, the question in itself does fit SO's guidelines IMHO. :) – Crono Jul 23 '15 at 12:40

0 Answers0