Vstest: Cannot publish --self-contained test projects

Created on 26 Jan 2019  路  3Comments  路  Source: microsoft/vstest

Description

When trying to publish a dotnet core 2.2 project combined with using the package "Microsoft.NET.Test.Sdk" Version="15.9.0" the publish of the self-contained project fails.

See the repo i have made for reproduction

https://github.com/Rotvig/Publish.SelfContained.NetCore.2.2

Steps to reproduce

Use package "PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0""
Run command "dotnet publish -c release -r win10-x64 --self-contained"

Expected behavior

I expected a self-contained application

Actual behavior

Getting error "C:\Program Files\dotnet\sdk\2.2.103\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.RuntimeIdentifierInference.targets(122,5): error NETSDK1067: Self-contained applications are required to use the application host. Either set SelfContained to false or set UseAppHost to true. [C:\Users\rener\OneDrive\Desktop\Publish.Test\Publish.Test\Publish.Test.csproj]"

Diagnostic logs

Please share test platform diagnostics logs. Instructions to collect logs are here.
The logs may contain test assembly paths, kindly review and mask those before sharing.

Environment

Dotnet Core SDK 2.2.103 to publish
Operating system Windows 10

dotnet-cli

Most helpful comment

@Rotvig the parameter UseAppHost must be set to true when using --self-contained
dotnet publish -c release -r win10-x64 --self-contained true /p:useapphost=true should work for you

All 3 comments

@Rotvig the parameter UseAppHost must be set to true when using --self-contained
dotnet publish -c release -r win10-x64 --self-contained true /p:useapphost=true should work for you

it works thanks !

But shouldn't /p:useapphost be set to true by default when --self-contained is set to true ?

it works thanks !

But shouldn't /p:useapphost be set to true by default when --self-contained is set to true ?

Seems fair, maybe you could take it up with the dotnet repo

Was this page helpful?
0 / 5 - 0 ratings