microsoft / DMF

Driver Module Framework
MIT License
312 stars 78 forks source link

fatal error C1510: Cannot load language resource clui.dll #232

Closed 77 closed 1 year ago

77 commented 1 year ago

Fresh clone of master. Command line .\build\build.ps1 20H1 Release ARM64. Building for x64 also gives this error.

LOG: https://gist.github.com/77/f9af5ba903fed0a0956a26aa3c0a52f1

samtertzakian commented 1 year ago

Hi

It looks to me like you are using an older EWDK. From log it seems to be:

Enterprise Windows Driver Kit (WDK) build environment Version vb_release.19041.1

Is it possible you can use a later EWDK and see if it fixes the issue.

Here we are using "Windows 11, version 22H2" with VS 2019. It also works with VS 2022, I believe.

If that works, it is it possible you can use that new EWDK?

If not, we may have to make changes to the project files to support the older EWDK.

If i get some time, I can try to reproduce your issue using the older EWDK and see how difficult it is to fix that.

77 commented 1 year ago

The 19041.1 EWDK is the latest version supported by the build.ps1 script. I did try building in VS2022 with the 22H2 WDK but got a different error with that. I can build ARM64 in VS2022 with the 22H2 WDK but x64 and Win32 builds give another error. That was why I tried using the build.ps1 script from the repo.

samtertzakian commented 1 year ago

Can you try the following...

Use your desired EWK. Open a command line prompt and run:

cd EWDK_co_release_22000_210604-1628\ (use your desired version) LaunchBuildEnv.cmd cd BuildEnv SetDevEnv.cmd SetupBuildEnv.cmd SetupVSEnv.cmd

Then, run visual studio from the command line prompt and open the DMF solution. Rebuild All and everything should build.

As for the build.ps1, I have not used that myself...It is pretty old and perhaps it is not working with current projects. I will try to investigate why. However, the above instructions should work for you.

77 commented 1 year ago

Using the Vb (19041) EWDK I already had downloaded and issuing the above commands following by msbuild Dmf.sln /p:Configuration=Debug /p:Platform=x64 gives the same clui.dll error.

Launching VS2022 from that command prompt and building gives the following error for x64 and ARM64 builds.

10>d:\Program Files\Windows Kits\10\build\WindowsDriver.common.targets(299,5): error MSB4062: The "ValidateNTTargetVersion" task could not be loaded from the assembly d:\Program Files\Windows Kits\10\build\bin\Microsoft.DriverKit.Build.Tasks.17.0.dll. Could not load file or assembly 'file:///d:\Program Files\Windows Kits\10\build\bin\Microsoft.DriverKit.Build.Tasks.17.0.dll' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.

Using the Co (22000) EWDK the command line build works fine but building in Visual Studio gives the following error for x64 and ARM64 builds.

10>D:\Program Files\Windows Kits\10\build\WindowsDriver.common.targets(302,5): error MSB4062: The "ValidateNTTargetVersion" task could not be loaded from the assembly D:\Program Files\Windows Kits\10\build\bin\Microsoft.DriverKit.Build.Tasks.17.0.dll. Could not load file or assembly 'file:///D:\Program Files\Windows Kits\10\build\bin\Microsoft.DriverKit.Build.Tasks.17.0.dll' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.

Using the Ni (22621) EWDK the command line build works fine but building in Visual Studio gives the following error for x64 builds.

10>D:\Program Files\Windows Kits\10\build\10.0.22621.0\WindowsDriver.common.targets(314,5): error MSB4044: The "ValidateNTTargetVersion" task was not given a value for the required parameter "ValidNTTargetVersions".

Summary:

WDK Build Method Platform Status
19041 msbuild x64 fail
19041 msbuild ARM64 fail
19041 VS2022 x64 fail
19041 VS2022 ARM64 fail
22000 msbuild x64 success
22000 msbuild ARM64 success
22000 VS2022 x64 fail
22000 VS2022 ARM64 fail
22621 msbuild x64 success
22621 msbuild ARM64 success
22621 VS2022 x64 fail
22621 VS2022 ARM64 success
samtertzakian commented 1 year ago

