odk/examples/DevelopersGuide/FirstSteps/FirstLoadComponent/csharp/Makefile  |  
  3 ++-
 odk/examples/DevelopersGuide/FirstSteps/FirstUnoContact/csharp/Makefile     |  
  3 ++-
 odk/examples/DevelopersGuide/FirstSteps/HelloTextTableShape/csharp/Makefile |  
  3 ++-
 odk/examples/DevelopersGuide/OfficeDev/PathSettings/csharp/Makefile         |  
  3 ++-
 odk/examples/DevelopersGuide/OfficeDev/PathSubstitution/csharp/Makefile     |  
  3 ++-
 odk/examples/DevelopersGuide/OfficeDev/TerminationTest/csharp/Makefile      |  
  3 ++-
 odk/examples/dotnet/WriterDemo/csharp/Makefile                              |  
  3 ++-
 odk/examples/dotnet/WriterDemo/fsharp/Makefile                              |  
  3 ++-
 odk/examples/dotnet/WriterDemo/vbasic/Makefile                              |  
  3 ++-
 9 files changed, 18 insertions(+), 9 deletions(-)

New commits:
commit a6b38c4ce7efe58988d8a4110010935973755da4
Author:     Hossein <hoss...@libreoffice.org>
AuthorDate: Wed Sep 10 17:06:58 2025 +0200
Commit:     Hossein <hoss...@libreoffice.org>
CommitDate: Wed Sep 10 21:25:22 2025 +0200

    tdf#165608 Fix .NET examples bound to specific version
    
    Previously, .NET SDK examples were bound specifically to .NET 8 target
    version, or "net8.0". Now, the major/minor version of .NET SDK is
    extracted from the output of invoking 'dotnet --version' command to
    create the project file for .NET SDK examples.
    
    For example:
    
    $ dotnet --version
    9.0.123
    
    Then, the target will be 'net9.0', as is expected:
    
    $ echo net$(dotnet --version | cut -d. -f1-2)
    net9.0
    
    Change-Id: Ibea3cfa0b9b68394dab6efdf4b5c0c34f7b4e882
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190774
    Tested-by: Jenkins
    Reviewed-by: Hossein   <hoss...@libreoffice.org>

diff --git 
a/odk/examples/DevelopersGuide/FirstSteps/FirstLoadComponent/csharp/Makefile 
b/odk/examples/DevelopersGuide/FirstSteps/FirstLoadComponent/csharp/Makefile
index 2cd58d246ac7..3387e8672cb0 100644
--- a/odk/examples/DevelopersGuide/FirstSteps/FirstLoadComponent/csharp/Makefile
+++ b/odk/examples/DevelopersGuide/FirstSteps/FirstLoadComponent/csharp/Makefile
@@ -24,6 +24,7 @@ DOTNET_FLAGS = -c Release
 LO_NUPKG_ID = LibreOffice.Bindings
 LO_NUPKG_VERSION = 0.1.0
 LO_NUPKG_DIR = $(abspath $(PRJ)/dotnet)
+TARGET_FRAMEWORK = net$(shell dotnet --version | cut -d. -f1-2)
 
 # Targets
 .PHONY: ALL
@@ -36,7 +37,7 @@ $(APP_PROJ_FILE) :
        $(ECHO) "<Project Sdk=\"Microsoft.NET.Sdk\">" > $@
        $(ECHO) "    <PropertyGroup>" >> $@
        $(ECHO) "        <AssemblyName>$(APP_NAME)</AssemblyName>" >> $@
-       $(ECHO) "        <TargetFramework>net8.0</TargetFramework>" >> $@
+       $(ECHO) "        
<TargetFramework>$(TARGET_FRAMEWORK)</TargetFramework>" >> $@
        $(ECHO) "        <OutputType>exe</OutputType>" >> $@
        $(ECHO) "        <PublishSingleFile>true</PublishSingleFile>" >> $@
        $(ECHO) "        <SelfContained>false</SelfContained>" >> $@
