semantic-kernel
semantic-kernel copied to clipboard
func start --csharp from Sample doesnt work
Describe the bug
`PS C:\git\semantic-kernel\samples\dotnet\KernelHttpServer> func start --csharp
MSBuild version 17.5.0+6f08c67f3 for .NET C:\git\semantic-kernel\dotnet\Directory.Build.targets : error : Could not resolve SDK "Microsoft.Build.CentralPackageVersions". Exactly one of the probing messages below indicates why we could not resolve the SDK. Investigate and resolve that message to correctly specify the SDK. C:\git\semantic-kernel\dotnet\Directory.Build.targets : error : SDK resolver "Microsoft.DotNet.MSBuildWorkloadSdkResolver" returned null. C:\git\semantic-kernel\dotnet\Directory.Build.targets : error : Unable to find package Microsoft.Build.CentralPackageVersions. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages C:\git\semantic-kernel\dotnet\Directory.Build.targets : error : MSB4276: The default SDK resolver failed to resolve SDK "Microsoft.Build.CentralPackageVersions" because directory "C:\Program Files\dotnet\sdk\7.0.202\Sdks\Microsoft.Build.CentralPackageVersions\Sdk" did not exist. C:\git\semantic-kernel\dotnet\Directory.Build.targets : error MSB4236: The SDK 'Microsoft.Build.CentralPackageVersions/2.1.3' specified could not be found. [C:\git\semantic-kernel\samples\dotnet\KernelHttpServer\KernelHttpServer.csproj]`
Expected behavior Function is started locally
Desktop (please complete the following information):
- OS: Windows 11
- IDE: VS CODE
Hi @kboro, you'll need .NET 7 SDK, you can download it at: https://dotnet.microsoft.com/en-us/download/dotnet/7.0
Hi @eduardogoncalves,
Sorry I should mention about it at the beginning. Of course .NET SDK is already installed on my machine but issue still persist.
`PS C:\git\semantic-kernel> dotnet --info .NET SDK: Version: 7.0.202 Commit: 6c74320bc3
Runtime Environment: OS Name: Windows OS Version: 10.0.22000 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\7.0.202\
Host: Version: 7.0.4 Environment variables: Not set
global.json file: Not found
Learn more: https://aka.ms/dotnet/info
Download .NET: https://aka.ms/dotnet/download`
Hi @kboro, as the SDK is already installed, can you clear the NuGet cache:
dotnet nuget locals all --clear
Then try to build and run the function again using the following command:
func start --csharp
If the issue persists, you can try to delete the bin
and obj
folders of the project and rebuild it.
Additionally, you can try to update or reinstall the .NET SDK and Visual Studio.
Do you also have dotnet 6?
There is an unfortunate footnote in that Azure Functions require dotnet 6 to build:

See https://learn.microsoft.com/en-us/azure/azure-functions/dotnet-isolated-process-guide#supported-versions
When I open VSCODE with elevated permissions (runas admin) problem disappeared. Soliution works like a charm!
Thank you everyone for support!