Visual studio 2015 with WDK 10 Post build issue

I am having a Visual studio 2015 with WDK 8.1 , I am running a *post build*
operation which involved the .cat file generated by inf2cat.

When using WDK8.1 everything works perfectly fine. however when changing on
the same project to Platform Toolset : *WindowsKernelModeDriver10.0* build
failed.

The reason it failed is because it seems to run the post build operation
before running inf2cat, while on WDK 8.1 it runs after.

I have created a brand new project, and could easily reproduce it with a
new 2015 WINUSB package project type.

I am using Visual studio 2015 Update 1. Anyone experienced the same issue ?
any solution for this ?

Thanks,
Elad

How are you specifying the post build task? In msbuild declaring a dependency on a target ?

Sent from my Windows 10 phone

From: Elad Zuckermailto:xxxxx
Sent: Friday, February 5, 2016 12:42 PM
To: Windows System Software Devs Interest Listmailto:xxxxx
Subject: [ntdev] Visual studio 2015 with WDK 10 Post build issue

I am having a Visual studio 2015 with WDK 8.1 , I am running a post build operation which involved the .cat file generated by inf2cat.

When using WDK8.1 everything works perfectly fine. however when changing on the same project to Platform Toolset : WindowsKernelModeDriver10.0 build failed.

The reason it failed is because it seems to run the post build operation before running inf2cat, while on WDK 8.1 it runs after.

I have created a brand new project, and could easily reproduce it with a new 2015 WINUSB package project type.

I am using Visual studio 2015 Update 1. Anyone experienced the same issue ? any solution for this ?

Thanks,
Elad

— NTDEV is sponsored by OSR Visit the list online at: MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers! Details at To unsubscribe, visit the List Server section of OSR Online at</mailto:xxxxx></mailto:xxxxx>

Not quite sure what you mean.

I am going to project properties -> Build Events -> Post-Build Event. I am
setting a command line which takes the cat file send it over to be signed
by a third party tool. (Using a batch file)
This is all done by a native VC2015 project.

WDK8.1 : works perfectly for few years. Also on VC2015.
WDK10 : calling my post build before .cat file generated. If I am removing
my post-build, build the project I see the .cat file generated. adding the
post-build event and it works because .cat file exists in its location. but
after Clean and rebuild I get the same issue once again.

On Fri, Feb 5, 2016 at 11:10 PM, Doron Holan
wrote:

> How are you specifying the post build task? In msbuild declaring a
> dependency on a target ?
>
>
>
> Sent from my Windows 10 phone
>
>
>
> *From: *Elad Zucker
> *Sent: *Friday, February 5, 2016 12:42 PM
> *To: *Windows System Software Devs Interest List
> *Subject: *[ntdev] Visual studio 2015 with WDK 10 Post build issue
>
>
> I am having a Visual studio 2015 with WDK 8.1 , I am running a post
> build
operation which involved the .cat file generated by inf2cat.
>
> When using WDK8.1 everything works perfectly fine. however when changing
> on the same project to Platform Toolset : WindowsKernelModeDriver10.0
> build failed.
>
> The reason it failed is because it seems to run the post build operation
> before running inf2cat, while on WDK 8.1 it runs after.
>
> I have created a brand new project, and could easily reproduce it with a
> new 2015 WINUSB package project type.
>
> I am using Visual studio 2015 Update 1. Anyone experienced the same issue
> ? any solution for this ?
>
> Thanks,
> Elad
>
>
> — NTDEV is sponsored by OSR Visit the list online at: MONTHLY seminars
> on crash dump analysis, WDF, Windows internals and software drivers!
> Details at To unsubscribe, visit the List Server section of OSR Online at
>

Nobody with any insight about this ? I really surprised no one have seen
this. I am reproducing it with no problem…
Just creating a WIndows KErnel driver project with WDK 10 platform , on
Post build just try to access the .cat file which should be already
generated and see it isn’t there. Changing to WDK 8.1, and it is working
correctly … (All in VC 2015).

On Fri, Feb 5, 2016 at 11:46 PM, Elad Zucker wrote:

