Accessing driver version

While moving to VS 2012 with Win8 kit , ability to specify the driver version in inf file through stampinf exists in the project properties. I need to access this version in the driver code. Else I need to change the version at two places which can easily get out of sync. I defined the version in the preprocessor but is not used by the stampinf.

Is there a way to maintain the version at a single place accessbile by both.

Set STAMPINF_VERSION to your required version number before building your
project. The stampinf processing in your VS project will pick this up and
use it in your inf file. There is likely some way to script this into the
mess known as msbuild, I have no idea how one would do that.

So I have a build system that starts out as a batch file that sets up
global environment variable settings and then invokes a makefile that in
turn either runs legacy WDK builds for pre-win8 targets or VS2012 WDK
builds for win8 targets. The setup includes making sure that everyone is
using the same version number.

Mark Roddy

On Mon, Feb 25, 2013 at 10:30 AM, wrote:

> While moving to VS 2012 with Win8 kit , ability to specify the driver
> version in inf file through stampinf exists in the project properties. I
> need to access this version in the driver code. Else I need to change the
> version at two places which can easily get out of sync. I defined the
> version in the preprocessor but is not used by the stampinf.
>
> Is there a way to maintain the version at a single place accessbile by
> both.
>
> —
> NTDEV is sponsored by OSR
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

On 25/02/2013 18:19, Mark Roddy wrote:

Set STAMPINF_VERSION to your required version number before building
your project. The stampinf processing in your VS project will pick
this up and use it in your inf file. There is likely some way to
script this into the mess known as msbuild, I have no idea how one
would do that.

To do this in MSBuild, you could probably put the following in the
PropertyGroup section near the top of the driver .vcxproj file:

1.0.0.0

Then refer to it in within the project using $(DriverVersion).


Bruce Cran

To be clear, I meant have the msbuild mess fetch the current version from
some external (and common) source. Hard coding the version isn’t the right
answer.

Mark Roddy

On Mon, Feb 25, 2013 at 1:33 PM, Bruce Cran wrote:

> On 25/02/2013 18:19, Mark Roddy wrote:
>
>> Set STAMPINF_VERSION to your required version number before building your
>> project. The stampinf processing in your VS project will pick this up and
>> use it in your inf file. There is likely some way to script this into the
>> mess known as msbuild, I have no idea how one would do that.
>>
>
> To do this in MSBuild, you could probably put the following in the
> PropertyGroup section near the top of the driver .vcxproj file:
>
> 1.0.0.0
>
> Then refer to it in within the project using $(DriverVersion).
>
>
> –
> Bruce Cran
>
>
> —
> NTDEV is sponsored by OSR
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.**cfm?name=ListServerhttp:
></http:>

Since $(DriverVersion) is a property, you can specify it on the command line

Msbuild /p:DriverVersion=“foo.bar.zing.zab”

Without hard coding

d

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Mark Roddy
Sent: Monday, February 25, 2013 11:17 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Accessing driver version

To be clear, I meant have the msbuild mess fetch the current version from some external (and common) source. Hard coding the version isn’t the right answer.

Mark Roddy

On Mon, Feb 25, 2013 at 1:33 PM, Bruce Cran > wrote:
On 25/02/2013 18:19, Mark Roddy wrote:
Set STAMPINF_VERSION to your required version number before building your project. The stampinf processing in your VS project will pick this up and use it in your inf file. There is likely some way to script this into the mess known as msbuild, I have no idea how one would do that.

To do this in MSBuild, you could probably put the following in the PropertyGroup section near the top of the driver .vcxproj file:

1.0.0.0

Then refer to it in within the project using $(DriverVersion).


Bruce Cran


NTDEV is sponsored by OSR

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit: http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

— NTDEV is sponsored by OSR OSR is HIRING!! See http://www.osr.com/careers For our schedule of WDF, WDM, debugging and other seminars visit: http://www.osr.com/seminars To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

On 25/02/2013 19:22, Doron Holan wrote:

Since $(DriverVersion) is a property, you can specify it on the
command line

Msbuild /p:DriverVersion=“foo.bar.zing.zab”

Without hard coding

But, you’d probably want to leave a default hard-coded to allow you to
build through Visual Studio.


Bruce

yes sure, but that is not much different than what I am already doing.
Setting it on the command line or setting an environment variable both
require an external wrapper to do the setting. Ideally the build would pick
up the version number from, for example, a generated file. So far I haven’t
found a way to do that from within msbuild, although I am sure it is
possible.

