I'm having an issue regarding trying to compile my .netcore3.1 after updated the SDK to .NET 6.0 preview while debugging through Visual Studio.
My CSProject is bellow :
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<UserSecretsId>f5884bc9-1eeb-1458-bba9-832ed8f4cd4e</UserSecretsId>
</Project>
my dotnet sdk installed :
.NET SDK (reflecting any global.json):
Version: 6.0.100-preview.5.21302.13
Commit: d6380bcae7
Runtime Environment:
OS Name: Windows
OS Version: 10.0.18363
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\6.0.100-preview.5.21302.13\
Host (useful for support):
Version: 6.0.0-preview.5.21301.5
Commit: ec3e0b276b
.NET SDKs installed:
1.1.14 [C:\Program Files\dotnet\sdk]
2.1.519 [C:\Program Files\dotnet\sdk]
2.2.104 [C:\Program Files\dotnet\sdk]
3.0.103 [C:\Program Files\dotnet\sdk]
3.1.300 [C:\Program Files\dotnet\sdk]
5.0.301 [C:\Program Files\dotnet\sdk]
6.0.100-preview.5.21302.13 [C:\Program Files\dotnet\sdk]
error messages :
The referenced project is a non self-contained executable. A non self-contained executable cannot be referenced by a self-contained executable.
According to the documentation, your configuration never did work, but you would only find out when trying to run the referencing application:
In previous .NET SDK versions, you could reference a self-contained executable project from a non-self-contained executable project without a build error. However, both apps would not be runnable. Starting in .NET SDK 5, an error is generated if an executable project references another executable project and the SelfContained values don't match.
Now, you get the error at build time, so that you know then that you need to fix one project or the other so that their "self-contained-ness" matches.
Note that if you are sure you want to mix the SelfContained
values in spite of the potential issues, you can disable checking for that condition, by adding <ValidateExecutableReferencesMatchSelfContained>false</ValidateExecutableReferencesMatchSelfContained>
to the .csproj file.