Windows Driver Kit - inf2cat error - visual-studio

I am running a sample code from windows driver samples and it gives me the following error :
1>------ Rebuild All started: Project: ObCallbackTestCtrl, Configuration: Release x64 ------
2>------ Rebuild All started: Project: ObCallbackTest, Configuration: Release x64 ------
1> Building 'ObCallbackTestCtrl' with toolset 'WindowsApplicationForDrivers10.0' and the 'Desktop' target platform.
1> pchsrc.cpp
2> Building 'ObCallbackTest' with toolset 'WindowsKernelModeDriver10.0' and the 'Desktop' target platform.
2> pchsrc.c
2> callback.c
1> main.cpp
2> tdriver.c
2> util.c
2> Generating Code...
1> utils.cpp
1> Generating Code...
2> ObCallbackTest.vcxproj -> C:\Users\me\Desktop\obcallback\driver\x64\Release\ObCallbackTest.sys
1> ObCallbackTestCtrl.vcxproj -> C:\Users\me\Desktop\obcallback\control\x64\Release\ObCallbackTestCtrl.exe
2> Done Adding Additional Store
2> Successfully signed: C:\Users\me\Desktop\obcallback\driver\x64\Release\ObCallbackTest.sys
2>
2> Inf2Cat task was skipped as there were no inf files to process
2>
========== Rebuild All: 2 succeeded, 0 failed, 0 skipped ==========
I am not sure if its a warning or intended to be, but nothing happens when I run the program. I run the program with "-install" arguments and it doesn't give any error. Then no other commands have any effect. "-reject xyz" doesn't stop the execution of the xyz process, and "-name" "-deprotect" don't seem to work either. They don't work or throw any error either.
I have read the other related thread on the same issue but I don't have that update installed on my system.
I am running Windows 7 and VS 2015.
Would appreciate any help, thanks!

You need to load the kernel-mode device driver which is used for the kernel-mode callback; the user-mode program is nothing but a a console program which will communicate with the kernel-mode device driver via IOCTL. The kernel-mode device driver is responsible for actually providing the functionality.
ObCallbackTest.sys was successfully built according to the log you posted, therefore go into your analysis environment, copy across ObCallbackTest.sys and ObCallbackTestCtrl.exe and then load ObCallbackTest.sys with the Service Manager (e.g. OSRLOADER will be fine for testing). After the kernel-mode device driver is active, run ObCallbackTestCtrl.exe with administrator rights and see if it then works.
Don't do it on your Host environment because BSOD crashes can cause data corruption, and that can have devastating effects on your real Host environment. Instead, use a physical machine for testing kernel-mode software, or a Virtual Machine. You also need to setup remote kernel debugging support so you can debug your kernel-mode software for investigation to ensure things are working as they should, and to help you diagnose the source of bugs in your device driver projects.

Related

Install a seft signed driver on Windows 10 64 bit

