Skip to content

Commit ae9d526

Browse files
committed
Updates from review comments
1 parent ed16a04 commit ae9d526

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

src/referencePackageSourceGenerator/ReferencePackageProjectTemplate.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<OutputPath>$(ArtifactsBinDir)$$RelativePath$$/ref/</OutputPath>
1010
<IntermediateOutputPath>$(ArtifactsObjDir)$$RelativePath$$</IntermediateOutputPath>
1111
</PropertyGroup>
12-
$$PropertiesByTfm$$ <ItemGroup>
12+
$$TfmSpecificProperties$$ <ItemGroup>
1313
<Compile Include="**/ref/$(TargetFramework)/*.cs" />
1414
<Compile Include="**/lib/$(TargetFramework)/*.cs" />
1515
</ItemGroup>

src/referencePackageSourceGenerator/ReferencePackageSourceGenerator.proj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
<PackagesTargetDirectory>$(RepoRoot)src\referencePackages\src\</PackagesTargetDirectory>
88
<!-- The following target frameworks aren't buildable with the current SDK and as they don't contribute to the set of
99
source build target verticals, can be safely excluded. -->
10-
<ExcludeTargetFrameworks>netcoreapp3.1;netcore50;net463;portable-*;xamarin*;monotouch*;monoandroid*;win8;wp8;wpa81</ExcludeTargetFrameworks>
10+
<ExcludeTargetFrameworks>netcore50;net463;portable-*;xamarin*;monotouch*;monoandroid*;win8;wp8;wpa81</ExcludeTargetFrameworks>
11+
<!-- The following target frameworks should be excluded even though they are supported by the current SDK because there is no need to have them.
12+
Only exclude them when target frameworks to include aren't provided. -->
13+
<ExcludeTargetFrameworks Condition="'$(IncludeTargetFrameworks)' == ''">$(ExcludeTargetFrameworks);netcoreapp3.1</ExcludeTargetFrameworks>
1114
</PropertyGroup>
1215

1316
<PropertyGroup Condition="'$(PackageName)' != '' and '$(PackageVersion)' != ''">

src/referencePackageSourceGenerator/ReferencePackageSourceTask/GenerateProject.cs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public override bool Execute()
4040
string projectTemplateContent = File.ReadAllText(ProjectTemplate);
4141
string pkgProjectOutput = projectTemplateContent;
4242
string packageReferenceIncludes = "\n";
43-
string propertiesByTfm = "\n";
43+
string tfmSpecificProperties = "\n";
4444

4545
// Make sure that we always use the same directory separator.
4646
string relativePath = Path.GetRelativePath(BaseTargetPath, Path.GetDirectoryName(TargetPath)).Replace('\\', '/');
@@ -55,7 +55,7 @@ public override bool Execute()
5555
string packageReferences = "";
5656
string netStandardTag = "NETStandardImplicitPackageVersion";
5757

58-
if (targetFramework == "netstandard2.0" && !includesNetStandard21 && !includesNetCoreApp30)
58+
if (targetFramework == "netstandard2.0")
5959
{
6060
packageReferences += $" <PackageReference Include=\"NETStandard.Library\" Version=\"$({netStandardTag})\" />\n";
6161
}
@@ -135,19 +135,18 @@ public override bool Execute()
135135
}
136136
}
137137

138-
propertiesByTfm += $" <PropertyGroup Condition=\" '$(TargetFramework)' == '{targetFramework}' \">\n";
138+
tfmSpecificProperties += $" <PropertyGroup Condition=\" '$(TargetFramework)' == '{targetFramework}' \">\n";
139139
if (subPath == "lib")
140140
{
141-
propertiesByTfm += $" <OutputPath>$(ArtifactsBinDir){relativePath}/{subPath}/</OutputPath>\n";
141+
tfmSpecificProperties += $" <OutputPath>$(ArtifactsBinDir){relativePath}/{subPath}/</OutputPath>\n";
142142
}
143-
if (targetFramework == "netstandard2.0" ||
144-
targetFramework == "netstandard2.1" ||
143+
if (targetFramework == "netstandard2.1" ||
145144
targetFramework == "netcoreapp3.0" ||
146145
targetFramework == "net6.0")
147146
{
148-
propertiesByTfm += " <DisableImplicitFrameworkReferences>false</DisableImplicitFrameworkReferences>\n";
147+
tfmSpecificProperties += " <DisableImplicitFrameworkReferences>false</DisableImplicitFrameworkReferences>\n";
149148
}
150-
propertiesByTfm += $" </PropertyGroup>\n\n";
149+
tfmSpecificProperties += $" </PropertyGroup>\n\n";
151150
}
152151

153152
// If necessary, write the strong name key into the project file.
@@ -159,7 +158,7 @@ public override bool Execute()
159158
}
160159

161160
pkgProjectOutput = pkgProjectOutput.Replace("$$LowerCaseFileName$$", PackageId.ToLowerInvariant());
162-
pkgProjectOutput = pkgProjectOutput.Replace("$$PropertiesByTfm$$", propertiesByTfm);
161+
pkgProjectOutput = pkgProjectOutput.Replace("$$TfmSpecificProperties$$", tfmSpecificProperties);
163162
pkgProjectOutput = pkgProjectOutput.Replace("$$RelativePath$$", relativePath);
164163
pkgProjectOutput = pkgProjectOutput.Replace("$$PackageReferences$$", packageReferenceIncludes);
165164
pkgProjectOutput = pkgProjectOutput.Replace("$$TargetFrameworks$$", string.Join(';', orderedTargetFrameworks));

0 commit comments

Comments
 (0)