-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
P/Invoke and COM definitions not generated by builds for ARM64 #494
Comments
That would be due to the metadata. I don't see an architecture-specific attribute on |
Looking at the structs, TBBUTTON has a definition for x86 and one for x64/arm64. The error message sounds like you're trying to build for AnyCpu, which it can't do because there are different definitions for 32 and 64 bits. @AArnott, am I misreading the error message? Doesn't this look like it's by design? |
Hmm... Yes the build log does make it look like it's AnyCPU. But the build command line use is what I was reading and that makes it appears it would not be Any CPU. I'll take another look. |
Ok, so the problem is apparent when you add
A quick glance at the msbuild .targets files in the .NET SDK suggests that this disconnect is intended for projects to pivot based on runtime identifiers instead of platforms. If you modify your project file like this: - <Platforms>x64;arm64</Platforms>
+ <RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers> Then building succeeds when you target a specific runtime identifier:
I don't know why this is only required when setting platform to arm64. Your project builds fine as you expected with |
@AArnott I think you're exactly right, and dotnet/sdk#15434 should be the right place to track it. @baronfel, I think there might be room for some docs guidance about Platform/RID for .NET projects; I believe we generally prefer specifying RID and inferring Platform/PlatformTarget but I couldn't see that anywhere in the docs. |
Thanks for the investigation. I was able to avoid this problem for the time being by adding the following definition to csproj file. <PropertyGroup Condition=" '$(_PlatformWithoutConfigurationInference)' == 'ARM64' ">
<PlatformTarget Condition=" '$(PlatformTarget)' == '' ">ARM64</PlatformTarget>
</PropertyGroup> |
Actual behavior
Some APIs do not seem to generate definitions even if you build with
ARM64
platform instead ofAny CPU
. I can confirm this withIShellBrowser
,IShellView
andSHGetFileInfo
.Expected behavior
I expect the API definition to be generated when ARM64 is specified as well as when x64 is specified.
Repro steps
NativeMethods.txt
content:NativeMethods.json
content (if present):Build comand
Build log
Context
0.1.635-beta
net6.0
LangVersion
(if explicitly set by project):The text was updated successfully, but these errors were encountered: