none
Files included in an Assembly RRS feed

  • Question

  • Hi Friends,

    The outline of my problem is "I want to know individual versions of the of the files constituting the assembly from the dll file. This version is VSS version".
    Note: Individual files are having version numbers as first line comment using Keyword expension feature of VSS.

    Now my queries are:
    a. Looking at the assembly file, can I find out individual code files (not classes)
    b. Can find out first line in the comment from this file which is version number of the file.
    c. Is there any programming interface exposed in CLR programming for directly using Keyword Expension feature of VSS to find out the version of file?

    d. Do I need to make changes in build process for this?

    Waiting for your valuable comments.

    -P
     
        
    Thursday, December 25, 2008 1:30 PM

Answers

  • Let me make sure I understand - you want to get the source-control verison of all the source files used to build an assembly?  I'm not familiar with VSS, but there are a few different ways you might be able to do this.  

    First, are you willing to take a dependency on having access to the matching PDB file for the assembly (perhaps through a symbol server)?  This is how projects like Microsoft's Reference Source Code Center work.  Post-build source control verison information is added to the PDB file, and then at debug time a source server is used to get the exact source referenced by the PDB.

    If you don't want to depend on having the PDB available, then you'll probably want to embed the information you want as custom attributes in the assemblies.  Eg., you could put an assembly-level custom attribute in earch source file that includes the source file name and version number (obtained by a keyword expansion from VSS).  For example, define a SourceInfo attribute (that can be specified multiple times on an assembly) and then start earch source file with "[SourceInfo(FileName="$WorkFile: $", Version="$Revision: $")]" (note, I don't know much about VSS - just guessing here).  Then you could use reflection on the assembly to pull it out.

    Hope this helps,
       Rick
    • Proposed as answer by Rick Byers Friday, December 26, 2008 11:40 PM
    • Marked as answer by Pankaj Monga Saturday, January 10, 2009 6:10 AM
    Thursday, December 25, 2008 10:28 PM
  • In addition to that tutorial above on using custom attributes, you'll also want to read about creating your own attribute types.  This MSDN documentation is pretty good: http://msdn.microsoft.com/en-us/library/84c42s56(VS.71).aspx.  You can also find lots more on-line by searching for "defining .NET custom attributes".  Jeff Richter's CLR via C# is also a great book for learning about core .NET concepts like custom attributes.

    Rick
    • Proposed as answer by Rick Byers Friday, December 26, 2008 11:42 PM
    • Marked as answer by Zhi-Xin Ye Tuesday, December 30, 2008 11:19 AM
    Friday, December 26, 2008 11:42 PM

All replies

  • Let me make sure I understand - you want to get the source-control verison of all the source files used to build an assembly?  I'm not familiar with VSS, but there are a few different ways you might be able to do this.  

    First, are you willing to take a dependency on having access to the matching PDB file for the assembly (perhaps through a symbol server)?  This is how projects like Microsoft's Reference Source Code Center work.  Post-build source control verison information is added to the PDB file, and then at debug time a source server is used to get the exact source referenced by the PDB.

    If you don't want to depend on having the PDB available, then you'll probably want to embed the information you want as custom attributes in the assemblies.  Eg., you could put an assembly-level custom attribute in earch source file that includes the source file name and version number (obtained by a keyword expansion from VSS).  For example, define a SourceInfo attribute (that can be specified multiple times on an assembly) and then start earch source file with "[SourceInfo(FileName="$WorkFile: $", Version="$Revision: $")]" (note, I don't know much about VSS - just guessing here).  Then you could use reflection on the assembly to pull it out.

    Hope this helps,
       Rick
    • Proposed as answer by Rick Byers Friday, December 26, 2008 11:40 PM
    • Marked as answer by Pankaj Monga Saturday, January 10, 2009 6:10 AM
    Thursday, December 25, 2008 10:28 PM
  • Hello Rick, Thank you for the reply. You have got the problem right. To further help me out, Could you suggest me where I can read more about this
    "you could put an assembly-level custom attribute in earch source file that includes the source file name and version number"

    I am new to .Net Programming and dont know how to implement this. If you can suggest some article on web, it would be great.

    Thanks for the help

    -P
    Friday, December 26, 2008 4:57 AM
  • Attributes are elements that allow you to add declarative information to your programs

    Hope this helps,

     http://www.csharp-station.com/Tutorials/Lesson16.aspx

    ---Don't forget to make it answer if it solves the problem
    • Proposed as answer by Rick Byers Friday, December 26, 2008 11:42 PM
    Friday, December 26, 2008 11:25 AM
  • In addition to that tutorial above on using custom attributes, you'll also want to read about creating your own attribute types.  This MSDN documentation is pretty good: http://msdn.microsoft.com/en-us/library/84c42s56(VS.71).aspx.  You can also find lots more on-line by searching for "defining .NET custom attributes".  Jeff Richter's CLR via C# is also a great book for learning about core .NET concepts like custom attributes.

    Rick
    • Proposed as answer by Rick Byers Friday, December 26, 2008 11:42 PM
    • Marked as answer by Zhi-Xin Ye Tuesday, December 30, 2008 11:19 AM
    Friday, December 26, 2008 11:42 PM