Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to remove message "You are working with a preview version of the .NET Core SDK"

Tags:

asp.net-core

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?

like image 697
Alexander Avatar asked May 19 '18 08:05

Alexander


People also ask

How do I remove dotnet-core SDK?

Uninstall the toolOpen Add or Remove Programs. Search for Microsoft . NET SDK Uninstall Tool . Select Uninstall.

Can I uninstall Microsoft .NET Core SDK?

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.

Is it safe to uninstall Microsoft .NET SDK?

Unless your application has specific reasons for earlier SDKs or runtimes, you may safely remove older versions.

How do I change .NET SDK version?

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 .


1 Answers

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>
like image 60
Andrew Avatar answered Feb 20 '23 00:02

Andrew