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

don't unnecessarily require windows app ref package #11540

Merged
merged 1 commit into from
Feb 11, 2025

Conversation

brettfo
Copy link
Contributor

@brettfo brettfo commented Feb 11, 2025

A private package source might not contain the Microsoft.Windows.App.Ref package so only set EnbleWindowsTargeting when the TFM explicitly contains the string -windows.

@github-actions github-actions bot added the L: dotnet:nuget NuGet packages via nuget or dotnet label Feb 11, 2025
@brettfo brettfo force-pushed the dev/brettfo/nuget-without-windows-package branch from 4f53c1d to d7adcb6 Compare February 11, 2025 16:08
@@ -2,7 +2,7 @@
<!-- The following properties enable target framework and dependency discovery when OS-specific workloads are required -->
<PropertyGroup>
<DesignTimeBuild>true</DesignTimeBuild>
<EnableWindowsTargeting>true</EnableWindowsTargeting>
<EnableWindowsTargeting Condition="$(TargetFramework.Contains('-windows'))">true</EnableWindowsTargeting>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is the core of the fix

@@ -784,11 +784,11 @@ internal static async Task<ImmutableArray<string>> GetTargetFrameworkValuesFromP
var targetsHelperPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, "TargetFrameworkReporter.targets");
var (exitCode, stdOut, stdErr) = await ProcessEx.RunDotnetWithoutMSBuildEnvironmentVariablesAsync(
[
"build",
"msbuild",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this does a much simpler msbuild evaluation

if (framework.Framework == "_")
{
// error/default value
return null;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

with the simpler msbuild eval, we need to explicitly handle an edge case

@brettfo brettfo force-pushed the dev/brettfo/nuget-without-windows-package branch from d7adcb6 to 57fb8c0 Compare February 11, 2025 16:15
@brettfo brettfo marked this pull request as ready for review February 11, 2025 16:52
@brettfo brettfo requested a review from a team as a code owner February 11, 2025 16:52
@sachin-sandhu sachin-sandhu force-pushed the dev/brettfo/nuget-without-windows-package branch from 57fb8c0 to 57cde45 Compare February 11, 2025 19:05
@sachin-sandhu sachin-sandhu merged commit 875f9c1 into main Feb 11, 2025
73 checks passed
@sachin-sandhu sachin-sandhu deleted the dev/brettfo/nuget-without-windows-package branch February 11, 2025 20:15
robaiken added a commit that referenced this pull request Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L: dotnet:nuget NuGet packages via nuget or dotnet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants