If I create a .net core library and set the architecture to something other than anycpu what does it do ? Also if I set publish to true, I get a runtimes folder. Does the architecture influence that ?
I was looking at the deps.json file for a project created using dotnet and it has
Not much, I believe, aside from setting a flag in the .exe that forces it to run only on that architecture (at least that’s what classic did. Essentially you could force an .exe to always run 32-bit, even on 674-bit systems. or to never run on 32-bit, by setting). This is useful eg you have a native dependency .dll that you only have one arch for.
I don’t believe so. Note there’s a separate RuntimeIdentifiers setting that you can use to say what runtime(s) to build for (as "architecture is rather vague, for something targeting multiple OSs). Normally, your project is built for the local runtime (e.g. “win-x86_64”), when building on Windows, but you can use that to build for all (or an arbitrary subset) of rutimes, including non-local OSs. We use that e.g. to build Ebuild and the compiler for all platforms, on our Windows build machine.
I suppose I could look at limiting this, yeah. But again, Architecture is probably the wrong thing to use here, rather than the runtime (else, if you set x86_64, would you expect win-x86_64 and linux-x86_64 and osx-x86_64, but not win-i386? that seems counter-intuitive).
I’ll check with Carlo next week to see if the Architecture setting has any relevance on the Core side of things, still.
this is when building on linux-x64, i assume? or are you setting that as a target but building elsewhere with dotnet. I suppose i can look at always adding that, but im not sure what the benefit would be. if it ain’t broke…
You have a test-case handy for me? WIll any project do, with Publish=true?
Im trying to create a lambda function for aws. I got a simple example running with anycpu but when I tried with more code and assemblies I ran into problems.
One of the things I see in the aws logs is “Unknown application error occurred Runtime.Unknown” so i was comparing what the official tools generate compared to what Im generating using elements.
In the aws documentation it has
"Lambda provides a choice of instruction set architectures:
arm64 – 64-bit ARM architecture, for the AWS Graviton2 processor.
x86_64 – 64-bit x86 architecture, for x86-based processors. x86_64 is the default architecture. "
The first thing I found was that difference in the generated deps.json
It does. It seems quite promising. I now get errors about missing assemblies.
Its a bit strange, I get
Amazon.Lambda.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'Amazon.Lambda.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
The strange thing is Im still building elements using anycpu, maybe thats causing a problem ? If I want to build for linux-x64 on my mac what would I chose in in elements?
Looking at the second issue (too many runtimes), the issue I see is that just looking across the packages in my local cache, these runtime names ar every varied and confusing.
The go from simple os named (win, osx, linux - but also “unix”), to expected combos (“win-aem64”) to more elaborate ones (“linux-musl-x64”), and specific linux distros even (“debian.8-x64”).
So I’m unsure what the exact logic should be.
Obviously, “win”, “osx”, “linux”, and versions with an architecture, I can handle easily.
What about “unix”.macOS is unix, so should a mac build get the “unix” folder or nor (is it only for other unix variants, wich we don’t actively support, and I didn’t think ,NET Core did either).
What’s “musl”, and should a “linux-x64” build get the “linux-musl-x64” runtime folder?
What about “debian-…” and “fedora-” folders?
For now I’ll fix it so that you only get the runtimes that either exactly match a target (eg “linux-x64”) or match an os "eg “win”), and we take it from there?
I’d still appreciate a testcase or a sample reference that adds the ones you screenshotted above, so I can test this more thoroughly.