Skip to content

VSCODEEXT-353: Document Qt C# extension - #562

Open
leena-miettinen wants to merge 1 commit into
qt-labs:devfrom
leena-miettinen:VSCODEEXT-353-doc-c-sharp
Open

VSCODEEXT-353: Document Qt C# extension#562
leena-miettinen wants to merge 1 commit into
qt-labs:devfrom
leena-miettinen:VSCODEEXT-353-doc-c-sharp

Conversation

@leena-miettinen

Copy link
Copy Markdown
Collaborator
  • Add a section to the Overview
  • Add a tutorial that describes the sample project

https://qt-project.atlassian.net/jira/software/c/projects/VSCODEEXT/boards/672?selectedIssue=VSCODEEXT-353

@leena-miettinen leena-miettinen added the documentation Improvements or additions to documentation label Aug 26, 2026
- Add a section to the Overview
- Add a tutorial that describes the sample project
@leena-miettinen
leena-miettinen force-pushed the VSCODEEXT-353-doc-c-sharp branch from 3310870 to ceb466d Compare August 27, 2026 08:15

namespace MyQtApp;

[QObject]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove, this API is gone in the next release.

references it from \c {Main.qml}.

\code [C#]
using Qt.MetaObject;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove, this namespace is gone in the next release.

\list 1
\li Go to \uicontrol {Welcome}, and then select \uicontrol {New project}.
\li In \uicontrol {Project}, select
\uicontrol {Qt Quick application (Qt for C#)}.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Qt Bridge for C# application

Comment on lines +299 to +335
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<QtBridgePackagePrefix>QtGroup.Qt.Bridge.CSharp</QtBridgePackagePrefix>
<QtBridgeTemplateArch Condition="'$(QtBridgeTemplateArch)' == ''"
>$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)</QtBridgeTemplateArch>
<QtBridgeTemplateArch Condition="'$(QtBridgeTemplateArch)' == 'X64'">x64</QtBridgeTemplateArch>
<QtBridgeTemplateArch Condition="'$(QtBridgeTemplateArch)' == 'Arm64'">arm64</QtBridgeTemplateArch>
<QtBridgeTemplateRid Condition="'$(QtBridgeTemplateRid)' == '' and '$(RuntimeIdentifier)' != ''"
>$(RuntimeIdentifier)</QtBridgeTemplateRid>
<QtBridgeTemplateRid Condition="'$(QtBridgeTemplateRid)' == '' and $([MSBuild]::IsOSPlatform('Windows'))"
>win-x64</QtBridgeTemplateRid>
<QtBridgeTemplateRid Condition="'$(QtBridgeTemplateRid)' == '' and $([MSBuild]::IsOSPlatform('Linux'))"
>linux-$(QtBridgeTemplateArch)</QtBridgeTemplateRid>
<QtBridgePackageId>$(QtBridgePackagePrefix).$(QtBridgeTemplateRid)</QtBridgePackageId>
</PropertyGroup>

<ItemGroup Condition="'$(QtBridgeTemplateRid)' == 'win-x64' or '$(QtBridgeTemplateRid)' == 'linux-x64'">
<PackageReference Include="$(QtBridgePackageId)" Version="0.3.*-*" />
</ItemGroup>

<Target Name="EnsureSupportedQtBridgePlatform" BeforeTargets="Restore;Build"
Condition="'$(QtBridgeTemplateRid)' != 'win-x64' and '$(QtBridgeTemplateRid)' != 'linux-x64'">
<Error Text="Qt Bridge for C# currently supports win-x64 and linux-x64 only. Selected RID: '$(QtBridgeTemplateRid)'." />
</Target>

<ItemGroup>
<None Include="Main.qml"/>
<Compile Include="Program.cs" />
</ItemGroup>

</Project>

@kaheimri kaheimri Sep 1, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace with:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>net8.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
    <EnableDefaultCompileItems>false</EnableDefaultCompileItems>
    <QtBridgePackagePrefix>QtGroup.Qt.Bridge.CSharp</QtBridgePackagePrefix>
    <QtBridgeTemplateArch Condition="'$(QtBridgeTemplateArch)' == ''"
      >$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)</QtBridgeTemplateArch>
    <QtBridgeTemplateArch Condition="'$(QtBridgeTemplateArch)' == 'X64'">x64</QtBridgeTemplateArch>
    <QtBridgeTemplateArch Condition="'$(QtBridgeTemplateArch)' == 'Arm64'">arm64</QtBridgeTemplateArch>
    <QtBridgeTemplateRid Condition="'$(QtBridgeTemplateRid)' == '' and '$(RuntimeIdentifier)' != ''"
      >$(RuntimeIdentifier)</QtBridgeTemplateRid>
    <QtBridgeTemplateRid Condition="'$(QtBridgeTemplateRid)' == '' and $([MSBuild]::IsOSPlatform('Windows'))"
      >win-x64</QtBridgeTemplateRid>
    <QtBridgeTemplateRid Condition="'$(QtBridgeTemplateRid)' == '' and $([MSBuild]::IsOSPlatform('Linux'))"
      >linux-$(QtBridgeTemplateArch)</QtBridgeTemplateRid>
    <QtBridgeTemplateRid Condition="'$(QtBridgeTemplateRid)' == '' and $([MSBuild]::IsOSPlatform('OSX'))"
      >osx-$(QtBridgeTemplateArch)</QtBridgeTemplateRid>
    <QtBridgePackageId>$(QtBridgePackagePrefix).$(QtBridgeTemplateRid)</QtBridgePackageId>
  </PropertyGroup>

  <ItemGroup Condition="'$(QtBridgeTemplateRid)' == 'win-x64'
                    or '$(QtBridgeTemplateRid)' == 'linux-x64'
                    or '$(QtBridgeTemplateRid)' == 'osx-x64'
                    or '$(QtBridgeTemplateRid)' == 'osx-arm64'">
    <PackageReference Include="$(QtBridgePackageId)" Version="0.4.*-*" />
  </ItemGroup>

  <Target Name="EnsureSupportedQtBridgePlatform" BeforeTargets="Restore;Build"
          Condition="'$(QtBridgeTemplateRid)' != 'win-x64'
                  and '$(QtBridgeTemplateRid)' != 'linux-x64'
                  and '$(QtBridgeTemplateRid)' != 'osx-x64'
                  and '$(QtBridgeTemplateRid)' != 'osx-arm64'">
    <Error Text="Qt Bridge for C# currently supports win-x64, linux-x64, osx-x64, and osx-arm64. Selected RID: '$(QtBridgeTemplateRid)'." />
  </Target>

  <ItemGroup>
    <None Include="Main.qml"/>
    <Compile Include="Program.cs" />
  </ItemGroup>

</Project>

\li Go to \uicontrol {Welcome}, and then select \uicontrol {New project}.
\li In \uicontrol {Project}, select
\uicontrol {Qt Quick application (Qt for C#)}.
\image {vscodeext-create-new-project-quick-csharp.webp} {A Qt Quick C# application in the New item view}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vscodeext-create-new-project-quick-csharp.webp isn't included in the PR

@kaheimri kaheimri left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One final note i did not attach to the changes directly:

Framework picker step missing - the wizard's Framework prompt (net8.0/9.0/10.0) isn't mentioned in the walkthrough steps; net8.0 only appears unexplained in the final code sample.

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

Labels

documentation Improvements or additions to documentation

Development

Successfully merging this pull request may close these issues.

2 participants