diff --git 
a/odk/examples/DevelopersGuide/FirstSteps/FirstUnoContact/csharp/Makefile 
b/odk/examples/DevelopersGuide/FirstSteps/FirstUnoContact/csharp/Makefile
index c3257605e853..c4797f4f5b3b 100644
--- a/odk/examples/DevelopersGuide/FirstSteps/FirstUnoContact/csharp/Makefile
+++ b/odk/examples/DevelopersGuide/FirstSteps/FirstUnoContact/csharp/Makefile
@@ -24,6 +24,7 @@ DOTNET_FLAGS = -c Release
 LO_NUPKG_ID = LibreOffice.Bindings
 LO_NUPKG_VERSION = 0.1.0
 LO_NUPKG_DIR = $(abspath $(PRJ)/dotnet)
+TARGET_FRAMEWORK = net$(shell dotnet --version | cut -d. -f1-2)
 
 # Targets
 .PHONY: ALL
@@ -36,7 +37,7 @@ $(APP_PROJ_FILE) :
        $(ECHO) "<Project Sdk=\"Microsoft.NET.Sdk\">" > $@
        $(ECHO) "    <PropertyGroup>" >> $@
        $(ECHO) "        <AssemblyName>$(APP_NAME)</AssemblyName>" >> $@
-       $(ECHO) "        <TargetFramework>net8.0</TargetFramework>" >> $@
+       $(ECHO) "        
<TargetFramework>$(TARGET_FRAMEWORK)</TargetFramework>" >> $@
        $(ECHO) "        <OutputType>exe</OutputType>" >> $@
        $(ECHO) "        <PublishSingleFile>true</PublishSingleFile>" >> $@
        $(ECHO) "        <SelfContained>false</SelfContained>" >> $@
diff --git 
a/odk/examples/DevelopersGuide/FirstSteps/HelloTextTableShape/csharp/Makefile 
b/odk/examples/DevelopersGuide/FirstSteps/HelloTextTableShape/csharp/Makefile
index b30bfb7afcbd..bdc0fd054178 100644
--- 
a/odk/examples/DevelopersGuide/FirstSteps/HelloTextTableShape/csharp/Makefile
+++ 
b/odk/examples/DevelopersGuide/FirstSteps/HelloTextTableShape/csharp/Makefile
@@ -24,6 +24,7 @@ DOTNET_FLAGS = -c Release
 LO_NUPKG_ID = LibreOffice.Bindings
 LO_NUPKG_VERSION = 0.1.0
 LO_NUPKG_DIR = $(abspath $(PRJ)/dotnet)
+TARGET_FRAMEWORK = net$(shell dotnet --version | cut -d. -f1-2)
 
 # Targets
 .PHONY: ALL
@@ -36,7 +37,7 @@ $(APP_PROJ_FILE) :
        $(ECHO) "<Project Sdk=\"Microsoft.NET.Sdk\">" > $@
        $(ECHO) "    <PropertyGroup>" >> $@
        $(ECHO) "        <AssemblyName>$(APP_NAME)</AssemblyName>" >> $@
-       $(ECHO) "        <TargetFramework>net8.0</TargetFramework>" >> $@
+       $(ECHO) "        
<TargetFramework>$(TARGET_FRAMEWORK)</TargetFramework>" >> $@
        $(ECHO) "        <OutputType>exe</OutputType>" >> $@
        $(ECHO) "        <PublishSingleFile>true</PublishSingleFile>" >> $@
        $(ECHO) "        <SelfContained>false</SelfContained>" >> $@
diff --git 
a/odk/examples/DevelopersGuide/OfficeDev/PathSettings/csharp/Makefile 
b/odk/examples/DevelopersGuide/OfficeDev/PathSettings/csharp/Makefile
index 5509df52153a..81d0d3d5e60b 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/PathSettings/csharp/Makefile
+++ b/odk/examples/DevelopersGuide/OfficeDev/PathSettings/csharp/Makefile
@@ -24,6 +24,7 @@ DOTNET_FLAGS = -c Release
 LO_NUPKG_ID = LibreOffice.Bindings
 LO_NUPKG_VERSION = 0.1.0
 LO_NUPKG_DIR = $(abspath $(PRJ)/dotnet)
+TARGET_FRAMEWORK = net$(shell dotnet --version | cut -d. -f1-2)
 
 # Targets
 .PHONY: ALL
@@ -36,7 +37,7 @@ $(APP_PROJ_FILE) :
        $(ECHO) "<Project Sdk=\"Microsoft.NET.Sdk\">" > $@
        $(ECHO) "    <PropertyGroup>" >> $@
        $(ECHO) "        <AssemblyName>$(APP_NAME)</AssemblyName>" >> $@
