Reputation: 3
I've created a CLR (.NET Core) project and added a Windows Form there. I didn't change any code and tried to run the program. Then the error MSB4236 The SDK Microsoft.NET.Sdk specified could not be found comes in. enter image description here
The header file code:
`#pragma once
namespace Project21 {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
public ref class MyForm : public System::Windows::Forms::Form
{
public:
MyForm(void)
{
InitializeComponent();
}
protected:
~MyForm()
{
if (components)
{
delete components;
}
}
private:
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
void InitializeComponent(void)
{
this->components = gcnew System::ComponentModel::Container();
this->Size = System::Drawing::Size(300,300);
this->Text = L"MyForm";
this->Padding = System::Windows::Forms::Padding(0);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
}
#pragma endregion
};
} `
Upvotes: 0
Views: 677
Reputation: 84
My error message was
C:\code\SomeSolution\tests\MyProject.Tests.Unit\MyProject.Tests.Unit.csproj : error : C:\Program Files\dotnet\sdk\6.0.400\Sdks\Microsoft.NET.Sdk\Sdk not found. Check that a recent enough .NET SDK is installed and/or increase the version specified in global.json. C:\code\SomeSolution\tests\MyProject.Tests.Unit\MyProject.Tests.Unit.csproj : error MSB4236: The SDK 'Microsoft.NET.Sdk' specified could not be found.
After looking at MSB4236: The SDK 'name' specified could not be found and examining MyProject.Tests.Unit.csproj, I looked at folder C:\Program Files\dotnet\sdk\6.0.400
and noticed that it only had a few folders in it unlike sibling folders 6.0.407
and 7.0.202
which each had many folders in them.
SOLUTION (TL;DR)
I deleted folder 6.0.400
from C:\Program Files\dotnet\sdk\
.
That's it! The build worked after deleting that folder. It was just a guess that deleting that folder would keep MSBuild from trying to use that version of the .NET SDK.
Disclaimer: Your mileage may vary. Other things can cause a MSB4236 error.
Upvotes: 0