-
Notifications
You must be signed in to change notification settings - Fork 63
[param-name-importer] Update to latest SgmlReader NuGet which supports netstandard2.0. #656
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
Conversation
…s netstandard2.0.
| <!-- Not sure why needed, but only System.IO.Compression.FileSystem.dll is | ||
| included by default, and ZipArchive is type forwarded to System.IO.Compression --> | ||
| <Reference Include="System.IO.Compression" /> | ||
| <Reference Include="System.IO.Compression" Condition="'$(TargetFramework)' == 'net472'" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I half wonder if this shouldn't instead be $(TargetFramework.StartsWith('net4')), to "reasonably" support .NET Framework 4.8…
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed!
| <!-- This package erroneously contains /netcoreapp3.1/SgmlReader.exe and /netcoreapp3.1/SgmlReaderDll.dll. | ||
| We are going to use a package reference to download the nuget, and a regular reference to actually | ||
| reference the correct assembly. --> | ||
| <PackageReference Include="Microsoft.Xml.SgmlReader" Version="1.8.16" ExcludeAssets="Compile" GeneratePathProperty="true" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does @(PackageReference) supports %(ReferenceOutputAssembly) metadata, e.g.
<PackageReference Include="Microsoft.Xml.SgmlReader" Version="1.8.16" ExcludeAssets="Compile" GeneratePathProperty="true" ReferenceOutputAssembly="false" />If it does, that might make it clearer that the @(PackageReference) is present only for download purposes, and not for csc /reference purposes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think %(ReferenceOutputAssembly) is only supported on @(ProjectReference). NuGet packages have no concept of output assemblies, they're just a zip of files in magic directories. The ExcludeAssets="Compile" is what is telling MSBuild not to use the contents for csc.
| reference the correct assembly. --> | ||
| <PackageReference Include="Microsoft.Xml.SgmlReader" Version="1.8.16" ExcludeAssets="Compile" GeneratePathProperty="true" /> | ||
| <Reference Include="SgmlReader"> | ||
| <HintPath>$(PkgMicrosoft_Xml_SgmlReader)\lib\netstandard2.0\SgmlReaderDll.dll</HintPath> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where does $(PkgMicrosoft_Xml_SgmlReader) come from? Is this a "NuGet-ism"? I don't see anything with this string in the current NuGet package that's used (the one prior to this PR).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It comes from GeneratePathProperty="true". This tells MSBuild/NuGet to create a magic property containing the path where it put the package. Without this we can't know where the package is, as the packages folder can be moved in NuGet.config.
There is an issue with the new NuGet in that the
lib/netcoreapp3.1directory contains bothSgmlReader.exeandSgmlReaderDll.dlland thenetcoreapp3.1version ofparam-name-importertries to take the.exe.Worked around this by using the
<PackageReference>to download the NuGet but not reference any assembly. Then we add a<Reference>to the correct.dlland use it. (We usenetstandard2.0because both frameworks can use it,netcoreapp3.1shouldn't even exist in the package.)Additionally added a
net4*Conditionto the reference toSystem.IO.Compressionto fix this warning:The reference only appears to be needed on
net472, notnetcoreapp3.1.