-       $(ECHO) "        <TargetFramework>net8.0</TargetFramework>" >> $@
+       $(ECHO) "        
<TargetFramework>$(TARGET_FRAMEWORK)</TargetFramework>" >> $@
        $(ECHO) "        <OutputType>exe</OutputType>" >> $@
        $(ECHO) "        <PublishSingleFile>true</PublishSingleFile>" >> $@
        $(ECHO) "        <SelfContained>false</SelfContained>" >> $@
diff --git 
a/odk/examples/DevelopersGuide/OfficeDev/PathSubstitution/csharp/Makefile 
b/odk/examples/DevelopersGuide/OfficeDev/PathSubstitution/csharp/Makefile
index 363c4ca92587..1477f7da5de9 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/PathSubstitution/csharp/Makefile
+++ b/odk/examples/DevelopersGuide/OfficeDev/PathSubstitution/csharp/Makefile
@@ -24,6 +24,7 @@ DOTNET_FLAGS = -c Release
 LO_NUPKG_ID = LibreOffice.Bindings
 LO_NUPKG_VERSION = 0.1.0
 LO_NUPKG_DIR = $(abspath $(PRJ)/dotnet)
+TARGET_FRAMEWORK = net$(shell dotnet --version | cut -d. -f1-2)
 
 # Targets
 .PHONY: ALL
@@ -36,7 +37,7 @@ $(APP_PROJ_FILE) :
        $(ECHO) "<Project Sdk=\"Microsoft.NET.Sdk\">" > $@
        $(ECHO) "    <PropertyGroup>" >> $@
        $(ECHO) "        <AssemblyName>$(APP_NAME)</AssemblyName>" >> $@
-       $(ECHO) "        <TargetFramework>net8.0</TargetFramework>" >> $@
+       $(ECHO) "        
<TargetFramework>$(TARGET_FRAMEWORK)</TargetFramework>" >> $@
        $(ECHO) "        <OutputType>exe</OutputType>" >> $@
        $(ECHO) "        <PublishSingleFile>true</PublishSingleFile>" >> $@
        $(ECHO) "        <SelfContained>false</SelfContained>" >> $@
diff --git 
a/odk/examples/DevelopersGuide/OfficeDev/TerminationTest/csharp/Makefile 
b/odk/examples/DevelopersGuide/OfficeDev/TerminationTest/csharp/Makefile
index 76d685fd3dcc..a4977c7709f7 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/TerminationTest/csharp/Makefile
+++ b/odk/examples/DevelopersGuide/OfficeDev/TerminationTest/csharp/Makefile
@@ -24,6 +24,7 @@ DOTNET_FLAGS = -c Release
 LO_NUPKG_ID = LibreOffice.Bindings
 LO_NUPKG_VERSION = 0.1.0
 LO_NUPKG_DIR = $(abspath $(PRJ)/dotnet)
+TARGET_FRAMEWORK = net$(shell dotnet --version | cut -d. -f1-2)
 
 # Targets
 .PHONY: ALL
@@ -36,7 +37,7 @@ $(APP_PROJ_FILE) :
        $(ECHO) "<Project Sdk=\"Microsoft.NET.Sdk\">" > $@
        $(ECHO) "    <PropertyGroup>" >> $@
        $(ECHO) "        <AssemblyName>$(APP_NAME)</AssemblyName>" >> $@
-       $(ECHO) "        <TargetFramework>net8.0</TargetFramework>" >> $@
+       $(ECHO) "        
<TargetFramework>$(TARGET_FRAMEWORK)</TargetFramework>" >> $@
        $(ECHO) "        <OutputType>exe</OutputType>" >> $@
        $(ECHO) "        <PublishSingleFile>true</PublishSingleFile>" >> $@
        $(ECHO) "        <SelfContained>false</SelfContained>" >> $@
diff --git a/odk/examples/dotnet/WriterDemo/csharp/Makefile 
b/odk/examples/dotnet/WriterDemo/csharp/Makefile
index 28992ec130d4..7bc34acf597b 100644
--- a/odk/examples/dotnet/WriterDemo/csharp/Makefile
+++ b/odk/examples/dotnet/WriterDemo/csharp/Makefile
@@ -24,6 +24,7 @@ DOTNET_FLAGS = -c Release
 LO_NUPKG_ID = LibreOffice.Bindings
 LO_NUPKG_VERSION = 0.1.0
 LO_NUPKG_DIR = $(abspath $(PRJ)/dotnet)
