Conversation
|
Will add acceptance tests for this. |
| @@ -0,0 +1,27 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||
| <ItemGroup Condition=" '$(Platform)' == 'x86'"> | |||
There was a problem hiding this comment.
You can check with $(OS) property to selectively drop these exe's, this will also help while fetching testhost path in runtime provider.
| <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
| <Visible>False</Visible> | ||
| </Content> | ||
| <Content Include="$(MSBuildThisFileDirectory)x64\testhost.dll"> |
There was a problem hiding this comment.
MSBuildThisFileDirectory [](start = 24, length = 24)
check for errors/warning because this will try to replace anycpu "testhost.dll"
|
@ViktorHofer You might be interested in taking a look at this. |
| <?xml version="1.0" encoding="utf-8"?> | ||
| <Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
| <ItemGroup Condition=" '$(Platform)' == 'x86' AND '$(OS)' == 'Windows_NT'"> | ||
| <Content Include="$(MSBuildThisFileDirectory)x86\testhost.x86.exe"> |
There was a problem hiding this comment.
How is the testhost.dll copied over into the output directory today, without this change? Does this really need to be copied to the output directory when on .NET Core with deps.json support? Can't it just be invoked from the nuget package cache and copied over only when doing a dotnet publish? That should be the default afaik.
There was a problem hiding this comment.
You are right, testhost.dll today does not get copied, and we rely on the deps file for references.
We can't keep new binaries in the lib folder, they need to go into the build folder, reason being all the things in lib get referenced and better be AnyCPU.
Now I can device a logic to find the testhost.dll from the nuget cache and then walk out to build folder to find the appropriate executable, but then this won't work for dotnet publish. Is there a way to conditionally copy only during publish ?
Also we felt keeping this logic consistent made sense.
Do you see any issues in the current approach ?
There was a problem hiding this comment.
We can't keep new binaries in the lib folder, they need to go into the build folder, reason being all the things in lib get referenced and better be AnyCPU.
Why not put it into tools? We do the same for some other tools. Assembly there won't be referenced by the compiler.
Do you see any issues in the current approach ?
Mainly that the assembly will always be copied over. If there's a way to avoid that I would definitely prefer that.
Now I can device a logic to find the testhost.dll from the nuget cache and then walk out to build folder to find the appropriate executable, but then this won't work for dotnet publish. Is there a way to conditionally copy only during publish ?
Yes you can hook into the ResolvedFileToPublish item:
<ItemGroup>
<ResolvedFileToPublish Include="C:\Users\vihofer\.nuget\packages\microsoft.testplatform.testhost\16.2.0\lib\uap10.0\testhost.dll" RelativePath="testhost.x86.dll" CopyToPublishDirectory="PreserveNewest" />
</ItemGroup>
| @@ -0,0 +1,27 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||
| <ItemGroup Condition=" '$(Platform)' == 'x86' AND '$(OS)' == 'Windows_NT'"> | |||
There was a problem hiding this comment.
Why is testhost.x86.exe copied only in case if Platform set to x86? dotnet publish prepare output that can be executed with dotnet vstest, which will get Platfrom parameter at runtime. If both testhost will be in output folder, it will be able to run test with appropriate bitness. Should separate bug for it be created?
There was a problem hiding this comment.
Looks like it is last thing to allow resolve #1128, so I've mentioned it there with new comment instead of creating new issue.
Description
Using the apphost sdk feature to enable the x86 support for .Net core projects.
Related issue
#1128
#2101