Skip to content

Commit 71b374d

Browse files
authored
Misc target framework fixes (#50713)
1 parent e5e4503 commit 71b374d

File tree

3 files changed

+24
-8
lines changed

3 files changed

+24
-8
lines changed

Directory.Build.targets

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,9 @@
9797
<!-- Include SourcePackage.editorconfig in all source packages. -->
9898
<Target Name="_AddEditorConfigToSourcePackage">
9999
<ItemGroup>
100-
<TfmSpecificPackageFile Include="$(MSBuildThisFileDirectory)eng\SourcePackage.editorconfig" PackagePath="contentFiles/cs/$(TargetFramework)/.editorconfig" Condition="'$(TargetFrameworkIdentifier)' != '.NETStandard'" />
100+
<TfmSpecificPackageFile Include="$(MSBuildThisFileDirectory)eng\SourcePackage.editorconfig" PackagePath="contentFiles/cs/$(TargetFramework)/.editorconfig" Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'" />
101101
<TfmSpecificPackageFile Include="$(MSBuildThisFileDirectory)eng\SourcePackage.netstandard.editorconfig" PackagePath="contentFiles/cs/$(TargetFramework)/.editorconfig" Condition="'$(TargetFrameworkIdentifier)' == '.NETStandard'" />
102+
<TfmSpecificPackageFile Include="$(MSBuildThisFileDirectory)eng\SourcePackage.netframework.editorconfig" PackagePath="contentFiles/cs/$(TargetFramework)/.editorconfig" Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'" />
102103
</ItemGroup>
103104
</Target>
104105

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Remove the line below if you want to inherit .editorconfig settings from higher directories
2+
root = true
3+
4+
# C# files
5+
[*.cs]
6+
7+
# We don't want any analyzer diagnostics to be reported for people consuming this as a source package.
8+
dotnet_analyzer_diagnostic.severity = none
9+
10+
generated_code = true
11+
12+
# The above configurations don't apply to compiler warnings. Requiring all params to be documented
13+
# is not something we require for this project, so suppressing it directly here.
14+
dotnet_diagnostic.CS1573.severity = none
15+
16+
# As above, we need to specifically disable compiler warnings that we don't want to break downstream
17+
# builds
18+
dotnet_diagnostic.IDE0005.severity = none
19+
20+
# Disable nullability checks when targeting .NET Framework
21+
dotnet_diagnostic.CS8604.severity = none

src/BuiltInTools/dotnet-watch/HotReload/AppModels/HotReloadAppModel.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,7 @@ protected static string GetInjectedAssemblyPath(string targetFramework, string a
1616

1717
public static string GetStartupHookPath(ProjectGraphNode project)
1818
{
19-
var hookTargetFramework = project.GetTargetFramework() switch
20-
{
21-
// Note: Hot Reload is only supported on net6.0+
22-
"net6.0" or "net7.0" or "net8.0" or "net9.0" => "net6.0",
23-
_ => "net10.0",
24-
};
25-
19+
var hookTargetFramework = project.GetTargetFrameworkVersion() is { Major: >= 10 } ? "net10.0" : "net6.0";
2620
return GetInjectedAssemblyPath(hookTargetFramework, "Microsoft.Extensions.DotNetDeltaApplier");
2721
}
2822

0 commit comments

Comments
 (0)