-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
Description
System information
- OS version/distro: Windows
- .NET Version (eg., dotnet --info): .NET Framework 4.7.1
Issue
- What did you do?
Create an "old style" .csproj using packages.config and added Microsoft.ML nuget package and built.
When creating the project, if you uncheck the "Create directory for solution" checkbox, then the .sln and .csproj are in the same folder. When you restore NuGet packages, the nuget files get put in a packages folder in the same folder as the .csproj.
- What happened?
The native assemblies (CpuMathNative, FastTreeNative, LdaNative, etc) were all copied into subdirectories of my output path instead of directly in my output path.
From looking at a binlog of the build, it appears that the AssignTargetPath is getting confused at our Content items since they appear to be part of the project (since they are under the same folder as the .csproj).
- What did you expect?
The native assemblies should be copied directly to the output folder.
Note
To fix this, we should put the <Link> metadata on our content items:
machinelearning/pkg/common/CommonPackage.props
Lines 10 to 20 in 14c7a47
| <Content Include="$(MSBuildThisFileDirectory)\..\..\runtimes\win-x64\native\*.dll" | |
| Condition="'$(PlatformTarget)' == 'x64'"> | |
| <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |
| <Visible>false</Visible> | |
| </Content> | |
| <Content Include="$(MSBuildThisFileDirectory)\..\..\runtimes\win-x86\native\*.dll" | |
| Condition="'$(PlatformTarget)' == 'x86'"> | |
| <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |
| <Visible>false</Visible> | |
| </Content> | |
| </ItemGroup> |
See
- Microsoft.DiaSymReader.Native.x86.dll ends up in nuget package roslyn#15137 (comment)
- Add build targets and props file for legacy csharp project support microsoft/onnxruntime#127 (comment)
For other places that had this same bug.