SDK doesnt publish exes correctly when used as a project reference
See original GitHub issueOften a group of exes need to be built and deployed together. This is common in applications like Roslyn where we ship several exes as a single unit: csc, vbc and VBCSCompiler.
Rather than building each project separately and then copying the outputs together we create deployment projects. Essentially dummy exes projects that just reference all of the exes that we need via project reference elements
<ProjectReference Include="..\..\src\Compilers\CSharp\csc\csc.csproj" />
<ProjectReference Include="..\..\src\Compilers\VisualBasic\vbc\vbc.csproj" />
<ProjectReference Include="..\..\src\Compilers\Server\VBCSCompiler\VBCSCompiler.csproj" />
This approach works fine in desktop MSBuild as it will correctly deploy all of the runtime assets. The same approach does not work on SDK projects though as the publish step fails to include critical files like deps.json and runtimeconfig.json. That completely breaks this approach.
If this isn’t meant to be supported by SDK that would be unfortunate but understandable. I would expect an error though positively asserting that this case is not supported. Today everything builds and publishes without error but the output is completely unusable.
Repo:
Clone https://github.com/jaredpar/roslyn and checkout the branch repro/group-exe. Then run the following commands:
> dotnet restore build/ToolsetPackages/BaseToolset.csproj
> dotnet restore build/ToolsetPackages/CoreToolset.csproj
> dotnet restore build/Toolset/CoreToolset.csproj
> dotnet publish -o ${HOME}/temp/test --framework netcoreapp2.0 build/Toolset/CoreToolset.csproj
The directory ${HOME}/temp/test
should contain the deps.json / runtimeconfig.json for csc, vbc and VBCSCompiler but it does not. That means the output of publish is unusable.
CC @khyperia
Issue Analytics
- State:
- Created 6 years ago
- Reactions:25
- Comments:35 (20 by maintainers)
Top GitHub Comments
OK the reason why the proposed workaround doesn’t work in your repro is because you don’t have any other content items in the lib that are copied over. Please try this one:
Here’s a potential workaround that includes the deps.json and runtimeconfig.json in the files that referenced projects will copy.