I'm currently crawling through a lot of csproj files, and one thing kinda confuses me. Sometimes PackageReference entries fit on one line, like this:
<PackageReference Include="DocuWare.ServerConfig" Version="10.2.0" />
While some others look like this:
<PackageReference Include="DocuWare.MessageBus.Core">
<Version>12.3.3</Version>
</PackageReference>
Is there any meaningful difference? When I try to automatically maniplate them via Microsoft.Build.Evaluation.Project (an Object representation of a csproj file, the first version results in a failure to read the file, but according to the project's devs they all build flawlessly. Is there any downside in converting the 1 line version to the one with a child element for Version?
Both are valid and the same to modern versions of MSBuild.
In MSBuild 15 / Visual Studio 2017, the possibility of specifying item metadata as attributes was added (GitHub Issue).
If you fail to load the project then you are using libraries of older versions of MSBuild, e.g. the fixed 4.0 version that is part of .NET Framework. You can use the newer libraries from NuGet (in addition with Microsoft.Build.Locator to make use of local .NET SDK installations when evaluating projects) - see the upgrade guide for existing applications.