You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is the same value as your error message. So it is trying to find Hostx64 directory under that path at d:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.35.32213\bin\Hostx64 which does not exist.
Check the output of:
dir d:\Program Files\Microsoft Visual Studio\2022\Preview
:: does it exist?:: do you see VC directory in the output of dir command?
If it does not, you can try uninstalling Visual Studio and reinstalling again. Otherwise, see microsoft/vswhere#258, microsoft/vswhere#41 and some other discussions to find out the problem with your VS installation (most likely some registry key or environment variable is out of sync).
The documentation mentions Desktop development with C++ which may select it automatically in the installer UI, but then in Individual Components tab, user can un-select items. In my Windows 10 system, I selected Desktop development with C++ (and few other things like .NET Framework for my work), but if I remember it correctly, that was enough to get dotnet publish -p:PublishAot=true working.
<ErrorCondition="'$(_VCVarsAllFound)' == '1'"Text="Platform linker not found. To fix this problem, download and install Visual Studio 2022 from http://visualstudio.com. Make sure to install the Desktop Development for C++ workload. For ARM64 development also install C++ ARM64 build tools." />
Yes, or the accompanying bat file (which runs vswhere command) can also detect it and produce the error? Lets see. I will wait for @jkotas thoughts on Windows SDK requirement.
We switched to vswhere in dotnet/corert@9e2f015. At that time, I had a system which I was restoring to factory settings to create different kinds of undesired states to form error message. IIRC, Windows SDK requirement wasn't spotted; which could be an oversight or because it is now pulled from cryptography lib object required by one of the runtime libs object. Maybe there is a way to not depend on Windows SDK and still facilitate advapi32.lib dependency. 🤔
I will wait for @jkotas thoughts on Windows SDK requirement.
Yes, Windows SDK (and number of other components that come with Desktop development with C++ workload) are required. We do not want to be in a business of reshipping or recreating Windows SDK or other parts of Visual Studio.
We depend on number of Windows SDK libs, it is not just advapi32.lib:
<ErrorCondition="'$(_VCVarsAllFound)' == '1'"Text="Platform linker not found. To fix this problem, download and install Visual Studio 2022 from http://visualstudio.com. Make sure to install the Desktop Development for C++ workload. For ARM64 development also install C++ ARM64 build tools." />
I do not mind improving the error handling if it is reasonably simple. However, it is close to impossible to make these script detect all possible ways that your Visual Studio installation can be corrupted.
It's not clear to me how to detect that. Although if there is an easy way to do so, happy to include it. Maybe we could check the registry inside the build task, assuming there's a well-known registry key.
Finding Windows SDK paths manually in all kinds of 32/64 x64/x86/arm64/arm variations robustly gets complex and it is nondeterministic; Windows / VS teams can and do make breaking changes. Even if we figure it out via registry, it doesn't really help because we don't know if the final cl.exe call will actually select the Windows SDK version which we identified as installed, because user can have side-by-side VS installed; one with required components and the other without.
We can continue using vswhere and add the additional required component ID. This way, it will match the components in context of instance of VS. The problem there is that the current version of vswhere which ships with Visual Studio is 3.0. This version doesn't support glob patterns, so it's not feasible to list all the applicable/supported SDKs IDs. In the next version 3.1.1, they have added glob pattern support which we can use to determine if any Windows SDK version is present that applies to the instance of VS. So for the upcoming VS version, we can improve it a little bit.
The general guidance is to refer to documentation for prerequisites applicable to your platform. We have similar blind spots in clang/gcc toolchains. For advanced issues, build diagnostics (bin logs or diag logs) help finding the compiler command and troubleshooting.
ghost locked as resolved and limited conversation to collaborators on Mar 12, 2023
Activity
am11 commentedon Feb 3, 2023
Looks like your Visual Studio installation is in unusual state. Please show the output of:
Varorbc commentedon Feb 6, 2023
@am11

am11 commentedon Feb 6, 2023
It is the same value as your error message. So it is trying to find
Hostx64directory under that path atd:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.35.32213\bin\Hostx64which does not exist.Check the output of:
If it does not, you can try uninstalling Visual Studio and reinstalling again. Otherwise, see microsoft/vswhere#258, microsoft/vswhere#41 and some other discussions to find out the problem with your VS installation (most likely some registry key or environment variable is out of sync).
Varorbc commentedon Feb 6, 2023
am11 commentedon Feb 6, 2023
OK. The paths exist. Does it give some useful information if you run the linker command manually?
Varorbc commentedon Feb 6, 2023
am11 commentedon Feb 6, 2023
Thanks. So 1181 with
cannot open input file 'advapi32.lib'looks like dotnet/runtimelab#1449.Does this error go away if you unset
LIBandLIBPATHenvironment variables? Like this:Varorbc commentedon Feb 6, 2023
3 remaining items
am11 commentedon Feb 6, 2023
Yes, please test if installing just Windows SDK fixes your problem. If it does, we should (at least) add a note for it explicitly in the documentation that Windows SDK is needed https://learn.microsoft.com/en-us/dotnet/core/deploying/native-aot/#prerequisites.
The documentation mentions
Desktop development with C++which may select it automatically in the installer UI, but then inIndividual Componentstab, user can un-select items. In my Windows 10 system, I selectedDesktop development with C++(and few other things like .NET Framework for my work), but if I remember it correctly, that was enough to getdotnet publish -p:PublishAot=trueworking.Varorbc commentedon Feb 6, 2023
Windows SDK installed and work well
Varorbc commentedon Feb 6, 2023
It would be nice to add another check like this
runtime/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Windows.targets
Line 116 in 2ca0229
am11 commentedon Feb 6, 2023
Yes, or the accompanying bat file (which runs vswhere command) can also detect it and produce the error? Lets see. I will wait for @jkotas thoughts on Windows SDK requirement.
We switched to vswhere in dotnet/corert@9e2f015. At that time, I had a system which I was restoring to factory settings to create different kinds of undesired states to form error message. IIRC, Windows SDK requirement wasn't spotted; which could be an oversight or because it is now pulled from cryptography lib object required by one of the runtime libs object. Maybe there is a way to not depend on Windows SDK and still facilitate advapi32.lib dependency. 🤔
jkotas commentedon Feb 6, 2023
Yes, Windows SDK (and number of other components that come with
Desktop development with C++workload) are required. We do not want to be in a business of reshipping or recreating Windows SDK or other parts of Visual Studio.We depend on number of Windows SDK libs, it is not just advapi32.lib:
runtime/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Windows.targets
Lines 53 to 67 in 21a8eb5
Varorbc commentedon Feb 8, 2023
@jkotas ????
jkotas commentedon Feb 9, 2023
I do not mind improving the error handling if it is reasonably simple. However, it is close to impossible to make these script detect all possible ways that your Visual Studio installation can be corrupted.
Varorbc commentedon Feb 9, 2023
At least should detect whether Windows SDK is installed.
agocke commentedon Feb 10, 2023
It's not clear to me how to detect that. Although if there is an easy way to do so, happy to include it. Maybe we could check the registry inside the build task, assuming there's a well-known registry key.
Varorbc commentedon Feb 10, 2023
@agocke https://stackoverflow.com/questions/2665755/how-to-get-installed-windows-sdk-version
am11 commentedon Feb 10, 2023
Finding Windows SDK paths manually in all kinds of 32/64 x64/x86/arm64/arm variations robustly gets complex and it is nondeterministic; Windows / VS teams can and do make breaking changes. Even if we figure it out via registry, it doesn't really help because we don't know if the final cl.exe call will actually select the Windows SDK version which we identified as installed, because user can have side-by-side VS installed; one with required components and the other without.
We can continue using vswhere and add the additional required component ID. This way, it will match the components in context of instance of VS. The problem there is that the current version of vswhere which ships with Visual Studio is 3.0. This version doesn't support glob patterns, so it's not feasible to list all the applicable/supported SDKs IDs. In the next version 3.1.1, they have added glob pattern support which we can use to determine if any Windows SDK version is present that applies to the instance of VS. So for the upcoming VS version, we can improve it a little bit.
The general guidance is to refer to documentation for prerequisites applicable to your platform. We have similar blind spots in clang/gcc toolchains. For advanced issues, build diagnostics (bin logs or diag logs) help finding the compiler command and troubleshooting.