Closed datoml closed 3 years ago
What is the TFM of your console application?
The TFM is set to net6.0-windows
.
I made a Multi-Target library and referenced it to a net6.0
library that is also referenced in my console application.
So I think the issue was on my side that I used it wrong.
I had to reference the Multi-Target library in my net6.0-windows
app and pass it with an interface to the .net6-0
.
This is the correct and only way because the net6-0
library doesn't know the OS. Is this assumption correct?
It was 100% on my side. I mixed up some things in my head. 😅
If someone comes across the same "problem", this is the solution to it.
To give you a little bit of context. The idea is to create a multi-target library that is able to work with the .net6.0
TFM. What I do here is to separate android
, linux
and windows
. Android
is easy because there is a TFM for it. For linux
and windows
I use a separate configuration. Default will be windows
.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;net6.0-android</TargetFrameworks>
<LangVersion>Preview</LangVersion>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Platforms\**\*.*" />
<None Include="Platforms\**\*.*" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.Contains('-android'))">
<Compile Include="Platforms\Android\**\*.cs" />
</ItemGroup>
<ItemGroup Condition="!$(TargetFramework.Contains('-android')) and ($(Configuration) == 'Debug' or $(Configuration) == 'Release')">
<Compile Include="Platforms\Windows\**\*.cs" />
</ItemGroup>
<ItemGroup Condition="!$(TargetFramework.Contains('-android')) and $(Configuration.Contains('-Linux'))">
<Compile Include="Platforms\Linux\**\*.cs" />
</ItemGroup>
</Project>
Hello, I hope it is ok to ask in the issue section but I wonder If I still need MSBuild.Sdk.Extras with .net6 coming out pretty soon.
Based on the new MAUI examples I tried to achieve the same with pure SDK style project. So what I did was creating a sample project and added the following lines to it.
This works exactly like I hoped but when I reference the project to a console application for instance I am not able to call the methods. Is there something crucial missing here or is it still not supported? Thanks!