-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Replace hardcoded backslashes with Path.DirectorySeparatorChar and fix WinFX casing (daviddenis-stx, Nirmal4G, PaulEremeeff) #3101
Conversation
'WinFX' is the correct casing as observed in the .NET CLR 2 frameworks
In project files, scripts, comments, etc... But not in sources (like GetWinFxCallback)
I highly recommend taking a look at this patch by @daviddenis-stx and integrating some of the changes related to path-separator chars into this PR: https://github.com/systemathics/wpf/commit/a9b28ed2998f13ee3c9bce37f405ff820cf43b08 |
Thanks, @vatsan-madhavan. I wasn't aware of @daviddenis-stx's change. |
I will be testing this today and tomorrow. Thanks. |
@@ -50,7 +50,7 @@ internal sealed class MarkupCompiler | |||
public string TargetPath | |||
{ | |||
get { return _targetPath; } | |||
set { _targetPath = value; } | |||
set { _targetPath = value;} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Format issues
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -712,7 +712,7 @@ private SourceFileInfo OnSourceFileResolve(FileUnit file) | |||
if (sourceFileInfo.IsXamlFile) | |||
{ | |||
int fileExtIndex = file.Path.LastIndexOf(DOT, StringComparison.Ordinal); | |||
|
|||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra space
int pathEndIndex = fullFilePath.LastIndexOf("\\", StringComparison.Ordinal); | ||
|
||
int pathEndIndex = fullFilePath.LastIndexOf(string.Empty + Path.DirectorySeparatorChar, StringComparison.Ordinal); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra space
@@ -1466,7 +1466,7 @@ private void GenerateOutputItems( ) | |||
|
|||
codeItem = new TaskItem(); | |||
codeItem.ItemSpec = genLangFilePath; | |||
|
|||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra space
With these changes in place, can you now build from within WSL? |
I know this is obvious but I’ll say it just so it doesn’t get forgotten - please don’t accidentally squash the PR 😄 |
Hello all :)
If you read the thread thoroughly you'll find that cross compilation support was found to be something dotnet team wasn't eager to support in the short term (or not at all ?)
The message "Windows is required... " was added after this small commit I made merely to test and see. In my experiments it produced working WPF assemblies but in the thread you'll find that some corner cases were expected to hurt (some of them depending on windows executables handling resx and/or resources if I recollect well). It's probably one of the reasons why the target stops with this message ever since. Otherwise it would potentially have created mangled outputs and the team probably didn't want to add more problems than solutions.
Long story short cross compiling was not broken just because of case sensitivity in targets files.
I still wish cross compilation was supported, in our current CI setup, we build WPF repos using docker on windows with nanoserver 2004 base images, because we have no, other choice. Each and every other repo we have builds in both Ubuntu and Windows containers and overall the time to completion is 2x to 3x longer on Windows for the exact same code ... painful. Also, we cannot run the tests that reach inside WPF parts (view models and stuff) in nano server containers, we even have to use servercore images for that. 5GB nightmare. Docker on Windows is far less efficient than on Linux, alas, the extra time wasting seems to be occurring when docker publishes to layers, you wait 2 minutes after a stage containing a simple "dotnet build" finishes to run (that is, you're not out of trouble when dotnet build returns as a lot of copy operations are occurring between some temp hcs to a windowsfilter sub folder, and it's 33.6 modem old times again... )
Cross compilation please :)
Get Outlook for Android<https://aka.ms/ghei36>
…________________________________
From: Ryland <[email protected]>
Sent: Tuesday, June 9, 2020 7:23:12 PM
To: dotnet/wpf <[email protected]>
Cc: David Denis <[email protected]>; Mention <[email protected]>
Subject: Re: [dotnet/wpf] Replace hardcoded backslashes with Path.DirectorySeparatorChar and fix WinFX casing (daviddenis-stx, Nirmal4G, PaulEremeeff) (#3101)
@vatsan-madhavan<https://github.com/vatsan-madhavan>: It looks like more changes are required for WSL.
/usr/share/dotnet/sdk/5.0.100-preview.4.20258.7/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(59,5): error NETSDK1100: Windows is required to build Windows desktop applications.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#3101 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AMB4IIXSWTODA5MIGF5DGKLRVZ4ZBANCNFSM4NY3KTQA>.
|
Yup, Microsoft.NET.Sdk.FrameworkReferenceResolution.targets has NETSDK1100 error - “Windows is required to build Windows desktop applications”. The existing toolchain will probably work largely fine under cross-compilation - module problems like path-separators etc. Somebody should remove that error and try it to be sure. Any minor fixups needed from there can probably be figured out. Earlier in .NET Core 3.0, there were still pieces of the toolchain that were still msbuild only and hadn’t been ported to ‘dotnet’. IIRC an example was the WinForms ResXFileCodeGenerator. The one thing I’d pay attention to is the BAML generated under cross compilation. I’d suggest comparing it against reference from Windows based builds. |
I don’t recall that part of the history. Would you mind elaborating? |
I meant incomplete or different than what comes out of a Windows build.
In my tests I remember that BAML was not binary identical between Windows build and Linux build, but decompiled to identical XAML with ILSPY. If I remember well, there were some binary values here and there in the binary stream (guids?) that were random (that would be useful to also compare 2 rebuilds from the same platfom to confirm).
We could remove the switch that stops the build when non Windows is detected and try again the same recipe to see where it lands :)
D
Get Outlook for Android<https://aka.ms/ghei36>
…________________________________
From: Vatsan Madhavan <[email protected]>
Sent: Wednesday, June 10, 2020 4:25:33 AM
To: dotnet/wpf <[email protected]>
Cc: David Denis <[email protected]>; Mention <[email protected]>
Subject: Re: [dotnet/wpf] Replace hardcoded backslashes with Path.DirectorySeparatorChar and fix WinFX casing (daviddenis-stx, Nirmal4G, PaulEremeeff) (#3101)
Otherwise it would potentially have created mangled outputs
I don’t recall that part of the history. Would you mind elaborating?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#3101 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AMB4IITLNR4FZUZ7OQ44HUTRV34K3ANCNFSM4NY3KTQA>.
|
I think we would like to support it. There are probably a variety of things that would need to be fixed, not all of which we may be aware of, but this fix looks like a step in the right direction. |
@dsplaisted are you planning on removing NETSDK1100 from the sdk targets? |
We'd like to remove it eventually. It's there right now because we wanted to avoid shipping the targeting packs (or downloading them during restore) for non-Windows versions of the SDK. When we support optional SDK workloads we could have the Windows support be a workload and remove the error. |
Also FYI you can suppress the NETSDK1100 error with something like this: <ItemGroup>
<FrameworkReference Update="@(FrameworkReference)" IsWindowsOnly="false" />
</ItemGroup> |
You should consider making it so that cross-compilation can be tried out more easily than that (for e.g., a propertygroup that can be set in commandline). |
@ryalanms @vatsan-madhavan Will this be back ported into 3.1 as it is an LTS release? Ref: dotnet/sdk#11108 |
No idea what the team would choose to do but I wouldn't recommend porting it back to 3.1. This is a developer experience improvement, and "LTS" is a runtime quality/maintenance concept. NET 5 SDK can be used to target 3.1 runtime IIRC, and developers needing this fix could adopt a newer SDK. Besides, this hasn't been an adoption blocker for 3.1 in general. |
Anyway, it's definitely disappointing that we are still unable to use |
This includes @daviddenis-stx's Path.DirectorySeparatorChar fixes and the first two commits from @Nirmal4G and @PaulEremeeff to fix WinFX casing. (Thank you!)
The issue is described in more detail in PRs #2877 and #2975.