Kinook Software Forums

Kinook Software Forums (
-   [VBP] Third Party Tools (
-   -   Get Assembly version\OutputType from a csproj file (

teognost 08-27-2007 01:27 PM

Get AssemblyName\OutputType from a csproj file
I need to get from a csproj file the assembly version and output type.
The file looks like this:

2.0 AutoTrader.BICManagement


I tried to read it as an xml,having a 'Set Macro' step for CURRENT_ASSEMBLY_NAME:
but nothing is set...
However I noticed if the csproj doesn't contain the part
xmlns=""-it is read correctly.
But this does not help me ,I need to read the csproj file as it is ,with
part inside.
Any idea how can I do it?

kinook 08-27-2007 02:01 PM

1 Attachment(s)
The assembly version is stored in the AssemblyInfo.cs file and can be retrieved via the VS.NET Get Version action. The attached sample demonstrates that and retrieving the OutputType from the .csproj file.

teognost 08-28-2007 04:42 AM

Sorry,my mistake,I mean AssemblyName instead of assembly version,i just corrected the title.Thanks for the sample...

teognost 09-07-2007 01:44 PM

Now I have a similar issue when trying to retrieve OutputFile from a vcproj file,did not succed to get the info.
File looks like :

Name="Unicode Release|Win32"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.v sprops"
AdditionalDependencies="odbc32.lib odbccp32.lib ws2_32.lib"


I need to extract the value written in

and problem is in some cases first line in vcproj file could look like

so I need a search method being able to extract the OutputFile no matter which of these 2 types first line would be...

kinook 09-07-2007 03:23 PM

1 Attachment(s)
The XML parser should handle either encoding properly. The attached sample worked in my tests.

teognost 09-10-2007 12:53 PM

Thanks,it works indeed .But if I want to search for the OutputFile written in first configuration containing word 'Release'-how can I do it?

Basically in your sample was:

and I tried these 2 types of syntaxes but did not work;

%READ_XML(%XML_FILE%,/VisualStudioProject/Configurations/Configuration[@Name contains(.,'Release')]/Tool[@Name='VCLinkerTool']/@OutputFile)%

kinook 09-10-2007 01:24 PM

1 Attachment(s)
The READ_XML macro doesn't support parameter values containing commas; use a Run Script action instead (see attached sample--requires VBP v6.5).

teognost 09-11-2007 03:14 AM

Thanks,I adapted your script for VBP 6.3:

Set cof = vbld_AllMacros()("CURRENT_OUTPUT_FILE")

' load the XML file
Set msxml = CreateObject("MSXML2.DOMDocument.6.0")
msxml.async = False

Set node=msxml.selectSingleNode("/VisualStudioProject/Configurations/Configuration[contains(@Name, 'Release')]/Tool[@Name='VCLinkerTool']/@OutputFile")

teognost 09-11-2007 08:03 AM

Well,problem is the step fails when the xml file does not contain the related path.I need in such a case to set cof.Value to an empty string.
I tried to test the node object with IsNull,IsObject but the result is always positive,even if the object was not set due to not existent XPath.
So how can be tested the node object in order to avoid the step failure?

kinook 09-11-2007 08:26 AM

If Not node Is Nothing Then ...

teognost 06-09-2008 10:42 AM

Hi,I am trying to execute the sample you attached ( on another box where OS is Win2003 (my box has WinXp installed).
Problem is in this case the step 'Log properties' fails:
Error expanding macros or script in property Message: Output type = Any idea why?


Originally posted by kinook
The assembly version is stored in the AssemblyInfo.cs file and can be retrieved via the VS.NET Get Version action. The attached sample demonstrates that and retrieving the OutputType from the .csproj file.

kinook 06-09-2008 01:53 PM

Maybe it doesn't have a recent version of MSXML installed. Try installing the latest MSXML 6.0 release.

teognost 06-10-2008 04:47 AM

tried both,it says I have a higher version already installed...

kinook 06-10-2008 07:06 AM

I'm not sure then. I tried it on Windows 2003 SP2 before and after installing MSXML 6.0 and 6.0 SP1, and it worked in all cases.

teognost 06-10-2008 11:22 AM

I tried again and again to understand what is wrong on that box-still no clue :-(
In the step:
Output type = %READ_XML(%XML_FILE%,/msbuild:Project/msbuild:PropertyGroup/msbuild:OutputType, ,xmlns:msbuild='')%

what represents msbuild ?

kinook 06-10-2008 01:26 PM

The alias for the namespace.

teognost 06-11-2008 04:40 AM

Well,finally I solved it.
I noticed on my box I have VBP 6.7 and on W2003 is VBP 6.2,installed 6.7 and it is ok now!!

All times are GMT -5. The time now is 03:14 PM.

Copyright 1999-2019 Kinook Software, Inc.