Closed Barsonax closed 4 years ago
You can use netframework as target in a net sdk style project however stuff like WPF, winforms, web applications etc are not supported yet.
Since duality is using winforms this is a bit of a bummer. However what we can do for now is upgrade all projects that do not require winforms.
Maybe when .NET core 3.0 is out winform support in sdk style projects (for netframework) will be there too.
Seems there are some more issues. Getting some failing unit tests when I changed DualityTests to be a net sdk style project. Branch can be found here: https://github.com/Barsonax/duality/tree/feature/sdkcsprojs
We should first investigate this further before proceeding. We ran into these issues earlier but now we have a isolated branch with just the sdk style change it might be easier to find out whats going wrong here.
Debugging the code both before and after this change resulted in this difference for the RenderRedSquare
test:
Sdk style project:
Old style project:
Might have forgotten something when changing the csproj I think.
I think I got it figured out. Net sdk style projects output to a framework specific folder. In this case it would put the test dll in a net472 folder. When running the tests it will run in the context of this net472 folder and will only load plugins that are also in this folder.
The tests have some implicit dependencies on certain duality plugins so they now break.
This behavior can luckily be disabled by setting a property in the csproj. However iam not sure if we want such implicit dependencies though that might be a discussion for a different issue.
Might also be solved if we migrate all projects since they should all end up in a framework specific folder.
EDIT: solved it by adding in <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
to the csproj. This is only needed while we still have a mix of old and new style csprojs.
We could also simply add tests that test if we are running the correct backends and not some dummy graphic backend. The tests assume this but its currently not clear.
Easy way to add the required entries for resx files in a net sdk csproj:
<Compile Update="**\*.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>$([System.String]::Copy('%(FileName)').Replace('.Designer', '.resx'))</DependentUpon>
</Compile>
<EmbeddedResource Update="**\*.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>$([System.String]::Copy('%(FileName)')).Designer.cs</LastGenOutput>
</EmbeddedResource>
Summary
This is already a requirement for netstandard but we also have netframework projects that we could migrate to .NET sdk style projects. This is not strictly required but might still be preferable.
Analysis
dotnet pack
)