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

Replace hardcoded backslashes with Path.DirectorySeparatorChar and fix WinFX casing (daviddenis-stx, Nirmal4G, PaulEremeeff) #3101

Merged
merged 4 commits into from
Jun 10, 2020

Conversation

ryalanms
Copy link
Member

@ryalanms ryalanms commented Jun 8, 2020

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.

'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)
@ryalanms ryalanms requested a review from a team as a code owner June 8, 2020 23:29
@ghost ghost added the PR metadata: Label to tag PRs, to facilitate with triage label Jun 8, 2020
@ghost ghost requested a review from fabiant3 June 8, 2020 23:29
@vatsan-madhavan
Copy link
Member

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

@ryalanms
Copy link
Member Author

ryalanms commented Jun 8, 2020

Thanks, @vatsan-madhavan. I wasn't aware of @daviddenis-stx's change.

@ryalanms ryalanms changed the title Fix casing for Microsoft.WinFx.targets. (Nirmal4G, PaulEremeeff) Enable building WPF from Unix (daviddenis-stx, Nirmal4G, PaulEremeeff) Jun 8, 2020
@ryalanms ryalanms changed the title Enable building WPF from Unix (daviddenis-stx, Nirmal4G, PaulEremeeff) Replace hardcoded backslashes with Path.DirectorySeparatorChar and fix WinFX casing (daviddenis-stx, Nirmal4G, PaulEremeeff) Jun 9, 2020
@ryalanms
Copy link
Member Author

ryalanms commented Jun 9, 2020

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;}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Format issues

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lindexi: Thank you again for the review. These formatting changes will be taken care of with the other half of @Nirmal4G's PR. Thanks.

@@ -712,7 +712,7 @@ private SourceFileInfo OnSourceFileResolve(FileUnit file)
if (sourceFileInfo.IsXamlFile)
{
int fileExtIndex = file.Path.LastIndexOf(DOT, StringComparison.Ordinal);

Copy link
Member

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);
Copy link
Member

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;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra space

@vatsan-madhavan
Copy link
Member

vatsan-madhavan commented Jun 9, 2020

With these changes in place, can you now build from within WSL?

@vatsan-madhavan
Copy link
Member

I know this is obvious but I’ll say it just so it doesn’t get forgotten - please don’t accidentally squash the PR 😄

@daviddenis-stx
Copy link
Contributor

daviddenis-stx commented Jun 9, 2020 via email

@vatsan-madhavan
Copy link
Member

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.

@vatsan-madhavan
Copy link
Member

Otherwise it would potentially have created mangled outputs

I don’t recall that part of the history. Would you mind elaborating?

@daviddenis-stx
Copy link
Contributor

daviddenis-stx commented Jun 10, 2020 via email

@dsplaisted
Copy link
Member

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 ?)

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.

@ryalanms ryalanms merged commit 734be70 into master Jun 10, 2020
@vatsan-madhavan
Copy link
Member

@dsplaisted are you planning on removing NETSDK1100 from the sdk targets?

@dsplaisted
Copy link
Member

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.

@ryalanms ryalanms deleted the Nirmal4g/WinFXFix branch June 10, 2020 23:07
@dsplaisted
Copy link
Member

Also FYI you can suppress the NETSDK1100 error with something like this:

<ItemGroup>
  <FrameworkReference Update="@(FrameworkReference)" IsWindowsOnly="false" />
</ItemGroup>

@vatsan-madhavan
Copy link
Member

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).

@Nirmal4G
Copy link
Contributor

Nirmal4G commented Aug 6, 2020

@ryalanms @vatsan-madhavan Will this be back ported into 3.1 as it is an LTS release?

Ref: dotnet/sdk#11108

@vatsan-madhavan
Copy link
Member

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.

@worldbeater
Copy link

worldbeater commented Aug 18, 2020

Anyway, it's definitely disappointing that we are still unable to use MSBuild.Sdk.Extras with .NET Core 3.1 due to the issue which was fixed with this PR. The good news is, however, that a workaround suggested by Jerome finally made using MSBuild.Sdk.Extras possible on Linux, even with .NET Core 3.1.

@ghost ghost locked as resolved and limited conversation to collaborators Apr 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
PR metadata: Label to tag PRs, to facilitate with triage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants