-
Notifications
You must be signed in to change notification settings - Fork 984
Adding a dependency to an external (dotnet) repo
Adam Yoblick edited this page Aug 15, 2019
·
4 revisions
I recently got an error message when building the winforms repo that looked like this:
C:\Program Files (x86)\Microsoft Visual Studio\2019\IntPreview\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(3056,5): error : MSB3822: Non-string resources require the System.Resources.Extensions assembly at runtime, but it was not found in this project's references. [E:\src\repos\github\winforms\src\System.Windows.Forms\src\System.Windows.Forms.csproj]
Here are the steps I did to add this dependency to our repo:
- I added a package reference to System.Resources.Extensions with the version set to a variable that was not yet defined.
<PackageReference Include="System.Resources.Extensions" Version="$(SystemResourcesExtensionsPackageVersion)" />
-
Now I had to find where this package comes from.
- Version.Details.xml contains all the dependencies we consume from other repos, so I started there.
- I saw a bunch of System.* packages that come from corefx so I tried looking there
- Sure enough, I found https://github.com/dotnet/corefx/tree/master/src/System.Resources.Extensions
-
Now I needed a package version
- I noticed that all the other packages we consume from corefx have the same version (currently
4.6.0-preview9.19409.17
), which means it has the same commit Sha.
- I noticed that all the other packages we consume from corefx have the same version (currently
-
I had what I needed, so I added the following to
Version.Details.xml
:
<Dependency Name="System.Resources.Extensions" Version="4.6.0-preview9.19409.17" CoherentParentDependency="Microsoft.NETCore.App">
<Uri>https://github.com/dotnet/corefx</Uri>
<Sha>b82d2bc44424c8a99a1f0fc13202bdfd43e6f9f5</Sha>
</Dependency>
- And I added the following to Versions.props:
<SystemResourcesExtensionsPackageVersion>4.6.0-preview9.19409.17</SystemResourcesExtensionsPackageVersion>
* Note that the Xml element name in Versions.props needs to match the dependency name from Version.Details.xml, with the periods removed, and with “PackageVersion” appended at the end.
- Run
.\build
from the repo root to perform a restore and the package reference will resolve correctly :)
- Dependencies
- ARM64