Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reference (not using) windows forms in cross platform class library or application. #1959

Closed
baehny opened this issue Sep 24, 2019 · 2 comments
Labels
tracking-external-issue An issue is caused by an external system and won't be fixed in this repo won't fix: by design Behaviour is by design

Comments

@baehny
Copy link

baehny commented Sep 24, 2019

Hi,
I am working on a cross platform application that uses windows forms on windows.
So my csproj contains the following lines:

<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
  <PropertyGroup>
    ...
    <UseWindowsForms>true</UseWindowsForms>
    <UseWPF>true</UseWPF>
    ...

The problem with this is that I am now unable to build the application with Visual Studio Mac because of the missing Microsoft.NET.Sdk.WindowsDesktop.
I'm completely aware of the fact that windows forms will not work on other platforms but does this mean I'm forced to setup up multiple projects if the application only uses windows forms on windows but still needs to reference the binaries for the build ?
Using the "Microsoft.NET.Sdk.WindowsDesktop" means that every binary that references windows forms (even without using it) cannot be references in a cross platform application/library.

Is there any recommended way to do this ? Most information only talk about porting windows apps to .net core.

Otherwise I'm now forced to split one application and one class library into 2 applications and 2 class libraries. (with and without windows forms)

@weltkante
Copy link
Contributor

weltkante commented Sep 24, 2019

You cannot build WinForms projects in general on non-Windows because it needs to execute WinForms code during the build (at least once they finish porting licx resources for licensing, which currently is not completed #1462 and dotnet/sdk#3631). There may also be code execution going on with resx resources though I'm not entirely sure of that, might be just in the designer. Building projects which use neither may be theoretically possible but I its currently not planned to support this (in the 3.x time frame, see dotnet/installer#2088)

Relevant issues where this is discussed: #971, #947, dotnet/installer#2088 - this issue can probably be resolved as duplicate

@RussKie RussKie added won't fix: by design Behaviour is by design tracking-external-issue An issue is caused by an external system and won't be fixed in this repo labels Sep 26, 2019
@RussKie
Copy link
Member

RussKie commented Sep 26, 2019

Please follow the issues referenced above.
It is for the most part outside our control.

@RussKie RussKie closed this as completed Sep 26, 2019
@ghost ghost locked as resolved and limited conversation to collaborators Feb 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
tracking-external-issue An issue is caused by an external system and won't be fixed in this repo won't fix: by design Behaviour is by design
Projects
None yet
Development

No branches or pull requests

3 participants