Hi

Are you able to build using the VS IDE?

Other people are building using command line successfully.

I will investigate further. Thank you for the report.

On Thu, Mar 2, 2023, 10:50 AM 77 @.***> wrote:

Using the Vb EWDK I already had downloaded and issuing the above commands following by msbuild Dmf.sln /p:Configuration=Debug /p:Platform=x64 gives the same error.

Launching VS2022 from that command prompt and building gives the following error.

10>d:\Program Files\Windows Kits\10\build\WindowsDriver.common.targets(299,5): error MSB4062: The "ValidateNTTargetVersion" task could not be loaded from the assembly d:\Program Files\Windows Kits\10\build\bin\Microsoft.DriverKit.Build.Tasks.17.0.dll. Could not load file or assembly 'file:///d:\Program Files\Windows Kits\10\build\bin\Microsoft.DriverKit.Build.Tasks.17.0.dll' or one of its dependencies. The system cannot find the file specified. Confirm that the

declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. I'll repeat the steps with the Co and Ni EWDKs once they finish downloading. — Reply to this email directly, view it on GitHub , or unsubscribe . You are receiving this because you commented.Message ID: ***@***.***>
77 commented 1 year ago

Sam, See my previous comment. I edited it with the details of my experiments.

samtertzakian commented 1 year ago

Hi...

Thank you for your effort.

I am investigating this. I would like to see if we can make VS2022/226231 x64 work since msbuild works.

I will try to repro that and if I can I will see what I can do.

samtertzakian commented 1 year ago

Hello....Ok, here is the status....

The error you are seeing with VS2022/226231 is a known issue caused by a regression in WDK or VS2022 (not clear to me) and apparently there is an internal wokitem it is in the process of being corrected but I do not know the eventual outcome.

I was able to reproduce the error with VS2022/226231/x64. I was able to reproduce VS2022/226231/ARM64 works.

Finally, I was able to correct VS2022/226231/x64 by doing the following:

Before you start VS2022 from the 226231 EWDK command line, enter this command:

set MSBuildUserExtensionsPath=%VSINSTALLDIR%\MsBuild

Then, run VS2022. Then you should be able to build.

Can you try that and let me know. I do not know if this will fix the other issues...but I think it fixes the latest version and probably the versions you want to build with.

Please let me know if that works for you...And thank you so much for the feedback. I am sure this will help others.

samtertzakian commented 1 year ago

Unfortunately, that fix appears to not work for 220000 EWK. Please use 226231 instead. I am not going to try the other EWDKs because the root problem appears to be a regression in VS2022. The previous EWDKs work with VS2019.

So the two options are (I think):

  1. Run set MSBuildUserExtensionsPath=%VSINSTALLDIR%\MsBuild command before running VS2022 (see above).
  2. Use VS0219.
77 commented 1 year ago

Thanks Sam. To recap I did the following and I'm able to build both x64 and ARM64 from VS2022.

Mount EWDK_ni_release_svc_prod1_22621_220804-1759.iso on D:

D:
LaunchBuildEnv.cmd
cd BuildEnv
SetDevEnv.cmd
SetupBuildEnv.cmd
SetupVSEnv.cmd
set MSBuildUserExtensionsPath=%VSINSTALLDIR%\MsBuild
"c:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\devenv.exe"
samtertzakian commented 1 year ago

That is great to hear.

Long term, when i get some time I will try to see if there is a way the projects can be modified so that that extra set does not need to be done. Also, I think VS2022 team is planning on fixing this issue, but it is not clear to me if that is true or when that would happen.

As for the issues with the older EWDK, I think it is best to use VS2019. If that does not work for you let me know.

Glad to hear you are unblocked. Please don't hesitate to create new issues should you find something else.

samtertzakian commented 1 year ago

Note:

This issue is resolved in v1.1.132.

Starting with this version it is possible to build using both CO and NI EWDK with VS2019 and VS2022 without running this command:

set MSBuildUserExtensionsPath=%VSINSTALLDIR%\MsBuild