I am struggling to develope my own driver to hook on serial port IRP.
To start I followed microsoft guide "Write a Universal Windows driver (KMDF) based on a template"
It seems that the driver is written and built successfully so as signed too:
Rebuild started...
1>------ Rebuild All started: Project: KMDF Driver1, Configuration: Release x64 ------
1>Building 'KMDF Driver1' with toolset 'WindowsKernelModeDriver10.0' and the 'Universal' target platform.
1>Stamping x64\Release\KMDFDriver1.inf
1>Stamping [Version] section with DriverVer=09/03/2022,17.42.15.777
1>Driver.c
1>KMDF Driver1.vcxproj ->D:\_PROJECTS\_BASIC SOFTWARE\DriverTemplate\KMDF Driver1\x64\Release\KMDFDriver1.sys
1>Done Adding Additional Store
1>Successfully signed: D:\_PROJECTS\_BASIC SOFTWARE\DriverTemplate\KMDF Driver1\x64\Release\KMDFDriver1.sys
1>
1>Driver is 'Universal'.
1>........................
1>Signability test complete.
1>
1>Errors:
1>None
1>
1>Warnings:
1>None
1>
1>Catalog generation complete.
1>D:\_PROJECTS\_BASIC SOFTWARE\DriverTemplate\KMDF Driver1\x64\Release\KMDF Driver1\kmdfdriver1.cat
1>Done Adding Additional Store
1>Successfully signed: D:\_PROJECTS\_BASIC SOFTWARE\DriverTemplate\KMDF Driver1\x64\Release\KMDF Driver1\kmdfdriver1.cat
1>
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
Then I tried to install using Device Manager: Action-> Add legacy driver-> Install the hardware that I manually select from a list (Advanced)-> I have Disk-> "KMDFDriver1.inf"->
Here it days "This driver is not digitally signed!"
And on the [Next] step it fails with:
"The third-party INF does not contain digital signature information."
My .inf file is like this:
;
; KMDFDriver1.inf
;
[Version]
Signature="$WINDOWS NT$"
Class=System ; TODO: specify appropriate Class
ClassGuid={4d36e97d-e325-11ce-bfc1-08002be10318} ; TODO: specify appropriate ClassGuid
Provider=%ManufacturerName%
CatalogFile=KMDFDriver1.cat
DriverVer = 09/03/2022,18.2.12.202
PnpLockdown=1
[DestinationDirs]
DefaultDestDir = 12
KMDFDriver1_Device_CoInstaller_CopyFiles = 11
[SourceDisksNames]
1 = %DiskName%,,,""
[SourceDisksFiles]
KMDFDriver1.sys = 1,,
;
;*****************************************
; Install Section
;*****************************************
[Manufacturer]
%ManufacturerName%=Standard,NTamd64
[Standard.NTamd64]
%KMDFDriver1.DeviceDesc%=KMDFDriver1_Device, Root\KMDFDriver1 ; TODO: edit hw-id
[KMDFDriver1_Device.NT]
CopyFiles=Drivers_Dir
[Drivers_Dir]
KMDFDriver1.sys
;-------------- Service installation
[KMDFDriver1_Device.NT.Services]
AddService = KMDFDriver1,%SPSVCINST_ASSOCSERVICE%, KMDFDriver1_Service_Inst
; -------------- KMDFDriver1 driver install sections
[KMDFDriver1_Service_Inst]
DisplayName = %KMDFDriver1.SVCDESC%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %12%\KMDFDriver1.sys
;
;--- KMDFDriver1_Device Coinstaller installation ------
;
[KMDFDriver1_Device.NT.CoInstallers]
AddReg=KMDFDriver1_Device_CoInstaller_AddReg
CopyFiles=KMDFDriver1_Device_CoInstaller_CopyFiles
[KMDFDriver1_Device_CoInstaller_AddReg]
;
[KMDFDriver1_Device_CoInstaller_CopyFiles]
;
[KMDFDriver1_Device.NT.Wdf]
KmdfService = KMDFDriver1, KMDFDriver1_wdfsect
[KMDFDriver1_wdfsect]
KmdfLibraryVersion = 1.15
[Strings]
SPSVCINST_ASSOCSERVICE= 0x00000002
ManufacturerName="<Your manufacturer name>" ;TODO: Replace with your manufacturer name
DiskName = "KMDFDriver1 Installation Disk"
KMDFDriver1.DeviceDesc = "KMDFDriver1 Device"
KMDFDriver1.SVCDESC = "KMDFDriver1 Service"
My project folder contains the follwoing files:
[D:_PROJECTS_BASIC SOFTWARE\DriverTemplate\KMDF Driver1\x64\Release]
KMDFDriver1.cer
KMDFDriver1.inf
KMDFDriver1.pdb
KMDFDriver1.sys
My goal is to be able to write and sign my own driver to hook it on my main application
I am running on a Windows 10 - 64 Bit - Secure Boot (which requires signed drivers).
I have my certificates valid and expiring in 2032.
What am I doing wrong?
Thanks
Like Anders said, use the test signature. It is the default for new projects.
Go to properties -> Driver signing -> General, and back change sign mode to Test Sign if it's not.
Then right click the .inf -> install (on the target computer). Or go to device manager, right click your device and update driver, then select your driver.
Secure Boot might mess with that, IDK I never used it.
Another option is to disable driver signature enforcement. Search in google how to do that if you need to.
Partially done but messy like hell and not finished with Driver testing but at least the Driver has been installed.
Preliminary requisites:
Make sure you have your certificate present in the Certificated list. It was created in Visual Studio.
Make sure Visual Studio compiles with no error.
In my case and for this little guide I did a Kernel Driver and Visual Studio built 2 different sets of drivers and .inf files.
Important: Disable Secure Boot if your BIOS has it. There is no tricky workaround to this. I did not like to do it but I had to.
../x64/Release/KMDFDriver.cer
../x64/Release/KMDFDriver.inf
../x64/Release/KMDFDriver.pdb
../x64/Release/KMDFDriver.sys
and
../x64/Release/KMDF Driver1/KMDFDriver.cat <-Catalog to add to System Database
../x64/Release/KMDF Driver1/KMDFDriver.inf <-Modify Manufacturer Name
../x64/Release/KMDF Driver1/KMDFDriver.sys <-THIS IS OUR TARGET
Here comes how I made it using the Catalog signed driver:
Disabled Secure Boot from BIOS (my machine has it)
Enable Test signing from commandline (admin lev)
"Bcdedit.exe -set TESTSIGNING ON"
Compiled Driver with visual studio
Modified .inf
ManufacturerName="MeMyselfAndI" ;
NOTE: this is very important otherwise the driver installation gives you a generic "error occured"
Signed driver again using Signtool.
NOTE: This is the strange part as Visual Studio apparently signed the code already but I needed to sign it again. Indeed right after the Driver size went from 9KB to 14KB
My certificate was present and generated by Visual Studio and then I used the /a option (automatic).
SignTool sign /v /a /d kmdfdriver1.cat /t http://timestamp.digicert.com KMDFDriver1.sys
Added my certificate to catalog.
SignTool catdb /v /u kmdfdriver1.cat
Note: All three files are in the same subdir of Visual Studio. To make it faster copy SignTool from its ClickOnce directory to your builing directory.... just copy it.
At this point the catalog is not loaded into the system yet. It is just installed. If you try to install it you'll get this message "The hash for the file is not present in the specified catalog file. The file is likely corrupt or the victim of tampering."
Time to REBOOT your PC
Finally right click on the .inf file and follow the instructions with the red banner and all the warnings of the world but off it goes!
Conclusions:
This was one of the most challenging and frustrating task of my life.
It is poorly documented in case of errors and a lot of damn pitfalls.
This link helped me more than any other Microsoft's docs:
http://www.davidegrayson.com/signing/
I hope this partially detailed way helped all like me who spent a day to get it to work smashing against Windows science walls.
R64