I’m actually fine with what I am currently doing. The version number only
has to be consistent when doing ‘public’ builds (for some value of public)
and that is done quite will using the mechanism I sketched out originally.
It would be ideal if random developers were also guaranteed to get
something consistent if they just open a solution in VS and hit the build
button, but I can live without it. For legacy DDK builds this is trivial to
do, but my msbuild foo is weak :slight_smile:

Mark Roddy

On Mon, Feb 25, 2013 at 2:22 PM, Doron Holan wrote:

> Since $(DriverVersion) is a property, you can specify it on the command
> line
>
>

>
> Msbuild /p:DriverVersion=?foo.bar.zing.zab?

>
> ****
>
> Without hard coding
>
>

>
> d

>
> ****
>
> From: xxxxx@lists.osr.com [mailto:
> xxxxx@lists.osr.com] On Behalf Of Mark Roddy
> Sent: Monday, February 25, 2013 11:17 AM
> To: Windows System Software Devs Interest List
> Subject: Re: [ntdev] Accessing driver version
>
>
**
>
> To be clear, I meant have the msbuild mess fetch the current version from
> some external (and common) source. Hard coding the version isn’t the right
> answer.

>
>
>
>
> Mark Roddy

>
> ****
>
> On Mon, Feb 25, 2013 at 1:33 PM, Bruce Cran wrote:
>
> On 25/02/2013 18:19, Mark Roddy wrote:

>
> Set STAMPINF_VERSION to your required version number before building your
> project. The stampinf processing in your VS project will pick this up and
> use it in your inf file. There is likely some way to script this into the
> mess known as msbuild, I have no idea how one would do that.
>
>

>
> To do this in MSBuild, you could probably put the following in the
> PropertyGroup section near the top of the driver .vcxproj file:
>
> 1.0.0.0
>
> Then refer to it in within the project using $(DriverVersion).
>
>
> –
> Bruce Cran

>
>
>
> —
> NTDEV is sponsored by OSR
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
>

>
> — NTDEV is sponsored by OSR OSR is HIRING!! See
> http://www.osr.com/careers For our schedule of WDF, WDM, debugging and
> other seminars visit: http://www.osr.com/seminars To unsubscribe, visit
> the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer

>
> —
> NTDEV is sponsored by OSR
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

On 25/02/2013 20:28, Mark Roddy wrote:

yes sure, but that is not much different than what I am already doing.
Setting it on the command line or setting an environment variable both
require an external wrapper to do the setting. Ideally the build would
pick up the version number from, for example, a generated file. So far
I haven’t found a way to do that from within msbuild, although I am
sure it is possible.

Assuming version.txt contains a single line with the version:




Bruce Cran

We need the Global Build Number Server for that to work. Register your project by GUID, then query the build number server from an Exec task in your build stream each time you build.

Somebody could be rich implementing that idea.

Peter
OSR

On 25-Feb-2013 17:30, xxxxx@intel.com wrote:

While moving to VS 2012 with Win8 kit , ability to specify the driver version in inf file through stampinf exists in the project properties. I need to access this version in the driver code. Else I need to change the version at two places which can easily get out of sync. I defined the version in the preprocessor but is not used by the stampinf.

Is there a way to maintain the version at a single place accessbile by both.

DriverVersion is a registry property so the driver can get it in
runtime, like other properties.

– pa

xxxxx@osr.com wrote:

We need the Global Build Number Server for that to work. Register your project by GUID, then query the build number server from an Exec task in your build stream each time you build.

Somebody could be rich implementing that idea.

Ironically, Visual Studio has had this feature for a very long time, but
only for .NET projects. It’s the AssemblyVersion property.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

On 26/02/2013 17:26, Tim Roberts wrote:

Ironically, Visual Studio has had this feature for a very long time,
but only for .NET projects. It’s the AssemblyVersion property.

It looks like you can do something similar with TfsVersion task from the
MSBuild Extension Pack, selecting whether to get a version based on a
number of days or a datetime format.


Bruce Cran


Aaaah! TFS = Team Foundation Server. I always wondered what that was. Seriously.

I looked it up and it seems it’s got its own Application Lifecycle Management model, which is all about Agile. Which, as you all might guess, got me very excited right away. Because I’m such a massive and enthusiastic fan of Agile Development.

Does TFS really have its own source control system and everything? Yikes… who knew?

Peter
OSR

xxxxx@osr.com wrote:


> I looked it up and it seems it’s got its own Application Lifecycle Management model, which is all about Agile. Which, as you all might guess, got me very excited right away. Because I’m such a massive and enthusiastic fan of Agile Development.
>

I honestly couldn’t tell whether that packet had the “sarcasm” bit set
or not.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.