When I rebuild solution, message appears
You are working with a preview version of the .NET Core SDK. You can define the SDK version via a global.json file in the current project
I created a global.json containing
{
"sdk": {
"version": "2.1.4"
}
}
Then in cli,
dotnet --version
outputs
2.1.4
Then in cli,
dotnet --list-sdks
outputs
2.1.4 [C:\Program Files\dotnet\sdk]
2.1.100 [C:\Program Files\dotnet\sdk]
2.1.101 [C:\Program Files\dotnet\sdk]
2.1.102 [C:\Program Files\dotnet\sdk]
2.1.103 [C:\Program Files\dotnet\sdk]
2.1.104 [C:\Program Files\dotnet\sdk]
2.1.200-preview-007474 [C:\Program Files\dotnet\sdk]
2.1.200-preview-007576 [C:\Program Files\dotnet\sdk]
2.1.200 [C:\Program Files\dotnet\sdk]
2.1.300-preview2-008533 [C:\Program Files\dotnet\sdk]
In my .csproj
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Folder Include="wwwroot\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.8" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.4" />
<PackageReference Include="NLog.Web.AspNetCore" Version="4.5.4" />
</ItemGroup>
<ItemGroup>
<Content Update="nlog.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
After changing the dotnet version by doing the above, I still get the message when I rebuild solution. How do I change the current version of .net core sdk I am using and remove that annoying message?
Uninstall the toolOpen Add or Remove Programs. Search for Microsoft . NET SDK Uninstall Tool . Select Uninstall.
NET Runtime updates are compatible with the latest major version of the . NET SDKs. This means that you can remove safely the older versions. To remove the unuseful version of the SDKs and runtimes, you can use the dotnet-core-uninstall tool.
Unless your application has specific reasons for earlier SDKs or runtimes, you may safely remove older versions.
In order to change default dotnet SDK version, place a global. json file in the current folder or any parent folder with the contents below. You can create the global. json file manually, or use the dotnet cli command dotnet new globaljson .
See this PR on github: https://github.com/dotnet/sdk/pull/2042
Basically you could do the following in your .csproj file:
<PropertyGroup>
<SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>
</PropertyGroup>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With