How to connect ESP32

I am getting the following eroor while connecting ESP32
Arduino: 1.8.19 (Windows Store 1.8.57.0) (Windows 10), Board: "ESP32 Dev Module, Disabled, Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), 240MHz (WiFi/BT), QIO, 80MHz, 4MB (32Mb), 921600, None"
Multiple libraries were found for "WiFi.h"
In file included from C:\Users\Ayan Atal\Desktop\College\SEM 6\Minor\Ultrasonic\Ultrasonic.ino:3:0:
Used: C:\Users\Ayan Atal\Documents\ArduinoData\packages\esp32\hardware\esp32\1.0.6\libraries\WiFi
C:\Users\Ayan Atal\Documents\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:33:22: fatal error: AsyncTCP.h: No such file or directory
Not used: C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\libraries\WiFi
compilation terminated.
exit status 1
Error compiling for board ESP32 Dev Module.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
There is library name conflicts. I usually solve this by first uninstalling Arduino IDE and then deleting arduino libraries, and then reinstalling everything from scratch. Sometimes using older versions of arduino IDE also had helped.
Thank You,
Have a Great Day,
Naveen.

Error "Ensure kernel-qemu is in the same location as your system image"

Yesterday I decided to try out VS2019 for Xamarin projects, so I created a Xamarin.Forms project and selected Master-Detail template.
Once it was created, I simply debug it (F5) and I see the test app in the Android emulator. Everything works fine.
Today, I try to run the app again, I have changed absolutely nothing in the code. I rebuild the solution and it builds successfully.
When I run the app, it fails for this reason:
1>Starting deployment to Android_Accelerated_x86_Oreo ...
1>Starting emulator Android_Accelerated_x86_Oreo ...
1>C:\Program Files (x86)\Android\android-sdk\emulator\emulator.EXE -no-boot-anim -avd Android_Accelerated_x86_Oreo -prop monodroid.avdname=Android_Accelerated_x86_Oreo
1>emulator: ERROR: This AVD's configuration is missing a kernel file! Please ensure the file "kernel-qemu" is in the same location as your system image.
1>emulator: ERROR: ANDROID_SDK_ROOT is undefined
1>Emulator Android_Accelerated_x86_Oreo cannot be started.
========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========
The only solutions I have found deal with Android Studio, but I'm using Visual Studio 2019.
What can the issue be?

How to programmatically emulate battery in Windows workstation without battery device?

For testing purposes I need to force Windows to think that it has battery on workstation PC.
Is there the way to fake/mock/emulate/simulate battery state/low level/charging/discharging in Windows workstation without battery device?
Can I set battery level programmatically on Windows?
tl;dr: Use Windows Driver Testing Framework (WDTF) Runtime Libraries from Windows Driver Kit (WDK)
Long instruction:
Install Visual Studio with Windows Driver Kit (WDK)
Create virtual machine
Seach for WDK Test Target Setup x64-x64_en-us.msi in C:\Program Files (x86)\Windows Kits
Install WDK Test Target Setup x64-x64_en-us.msi on virtual machine.
In Visual Studio, in main menu Driver > Test > Configure Devices add virtual machine to install (WDTF) Runtime Libraries.
From virtual machine copy folder C:\Program Files (x86)\Windows Kits\10\Testing\Runtimes\WDTF\RunTime on your workstation
From RunTime folder run as administrator RegisterWDTF.exe
Output:
C:\RunTime>RegisterWDTF.exe
-Delete registry state.
-Get registry path.
-Register COM DLLs.
Process "C:\RunTime\Actions\Deprecated\DeviceManagement.dll".
Process "C:\RunTime\Actions\DeviceSupport\WDTFDeviceSupportAction.dll".
Process "C:\RunTime\Actions\DrvPkgLibExt.dll".
Not a COM DLL
Process "C:\RunTime\Actions\EDT\WDTFEDTAction.dll".
Process "C:\RunTime\Actions\IoSpy\WDTFIoAttackAction.dll".
Process "C:\RunTime\Actions\IoSpy\WDTFIoSpyAction.dll".
Process "C:\RunTime\Actions\SimpleIO\SimpleIO_D3DTest.dll".
Process "C:\RunTime\Actions\SimpleIO\WDTFAnySimpleIoAction.dll".
Process "C:\RunTime\Actions\SimpleIO\WDTFAudioSimpleIoAction.dll".
Process "C:\RunTime\Actions\SimpleIO\WDTFBluetoothSimpleIoAction.dll".
Process "C:\RunTime\Actions\SimpleIO\WDTFCDROMSimpleIoAction.dll".
Process "C:\RunTime\Actions\SimpleIO\WDTFMobileBroadbandSimpleIoAction.dll".
Process "C:\RunTime\Actions\SimpleIO\WDTFMUTT2STRESSSimpleIoAction.dll".
Process "C:\RunTime\Actions\SimpleIO\WDTFMUTT2TCDSimpleIoAction.dll".
Process "C:\RunTime\Actions\SimpleIO\WDTFNetworkSimpleIoAction.dll".
Process "C:\RunTime\Actions\SimpleIO\WDTFVolumeSimpleIoAction.dll".
Process "C:\RunTime\Actions\SimpleIO\WDTFWebcamSimpleIoAction.dll".
Process "C:\RunTime\Actions\SimpleIO\WDTFWirelessSimpleIoAction.dll".
Process "C:\RunTime\Actions\SimpleIO\WDTFWPDSimpleIoAction.dll".
Process "C:\RunTime\Actions\SimulatedBattery\WDTFSimulatedBatterySystemAction.dll".
Process "C:\RunTime\Actions\System\WDTFSystemAction.dll".
Process "C:\RunTime\Actions\WDTFConcurrentIOAction.dll".
Process "C:\RunTime\Actions\WDTFCpuUtilizationSystemAction.dll".
Process "C:\RunTime\Actions\WDTFDriverPackageAction.dll".
Process "C:\RunTime\Actions\WDTFDriverSetupDeviceAction.dll".
Process "C:\RunTime\Actions\WDTFDriverSetupSystemAction.dll".
Process "C:\RunTime\Actions\WDTFDriverVerifierSystemAction.dll".
Process "C:\RunTime\Actions\WDTFFuzzTestAction.dll".
Process "C:\RunTime\Actions\WDTFInterfaces\WDTFInterfaces.dll".
Process "C:\RunTime\Actions\WDTFPNPAction.dll".
Process "C:\RunTime\Actions\WDTFSUPAction.dll".
Process "C:\WDTF.DLL".
-Update registry state.
-Install Drivers.
-Done
WDTF Registration Successful
Now you can use COM object "WDTF2.WDTF" in your program language like in this VBScript example:
'
' Variable defenition
'
Dim WDTF
Dim SimulatedBatterySystemSystemAction
'
' Create WDTF object
'
Set WDTF = CreateObject("WDTF2.WDTF")
'
' Get your newly created SimulatedBatterySystem action interface
'
Set SimulatedBatterySystemSystemAction = WDTF.SystemDepot.ThisSystem.GetInterface("SimulatedBatterySystem")
' enable the simulated battery
SimulatedBatterySystemSystemAction.EnableSimulatedBattery()
' disable real batteries
SimulatedBatterySystemSystemAction.DisableRealBatteries()
' set to DC power status
SimulatedBatterySystemSystemAction.SetSimulatedBatteryToDC()
' set to 50% charge level
SimulatedBatterySystemSystemAction.SetSimulatedBatteryChargePercentage(50)
WScript.Sleep 10000
' set to AC power status
SimulatedBatterySystemSystemAction.SetSimulatedBatteryToAC()
' enable real batteries
SimulatedBatterySystemSystemAction.EnableRealBatteries()
' disable the simulated battery
SimulatedBatterySystemSystemAction.DisableSimulatedBattery()
Here all WDTF reference: https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/content/_dtf/
Just in case, Linux Fake battery module: https://github.com/hoelzro/linux-fake-battery-module
Oleg's answer was fairly straightforward to follow but I was unable to make it simulate a battery - the actions to disable and enable the real battery did succeed.
PS C:\RunTime> .\RegisterWDTF.exe
This version of WDTF is compatible with Windows Build 17763.
-Delete registry state.
-Get registry path.
-Register COM DLLs.
Process "C:\RunTime\Actions\Deprecated\DeviceManagement.dll".
Process "C:\RunTime\Actions\DeviceSupport\WDTFDeviceSupportAction.dll".
Process "C:\RunTime\Actions\DrvPkgLibExt.dll".
Not a COM DLL
Process "C:\RunTime\Actions\EDT\WDTFEDTAction.dll".
Process "C:\RunTime\Actions\IoSpy\WDTFIoAttackAction.dll".
Process "C:\RunTime\Actions\IoSpy\WDTFIoSpyAction.dll".
Process "C:\RunTime\Actions\SimpleIO\SimpleIO_D3DTest.dll".
Process "C:\RunTime\Actions\SimpleIO\WDTFAnySimpleIoAction.dll".
Process "C:\RunTime\Actions\SimpleIO\WDTFAudioSimpleIoAction.dll".
Process "C:\RunTime\Actions\SimpleIO\WDTFBluetoothSimpleIoAction.dll".
Process "C:\RunTime\Actions\SimpleIO\WDTFCDROMSimpleIoAction.dll".
Process "C:\RunTime\Actions\SimpleIO\WDTFMobileBroadbandSimpleIoAction.dll".
Process "C:\RunTime\Actions\SimpleIO\WDTFMUTT2STRESSSimpleIoAction.dll".
Process "C:\RunTime\Actions\SimpleIO\WDTFMUTT2TCDSimpleIoAction.dll".
Process "C:\RunTime\Actions\SimpleIO\WDTFNetworkSimpleIoAction.dll".
Process "C:\RunTime\Actions\SimpleIO\wdtfsensorsiosimpleioaction.dll".
Process "C:\RunTime\Actions\SimpleIO\WDTFVolumeSimpleIoAction.dll".
Process "C:\RunTime\Actions\SimpleIO\WDTFWebcamSimpleIoAction.dll".
Process "C:\RunTime\Actions\SimpleIO\WDTFWirelessSimpleIoAction.dll".
Process "C:\RunTime\Actions\SimpleIO\WDTFWPDSimpleIoAction.dll".
Process "C:\RunTime\Actions\SimulatedBattery\WDTFSimulatedBatterySystemAction.dll".
Process "C:\RunTime\Actions\System\WDTFSystemAction.dll".
Process "C:\RunTime\Actions\WDTFConcurrentIOAction.dll".
Process "C:\RunTime\Actions\WDTFCpuUtilizationSystemAction.dll".
Process "C:\RunTime\Actions\WDTFDriverPackageAction.dll".
Process "C:\RunTime\Actions\WDTFDriverSetupDeviceAction.dll".
Process "C:\RunTime\Actions\WDTFDriverSetupSystemAction.dll".
Process "C:\RunTime\Actions\WDTFDriverVerifierSystemAction.dll".
Process "C:\RunTime\Actions\WDTFFuzzTestAction.dll".
Process "C:\RunTime\Actions\WDTFInterfaces\WDTFInterfaces.dll".
Process "C:\RunTime\Actions\WDTFPNPAction.dll".
Process "C:\RunTime\Actions\WDTFSUPAction.dll".
Process "C:\RunTime\WDTF.DLL".
-Update registry state.
-Install Drivers.
-Done
WDTF Registration Successful
PS C:\RunTime> cscript.exe .\fake-battery.vbs
Microsoft (R) Windows Script Host Version 5.812
Copyright (C) Microsoft Corporation. All rights reserved.
Loading Wex.Logger.dll from systemdata.cpp linep 922 failed.
WDTF_TARGET : INFO : - GetInterface("SimulatedBatterySystem")
WDTF_TARGET : INFO : Target: ORANGE
WDTF_SIMBATT : INFO : DisableRealBatteries()
WDTF_SIMBATT : INFO : EnableSimulatedBattery()
WDTF_SIMBATT : ERROR : SimulatedBatterySystem critical error installing battbus device. HRESULT=0xE0000203
C:\RunTime\fake-battery.vbs(22, 1) WDTF.SimulatedBatterySystem.1: SimulatedBatterySystem critical error installing battbus device. HRESULT=0xE0000203
Unfortunately there is no information that I could find on the public Internet about these errors. Hopefully someone out there comes across this and knows what to do next!
--
edit: it appears as though Visual Studio installs various drivers in addition to the testing framework so simply copying RunTime folder is insufficient. I ended up adding my workstation as a full target using VS from another workstation. This then let me simulate the battery.

