Skip to content

C# example doesn't compile #216

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

Closed
MendyBerger opened this issue Mar 16, 2025 · 7 comments · Fixed by #256
Closed

C# example doesn't compile #216

MendyBerger opened this issue Mar 16, 2025 · 7 comments · Fixed by #256

Comments

@MendyBerger
Copy link
Contributor

The C# example uses IOperations, but IOperations isn't defined or imported anywhere.

@MendyBerger
Copy link
Contributor Author

dotnet build fails with the following error:

Restore complete (0.6s)
  dotnet_counter failed with 1 error(s) (0.3s)
    [path]/Class1.cs(4,33): error CS0246: The type or namespace name 'IOperations' could not be found (are you missing a using directive or an assembly reference?)

Build failed with 1 error(s) in 1.1s

@vados-cosmonic
Copy link
Collaborator

vados-cosmonic commented Apr 23, 2025

Hey @MendyBerger this isn't still the case right? I believe I fixed this on the last go-through (IOperations is no longer there). Code looks like this now:

namespace AdderWorld;

public class AdderWorldImpl : IAdderWorld
{
    public static uint Add(uint x, uint y)
    {
        return x + y;
    }
}

@MendyBerger
Copy link
Contributor Author

MendyBerger commented Apr 30, 2025

Thanks @vados-cosmonic! That issue seems fixed.

Okay, now I'm running into a different error when following the docs.

dotnet build fails with the following error:

/usr/lib/dotnet/sdk/9.0.105/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.TargetFrameworkInference.targets(166,5): error NETSDK1045: The current .NET SDK does not support targeting .NET 10.0.  Either target .NET 9.0 or lower, or use a version of the .NET SDK that supports .NET 10.0. Download the .NET SDK from https://aka.ms/dotnet/download

Restore failed with 1 error(s) in 0.3s

So looks like it wants .NET 10 which is not fully released yet, and I gave up on installing it after 30 minutes of trying...
(BTW would it be possible to stick with released versions of .NET? Previously, .NET 9 was required, but now v9 is released, we just moved to the next per-release?)

When changing to <TargetFramework>net9.0</TargetFramework> I get the following error:

Restore complete (0.4s)
  adder failed with 1 error(s) (0.2s)
    [path]/adder/Component.cs(3,31): error CS0246: The type or namespace name 'IAdderWorld' could not be found (are you missing a using directive or an assembly reference?)

Build failed with 1 error(s) in 0.9s

@vados-cosmonic
Copy link
Collaborator

Ah, so I'm definitely not the C# expert but I think C# support is actually not available for anything other than the version cited -- c3db27e

I'm not sure this has changed... You're going to have to get .NET 10 installed... I wonder if it could be containerized to make it easier

@MendyBerger
Copy link
Contributor Author

Maybe the .net gurus can help me here.
Is there any way to install that .net10 on Ubuntu? I can't find a way to do that

@vados-cosmonic
Copy link
Collaborator

Ah note that I was able to get it installed on daily driver arch setup (I think I last touched the C# docs and set it up)! What part of the instructions did you have problems with? What error did you see?

@MendyBerger
Copy link
Contributor Author

🤦 I was using https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-install-script instead of https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/sdk-10.0.100-preview.3-linux-x64-binaries

(still needed to uninstall .net9 first, but then it installed correctly)

Ran into one issue
public class AdderWorldImpl : IAdderWorld
Should be
public class AddImpl : IAdderWorld
But with that change, it compiles successfully!!!

Thanks for the help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants