Skip to content

Don’t set x86 on reference assembly (addressing CS8012) - #36

Merged
AnthonyLloyd merged 1 commit into
MKL-NET:masterfrom
delreluca:patch/anycpu-reference-assembly
Sep 8, 2026
Merged

Don’t set x86 on reference assembly (addressing CS8012)#36
AnthonyLloyd merged 1 commit into
MKL-NET:masterfrom
delreluca:patch/anycpu-reference-assembly

Conversation

@delreluca

Copy link
Copy Markdown
Contributor

I’ve noticed that referencing MKL.NET causes warning CS8012 for consumers because the reference assembly has architecture x86 instead of msil (AnyCPU), which will not match. (That warning is not documented, but it’s in the Roslyn source code)

This is due to the runtime identifier (we use osx-x86 as a dummy for the reference assembly build) also setting the PlatformTarget.

In this PR I introduce an MSBuild property to control the reference assembly build instead. If that property is set the runtime identifier will be empty and the output will be one folder higher in the hierarchy.

Before the change: x86 (= PE header machine I386 with CorFlags 32BitRequried)
Screenshot 2026-09-06 at 13 32 15

After: msil (= PE header machine I386 but CorFlags 32BitRequired unset)
Screenshot 2026-09-06 at 13 31 42

Using `osx-x86` as dummy runtime for the reference assembly sets the
`PlatformTarget` (PE machine header) of the reference assembly to `x86`,
causing warning like CS8012

Prefer `AnyCPU` instead by not setting any RID
@AnthonyLloyd
AnthonyLloyd merged commit 0558ce5 into MKL-NET:master Sep 8, 2026
2 of 3 checks passed
@AnthonyLloyd

Copy link
Copy Markdown
Member

thanks

@delreluca

Copy link
Copy Markdown
Contributor Author

Many thanks @AnthonyLloyd ! Do you reckon there is going to be a new release soon?

@AnthonyLloyd

Copy link
Copy Markdown
Member

Yes sure. In the next couple of days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants