Skip to content
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

"No C# compiler has been specified" trying to compile iOS Bindings library #21030

Closed
munkii opened this issue Aug 14, 2024 · 7 comments
Closed
Labels
binding-projects Issue or PR that affects binding projects need-attention An issue requires our attention/response
Milestone

Comments

@munkii
Copy link

munkii commented Aug 14, 2024

Apple platform

iOS

Framework version

net8.0-*

Affected platform version

VS2022 Version 17.11.0 Preview 6.0

Description

Description

This has been raised before but was fixed with a VS update. Doesn't fix for me, I am running VS 17.11.0 Preview 6.0.

If I try and compile my ios bindings library I get the error

error BI0028: bgen: No C# compiler has been specified (using --compiler or --compile-command).

From 1>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\17.2.8053\tools\msbuild\iOS\Xamarin.Shared.targets(1746,3):

The CSProj looks like this

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net8.0-ios</TargetFramework>
    <Nullable>enable</Nullable>
    <ImplicitUsings>true</ImplicitUsings>
    <IsBindingProject>true</IsBindingProject>
  </PropertyGroup>

  <ItemGroup>
    <ObjcBindingApiDefinition Include="ApiDefinition.cs" />
    <ObjcBindingCoreSource Include="StructsAndEnums.cs" />
  </ItemGroup>
	<ItemGroup>
		<NativeReference Include="Frameworks\FAT\MirSmartDevice.framework">
			<Kind>Framework</Kind>
			<Frameworks>Foundation UIKit MirSmartDevice</Frameworks>
			<LinkerFlags>-L "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/" -L "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos" -Wl,-rpath -Wl,@executable_path/Frameworks</LinkerFlags>
		</NativeReference>
	</ItemGroup>
</Project>

I have an existing one in a live Xamarin Forms branch but I am trying to migrate to MAUI. I have had previous issues with this bindings library as discussed here, See comment thread

Steps to Reproduce

The 3rd party SDK is I am trying to create bindings for is not public so I do have an Repo that shows the problem but because the SDK is private the Repo is Private. If the owners of this repo are happy to help I can invite you to the repo

Did you find any workaround?

No. I've had previous issues trying to create the bindings library that I was ablke to workaround. These are discussed in the referenced stackoverflow article but this is a different issue

Build logs

@rolfbjarne
Copy link
Member

The bin log was too big

Can you share it using Dropbox or a similar file-sharing service?

@rolfbjarne rolfbjarne added the need-info Waiting for more information before the bug can be investigated label Aug 14, 2024
@rolfbjarne rolfbjarne added this to the Future milestone Aug 14, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added need-attention An issue requires our attention/response and removed need-info Waiting for more information before the bug can be investigated labels Aug 14, 2024
@munkii
Copy link
Author

munkii commented Aug 14, 2024

The bin log was too big

Can you share it using Dropbox or a similar file-sharing service?

Much smaller when recorded on the small repro than against the full solution. I have pasted the contents into the original comment. Alternatively I can add a Dropbox link

@rolfbjarne
Copy link
Member

The bin log was too big

Can you share it using Dropbox or a similar file-sharing service?

Much smaller when recorded on the small repro than against the full solution. I have pasted the contents into the original comment. Alternatively I can add a Dropbox link

Can you attach it as a file instead? It's not a text file, so it doesn't paste correctly.

@munkii
Copy link
Author

munkii commented Aug 14, 2024

SpirometrySmartSdk.Touch.Bindings_Debug_AnyCPU_Build_2024-08-14T11_32_14.3347998+01_00.binlog.dmp

Renamed as binlog extension not supported as attachment

@rolfbjarne
Copy link
Member

VS2022 Version 17.11.0 Preview 6.0

The stable version of 17.11 was released a couple of days ago, can you try that and see if you can still reproduce the problem? If so, please get an updated binlog.

@rolfbjarne rolfbjarne added need-info Waiting for more information before the bug can be investigated no-auto-reply For internal use and removed need-attention An issue requires our attention/response labels Aug 15, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot removed the no-auto-reply For internal use label Aug 15, 2024
@munkii
Copy link
Author

munkii commented Aug 15, 2024

Updated to stable 17.11 and the bindings project now builds, thanks.

However I still have the issue as detailed in stack overflow that means the Bindings project, when built as part of the wider solution shows no exported types until I Unload the bindings project in VS.

Excerpt from SO comment thread and still an approach I had to take just now with 17.11 stable

"some IDEs require to build the binding by hand and then unload the binding project in order to display code completion and accept the using directive in other files" I think we are seeing this. The Binding library is building and I can see the public types via Object Browser but they cannot compiled against and the Using statement does not work. In Xamarin Forms we only referenced the DLL. Are you saying reference the CSPROJ instead? –

From Patrick Long

That is how I got it working. Reference the .csproj, build it by hand, unload the binding project while still referencing the .csproj. Sounds weird, but it seems like the design-time-build is not including the generated binding sources. –

From OP

When you say "build it by hand" do you mean from the command line or right clicking on the specfic project in Solution Explorer and clicking "Rebuild"? –

From Patrick Long

UPDATE. That's crazy. I just built the CSPROJ (as you said) then unloaded it and it worked????? –

From Patrick Long

Should I log this as a seperate issue here or as "Feedback" for Visual Studio?

@microsoft-github-policy-service microsoft-github-policy-service bot added need-attention An issue requires our attention/response and removed need-info Waiting for more information before the bug can be investigated labels Aug 15, 2024
@rolfbjarne
Copy link
Member

Updated to stable 17.11 and the bindings project now builds, thanks.

That's great, I'll close this then. Thanks for letting us know!

"some IDEs require to build the binding by hand and then unload the binding project in order to display code completion and accept the using directive in other files" I think we are seeing this. The Binding library is building and I can see the public types via Object Browser but they cannot compiled against and the Using statement does not work. In Xamarin Forms we only referenced the DLL. Are you saying reference the CSPROJ instead? –

This is a known issue I'm working on fixing, and will hopefully finish for .NET 9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
binding-projects Issue or PR that affects binding projects need-attention An issue requires our attention/response
Projects
None yet
Development

No branches or pull requests

2 participants