Skip to content

Commit 3b155a1

Browse files
authored
[10.0.1xx] Disable static graph restore for file-based apps (#50532)
1 parent 27d10fd commit 3b155a1

16 files changed

+153
-29
lines changed

src/Cli/dotnet/Commands/CliCommandStrings.resx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1601,7 +1601,11 @@ Tool '{1}' (version '{2}') was successfully installed. Entry is added to the man
16011601
</data>
16021602
<data name="PropertyDirectiveMissingParts" xml:space="preserve">
16031603
<value>The property directive needs to have two parts separated by '=' like '#:property PropertyName=PropertyValue': {0}</value>
1604-
<comment>{0} is the file path and line number.</comment>
1604+
<comment>{0} is the file path and line number.{Locked="#:property"}</comment>
1605+
</data>
1606+
<data name="StaticGraphRestoreNotSupported" xml:space="preserve">
1607+
<value>Static graph restore is not supported for file-based apps. Remove the '#:property' at {0}.</value>
1608+
<comment>{0} is the file path and line number.{Locked="#:property"}</comment>
16051609
</data>
16061610
<data name="InvalidDirectiveName" xml:space="preserve">
16071611
<value>The directive at '{2}' should contain a name without special characters and an optional value separated by '{1}' like '#:{0} Name{1}Value'.</value>
@@ -2641,4 +2645,4 @@ Proceed?</value>
26412645
<data name="PackCmdVersion" xml:space="preserve">
26422646
<value>VERSION</value>
26432647
</data>
2644-
</root>
2648+
</root>

src/Cli/dotnet/Commands/Run/VirtualProjectBuildingCommand.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -943,6 +943,7 @@ public static void WriteProjectFile(
943943
writer.WriteLine("""
944944
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
945945
<DisableDefaultItemsInProjectFolder>true</DisableDefaultItemsInProjectFolder>
946+
<RestoreUseStaticGraphEvaluation>false</RestoreUseStaticGraphEvaluation>
946947
""");
947948
}
948949

@@ -1480,7 +1481,7 @@ public sealed class Property(in ParseInfo info) : Named(info)
14801481

14811482
if (propertyValue is null)
14821483
{
1483-
return context.Diagnostics.AddError<Property?>(context.SourceFile, context.Info.Span, location => string.Format(CliCommandStrings.PropertyDirectiveMissingParts, location));
1484+
return context.Diagnostics.AddError<Property?>(context.SourceFile, context.Info.Span, static location => string.Format(CliCommandStrings.PropertyDirectiveMissingParts, location));
14841485
}
14851486

14861487
try
@@ -1492,6 +1493,12 @@ public sealed class Property(in ParseInfo info) : Named(info)
14921493
return context.Diagnostics.AddError<Property?>(context.SourceFile, context.Info.Span, location => string.Format(CliCommandStrings.PropertyDirectiveInvalidName, location, ex.Message), ex);
14931494
}
14941495

1496+
if (propertyName.Equals("RestoreUseStaticGraphEvaluation", StringComparison.OrdinalIgnoreCase) &&
1497+
MSBuildUtilities.ConvertStringToBool(propertyValue))
1498+
{
1499+
context.Diagnostics.AddError(context.SourceFile, context.Info.Span, static location => string.Format(CliCommandStrings.StaticGraphRestoreNotSupported, location));
1500+
}
1501+
14951502
return new Property(context.Info)
14961503
{
14971504
Name = propertyName,

src/Cli/dotnet/Commands/xlf/CliCommandStrings.cs.xlf

Lines changed: 7 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Cli/dotnet/Commands/xlf/CliCommandStrings.de.xlf

Lines changed: 7 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Cli/dotnet/Commands/xlf/CliCommandStrings.es.xlf

Lines changed: 7 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Cli/dotnet/Commands/xlf/CliCommandStrings.fr.xlf

Lines changed: 7 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Cli/dotnet/Commands/xlf/CliCommandStrings.it.xlf

Lines changed: 7 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Cli/dotnet/Commands/xlf/CliCommandStrings.ja.xlf

Lines changed: 7 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Cli/dotnet/Commands/xlf/CliCommandStrings.ko.xlf

Lines changed: 7 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Cli/dotnet/Commands/xlf/CliCommandStrings.pl.xlf

Lines changed: 7 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)