System.Windows.Forms in 3.0-preview7When upgrading from 3.0 preview6 to 3.0-preview7 I get stuck with:
Error CS0234 The type or namespace name 'Forms' does not exist in the namespace 'System.Windows' (are you missing an assembly reference?)
I realised that the error was coming from the version of dotnet Core after uninstalling ALL available SDKs but the 3.0-preview6 version. I then executed dotnet --version and realised it was still using 3.0-preview7 which made no sense.
This makes me think the uninstaller must also be broken.
There a few ref that's not being added to the SDK package with Preview 7. Even though the files do exist in the SDK folder, It looks like the manifest file is creating the issue. It went from 50 in Preview 6 to 40 in Preview 7.
System.Drawing is another one not Showing up as Comment in following Thread: https://github.com/dotnet/core/issues/3090 .
You can add the file in manually for the time being, until it gets fixed or see if nightly build has the fix.
@Revan654 How is this issue related to my issue? I'm very curious. My issue is specifically about loading assemblies at runtime and the resolver not finding one of the assembly's dependencies.
@Revan654 I have since closed my issue as I discovered a race condition in my code. I am running into a separate issue now, but it's hard to tell if it's related to your issue:
An exception occurred (System.PlatformNotSupportedException) retrieving system information: System.Management currently is only supported for Windows desktop applications.
Hey, I think you were trying to reference https://github.com/dotnet/core/issues/3086.
For now I will stick on 3.0-preview6 until a more complete release is published.
@nathan-alden-hp Copy function grabbed the wrong link. Not sure why FireFox copy function breaks at times.
@cadesalaberry Yes, that would be the correct link.
Seems going have to wait for Preview 8. It looks like MS is behind with there Releases. We were suppose to be getting RC Build this month, so far nothing.
There are other internal functions that don't work correctly as well. This is the risk we take with Preview Builds.
Do you have a <UseWindowsForms>true</UseWindowsForms> in the project file?
@cadesalaberry can you please post the content of your csproj file?
Seems going have to wait for Preview 8.
P8 is yet to be cut, so it won't be released for another month or so.
It looks like MS is behind with there Releases. We were suppose to be getting RC Build this month, so far nothing.
As far as our schedule goes, we're on track with our releases.
Here is my .csproj. I am not <UseWindowsForms>true</UseWindowsForms> as I haven't seen it documented anywhere. I will give it a try.
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.0</TargetFramework>
<UseWPF>true</UseWPF>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>icon.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<None Remove="icon.ico" />
<None Remove="stylecop.json" />
</ItemGroup>
<ItemGroup>
<AdditionalFiles Include="stylecop.json" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Autoupdater.NET.Official" Version="1.5.4" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="System.Json" Version="4.5.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Autoupdater.NET.Official" Version="1.5.4" />
<PackageReference Include="System.Json" Version="4.5.0" />
</ItemGroup>
<ItemGroup>
<Resource Include="icon.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
</ItemGroup>
<ItemGroup>
<PackageReference Include="GitVersionTask" Version="5.0.0-beta5.50">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
</Project>
The build is now successful, I was missing the < UseWindowsForms > option which was not mandatory in preview6 to make it all work.
Thanks for the help !
<UseWPF>true</UseWPF>
Your project was targeting WPF stack.
To target WinForms (or more officially Windows Forms) you need to use <UseWindowsForms>true</UseWindowsForms> as @weltkante suggested.
AFAIK you can target both stacks simultaneously too, e.g. use both switches:
<UseWindowsForms>true</UseWindowsForms>
<UseWPF>true</UseWPF>
Yes, I ended up using both simultaneously.
Thanks for your suggestions !