> Not quite sure what you mean.
>
> I am going to project properties -> Build Events -> Post-Build Event. I am
> setting a command line which takes the cat file send it over to be signed
> by a third party tool. (Using a batch file)
> This is all done by a native VC2015 project.
>
> WDK8.1 : works perfectly for few years. Also on VC2015.
> WDK10 : calling my post build before .cat file generated. If I am removing
> my post-build, build the project I see the .cat file generated. adding the
> post-build event and it works because .cat file exists in its location. but
> after Clean and rebuild I get the same issue once again.
>
>
> On Fri, Feb 5, 2016 at 11:10 PM, Doron Holan
> wrote:
>
>> How are you specifying the post build task? In msbuild declaring a
>> dependency on a target ?
>>
>>
>>
>> Sent from my Windows 10 phone
>>
>>
>>
>> *From: *Elad Zucker
>> *Sent: *Friday, February 5, 2016 12:42 PM
>> *To: *Windows System Software Devs Interest List
>> *Subject: *[ntdev] Visual studio 2015 with WDK 10 Post build issue
>>
>>
>> I am having a Visual studio 2015 with WDK 8.1 , I am running a post
>> build
operation which involved the .cat file generated by inf2cat.
>>
>> When using WDK8.1 everything works perfectly fine. however when changing
>> on the same project to Platform Toolset : WindowsKernelModeDriver10.0
>> build failed.
>>
>> The reason it failed is because it seems to run the post build operation
>> before running inf2cat, while on WDK 8.1 it runs after.
>>
>> I have created a brand new project, and could easily reproduce it with a
>> new 2015 WINUSB package project type.
>>
>> I am using Visual studio 2015 Update 1. Anyone experienced the same issue
>> ? any solution for this ?
>>
>> Thanks,
>> Elad
>>
>>
>> — NTDEV is sponsored by OSR Visit the list online at: MONTHLY seminars
>> on crash dump analysis, WDF, Windows internals and software drivers!
>> Details at To unsubscribe, visit the List Server section of OSR Online at
>>
>
>

I bet there are few people who are using custom post-build procedures and running within VS2015.

That certainly describes why *I* can’t help: No custom post-build procedures here.

Peter
OSR
@OSRDrivers

I believe custom post-build have a high usage for signing. On big corps, it
impossible to use the built-in signing feature because you have no access
to a physical machine with an installed certificate. mostly you have to use
a third party for this.I personally have seen custom post-build for VS
based drivers all over.

regards the problem : I figured the issue is only when generating a Driver
Package. This does not reproduced on KMDF. It is only reproduced on
Configuration Type Utility.

I have create a clean Driver Package . I have add in post build the
following :
*…\test.bat “$(Inf2CatSource)*.cat”*

