Reputation: 1829
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?
Upvotes: 13
Views: 7764
Reputation: 3273
This message warns you about possible bugs and instabilities of using a preview sdk version.
You can force Visual studio (or cli) to use a non-preview sdk version. To do so place a "global.json" file in your solution folder. you can create one using:
dotnet new globaljson --sdk-version <your_desired_sdk_version>
Upvotes: 2
Reputation: 5430
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>
Upvotes: 14