"The process cannot access the file 'Default.rd.xml' because it is being used by another process." on AppVeyor CI

I am doing some work on cordova-windows (https://github.com/apache/cordova-windows), which is using AppVeyor for testing on Windows. One of the things that was missing, were tests with Visual Studio 2017 (only VS2015 was used to test before). So I added those and it works like a charm - mostly.
Unfortunately we now have a very strange test failure:
https://ci.appveyor.com/project/ApacheSoftwareFoundation/cordova-windows/build/1.0.458
Started
Creating Cordova Windows Project:
Path: testcreate 応用
Namespace: com.test.app
Name: 応用
Windows project created with cordova-windows#5.1.0-dev
Building project: C:\projects\cordova-windows\testcreate 応用\CordovaApp.Windows10.jsproj
Configuration : release
Platform : x64
Patching 10 in prebuild event...
Injected base.js reference to the www/index.html
Removing /( *)(<script\s+(?:type="text\/javascript"\s+)?src="\/\/Microsoft.WinJS.2.0\/js\/base.js">\s*<\/script>)(\s*)/ from www/index.html
Removing /( *)(<script\s+(?:type="text\/javascript"\s+)?src="\/\/Microsoft.Phone.WinJS.2.1\/js\/base.js">\s*<\/script>)(\s*)/ from www/index.html
CordovaApp.Windows10 -> C:\projects\cordova-windows\testcreate ??\build\windows\release\x64\win10\CordovaApp.Windows10_1.0.0.0_x64.appx
CordovaApp.Windows10 -> C:\projects\cordova-windows\testcreate ??\build\windows\release\x64\win10\Upload\CordovaApp.Windows10_1.0.0.0_x64.appx
CordovaApp.Windows10 -> C:\projects\cordova-windows\testcreate ??\AppPackages\CordovaApp.Windows10_1.0.0.0_Test\CordovaApp.Windows10_1.0.0.0_x64.appxbundle
CordovaApp.Windows10 -> C:\projects\cordova-windows\testcreate ??\AppPackages\CordovaApp.Windows10_1.0.0.0\CordovaApp.Windows10_1.0.0.0_x64.appxbundle
CordovaApp.Windows10 -> C:\projects\cordova-windows\testcreate ??\AppPackages\CordovaApp.Windows10_1.0.0.0_x64_bundle.appxupload
Your package has been successfully created.
Building project: C:\projects\cordova-windows\testcreate 応用\CordovaApp.Windows10.jsproj
Configuration : release
Platform : x86
Patching 10 in prebuild event...
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\AppxPackage\Microsoft.AppXPackage.Targets(2975,5): error MSB3231: Unable to remove directory "build\windows\bld\PackageUploadLayout\". The process cannot access the file 'Default.rd.xml' because it is being used by another process. [C:\projects\cordova-windows\testcreate ??\CordovaApp.Windows10.jsproj]
C:\projects\cordova-windows\testcreate 応用\cordova\node_modules\q\q.js:155
throw e;
^
Error: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe: Command failed with exit code 1
at ChildProcess.whenDone (C:\projects\cordova-windows\testcreate 応用\cordova\node_modules\cordova-common\src\superspawn.js:169:23)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:920:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:230:5)
The relevant part is this:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\AppxPackage\Microsoft.AppXPackage.Targets(2975,5): error MSB3231: Unable to remove directory "build\windows\bld\PackageUploadLayout\". The process cannot access the file 'Default.rd.xml' because it is being used by another process. [C:\projects\cordova-windows\testcreate ??\CordovaApp.Windows10.jsproj]
This is not happening when I run the tests locally, meaning I can in no way reproduce what is going on here.
Any idea what process could block this Default.rd.xml file or build\windows\bld\PackageUploadLayout\?
How can I find out in a CI environment like AppVeyor?
Update:
Investigated a bit more by adding /clp:Verbosity=normal to the msbuild calls that are executed.
It runs a similar msbuild call 3 times (once per architecture). The first one succeeds, but during the second one the failure occurs. Makes sense as in the first iteration the folder doesn't exist yet, which it confirms with this output: Directory "build\windows\bld\PackageUploadLayout\" doesn't exist. Skipping..
The last output before the failure then is Removing directory "build\windows\bld\PackageUploadLayout\". which matches what we get in the error message. No indicator why the removing doesn't work though.
Super strange: With /clp:Verbosity=detailed added to the msbuild call, the build actually succeeds! My guess: Because the output takes time, whatever is having a lock on the folder or file releases it.
This is not exactly an answer, but rather investigation report. It is just not enough room comments to describe it. Here is what I did:
forked your repo
created AppVeyor project
added RDP
connected with RDP
installed procmon
added filter to monitor objects which path ends with bld\PackageUploadLayout\Properties\Default.rd.xml
run npm test manually from CMD
When the same error happened I see this:
I am not sure I understand why msbuild failed this way. I opened SHARING VIOLATION event, switched to process and see this:
What catches my eye is that msbuild version is 14. Should be 15 on Visual Studio 2017 image. We have version 14 installed for specific scenarios but default one is 15 (run where msbuild and you will see C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe). I am not sure where this path is set in your scripts, but I feel if you make it run correct msbuild version this may help.

Resources