this is test.bat :
*echo off*
*echo %1*
*if exist %1 (*
*echo file %1 Exist.*
*) else (*
* echo file %1 Does not exist !*

Here is the output of a clean build :
1>------ Rebuild All started: Project: Driver Package1, Configuration:
Debug Win32 ------
1> Building ‘Driver Package1’ with* toolset ‘WindowsKernelModeDriver10.0*’
and the ‘Desktop’ target platform.
1> Stamping Debug\MyDriver.inf [Version] section with
DriverVer=02/08/2016,19.53.36.666

*1> "c:\project\test1\Driver Package1\Debug\Driver Package1\.cat"*
*1> file “c:\project\test1\Driver Package1\Debug\Driver Package1*.cat”
Does not exist !*
1>C:\Program Files (x86)\Windows
Kits\10\build\WindowsDriver.common.targets(1615,5): warning : The driver
package project c:\project\test1\Driver Package1\Driver Package1\Driver
Package1.vcxproj doesn’t have any references to other projects and no
projects were packaged.
1>C:\Program Files (x86)\Windows
Kits\10\build\WindowsDriver.common.targets(1615,5): warning :
1> …
1> Signability test complete.
1>
1> Errors:
1> None
1>
1> Warnings:
1> None
1>
*1> Catalog generation complete.*
*1> c:\project\test1\Driver Package1\Debug\Driver Package1\mydriver.cat
http:

1> Done Adding Additional Store
1> Successfully signed: c:\project\test1\Driver Package1\Debug\Driver
Package1\mydriver.cat
1>
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========

running for the second time when the .cat file is generated :

1>------ Build started: Project: Driver Package1, Configuration: Debug
Win32 ------
1> Building ‘Driver Package1’ with toolset ‘WindowsKernelModeDriver10.0’
and the ‘Desktop’ target platform.
1> Stamping Debug\MyDriver.inf [Version] section with
DriverVer=02/08/2016,20.16.30.899
1> …\test.bat
1> “c:\project\test1\Driver Package1\Debug\Driver Package1\*.cat”
1> file “c:\project\test1\Driver Package1\Debug\Driver Package1*.cat”
Exist.

1>C:\Program Files (x86)\Windows
Kits\10\build\WindowsDriver.common.targets(1615,5): warning : The driver
package project c:\project\test1\Driver Package1\Driver Package1\Driver
Package1.vcxproj doesn’t have any references to other projects and no
projects were packaged.
1>C:\Program Files (x86)\Windows
Kits\10\build\WindowsDriver.common.targets(1615,5): warning :
1> …
1> Signability test complete.
1>
1> Errors:
1> None
1>
1> Warnings:
1> None
1>
1> Catalog generation complete.
1> c:\project\test1\Driver Package1\Debug\Driver Package1\mydriver.cat
1> Done Adding Additional Store
1> Successfully signed: c:\project\test1\Driver Package1\Debug\Driver
Package1\mydriver.cat
1>
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

This is not the case when using the 8.1 tool-set.

No question a bug in the tool set… but how can I overcome this ?

Thanks,
Elad

On Mon, Feb 8, 2016 at 7:36 PM, wrote:

> I bet there are few people who are using custom post-build procedures and
> running within VS2015.
>
> That certainly describes why I can’t help: No custom post-build
> procedures here.
>
> Peter
> OSR
> @OSRDrivers
>
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list online at: <
> http://www.osronline.com/showlists.cfm?list=ntdev&gt;
>
> MONTHLY seminars on crash dump analysis, WDF, Windows internals and
> software drivers!
> Details at http:
>
> To unsubscribe, visit the List Server section of OSR Online at <
> http://www.osronline.com/page.cfm?name=ListServer&gt;
></http:></http:>

From what you describe it looks like your post-build runs away asynchronously and the main process does not wait for it. Try to disable multiprocessor build as a quick test.
– pa

Nope. It is not a multiprocessor issue. I have placed a sleep of 5 seconds
when entering the batch file. the .cat file is generated right after the
post build complete.

On Mon, Feb 8, 2016 at 8:45 PM, wrote:

> From what you describe it looks like your post-build runs away
> asynchronously and the main process does not wait for it. Try to disable
> multiprocessor build as a quick test.
> – pa
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list online at: <
> http://www.osronline.com/showlists.cfm?list=ntdev&gt;
>
> MONTHLY seminars on crash dump analysis, WDF, Windows internals and
> software drivers!
> Details at http:
>
> To unsubscribe, visit the List Server section of OSR Online at <
> http://www.osronline.com/page.cfm?name=ListServer&gt;
></http:>

There has been several changes to the way Package projects are handled in WDK 10. Driver packages are now created by default for every driver project. You could add the post build step to the driver project itself [“ConfigurationType=Driver”]. This would be easy in case of one/few package project per driver.

Looks like the custom PostBuild step you added is running before the Inf2Cat target in case of “ConfigurationType=Utility”. I am looking at this issue and trying to understand it. Will get back with my findings and possible workarounds.

Thanks,
Ajay

Thank you Ajay,

My package is a winUSB package so I have no sys file generated. so I cant
do what you suggested.

My only option is creating an empty project which will be depended on my
packge project and on its post build I’ll do my third party signing

Thanks,
Elad.

On Tue, Feb 9, 2016 at 9:12 PM, wrote:

> There has been several changes to the way Package projects are handled in
> WDK 10. Driver packages are now created by default for every driver
> project. You could add the post build step to the driver project itself
> [“ConfigurationType=Driver”]. This would be easy in case of one/few package
> project per driver.
>
> Looks like the custom PostBuild step you added is running before the
> Inf2Cat target in case of “ConfigurationType=Utility”. I am looking at this
> issue and trying to understand it. Will get back with my findings and
> possible workarounds.
>
> Thanks,
> Ajay
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list online at: <
> http://www.osronline.com/showlists.cfm?list=ntdev&gt;
>
> MONTHLY seminars on crash dump analysis, WDF, Windows internals and
> software drivers!
> Details at http:
>
> To unsubscribe, visit the List Server section of OSR Online at <
> http://www.osronline.com/page.cfm?name=ListServer&gt;
></http:>