+TARGET_FRAMEWORK = net$(shell dotnet --version | cut -d. -f1-2)
 
 # Targets
 .PHONY: ALL
@@ -36,7 +37,7 @@ $(APP_PROJ_FILE) :
        $(ECHO) "<Project Sdk=\"Microsoft.NET.Sdk\">" > $@
        $(ECHO) "    <PropertyGroup>" >> $@
        $(ECHO) "        <AssemblyName>$(APP_NAME)</AssemblyName>" >> $@
-       $(ECHO) "        <TargetFramework>net8.0</TargetFramework>" >> $@
+       $(ECHO) "        
<TargetFramework>$(TARGET_FRAMEWORK)</TargetFramework>" >> $@
        $(ECHO) "        <OutputType>exe</OutputType>" >> $@
        $(ECHO) "        <PublishSingleFile>true</PublishSingleFile>" >> $@
        $(ECHO) "        <SelfContained>false</SelfContained>" >> $@
diff --git a/odk/examples/dotnet/WriterDemo/fsharp/Makefile 
b/odk/examples/dotnet/WriterDemo/fsharp/Makefile
index d3aaad0c6499..83fc278d7f91 100644
--- a/odk/examples/dotnet/WriterDemo/fsharp/Makefile
+++ b/odk/examples/dotnet/WriterDemo/fsharp/Makefile
@@ -24,6 +24,7 @@ DOTNET_FLAGS = -c Release
 LO_NUPKG_ID = LibreOffice.Bindings
 LO_NUPKG_VERSION = 0.1.0
 LO_NUPKG_DIR = $(abspath $(PRJ)/dotnet)
+TARGET_FRAMEWORK = net$(shell dotnet --version | cut -d. -f1-2)
 
 # Targets
 .PHONY: ALL
@@ -36,7 +37,7 @@ $(APP_PROJ_FILE) :
        $(ECHO) "<Project Sdk=\"Microsoft.NET.Sdk\">" > $@
        $(ECHO) "    <PropertyGroup>" >> $@
        $(ECHO) "        <AssemblyName>$(APP_NAME)</AssemblyName>" >> $@
-       $(ECHO) "        <TargetFramework>net8.0</TargetFramework>" >> $@
+       $(ECHO) "        
<TargetFramework>$(TARGET_FRAMEWORK)</TargetFramework>" >> $@
        $(ECHO) "        <OutputType>exe</OutputType>" >> $@
        $(ECHO) "        <PublishSingleFile>true</PublishSingleFile>" >> $@
        $(ECHO) "        <SelfContained>false</SelfContained>" >> $@
diff --git a/odk/examples/dotnet/WriterDemo/vbasic/Makefile 
b/odk/examples/dotnet/WriterDemo/vbasic/Makefile
index 01014c71a820..0bd37f6f219c 100644
--- a/odk/examples/dotnet/WriterDemo/vbasic/Makefile
+++ b/odk/examples/dotnet/WriterDemo/vbasic/Makefile
@@ -24,6 +24,7 @@ DOTNET_FLAGS = -c Release
 LO_NUPKG_ID = LibreOffice.Bindings
 LO_NUPKG_VERSION = 0.1.0
 LO_NUPKG_DIR = $(abspath $(PRJ)/dotnet)
+TARGET_FRAMEWORK = net$(shell dotnet --version | cut -d. -f1-2)
 
 # Targets
 .PHONY: ALL
@@ -36,7 +37,7 @@ $(APP_PROJ_FILE) :
        $(ECHO) "<Project Sdk=\"Microsoft.NET.Sdk\">" > $@
        $(ECHO) "    <PropertyGroup>" >> $@
        $(ECHO) "        <AssemblyName>$(APP_NAME)</AssemblyName>" >> $@
-       $(ECHO) "        <TargetFramework>net8.0</TargetFramework>" >> $@
+       $(ECHO) "        
<TargetFramework>$(TARGET_FRAMEWORK)</TargetFramework>" >> $@
        $(ECHO) "        <OutputType>exe</OutputType>" >> $@
        $(ECHO) "        <PublishSingleFile>true</PublishSingleFile>" >> $@
        $(ECHO) "        <SelfContained>false</SelfContained>" >> $@

Reply via email to