Open jaredpar opened 4 years ago
Need some triage info.
Should we try to get this approved for 16.5 (3.1.200), or is 16.6 (3.1.300) ok? Or can you wait to adopt a 5.0 sdk to get unblocked on this?
Is there a customer scenario for Embed on .NET Core 3+ or is it more something particular to constraints of building VB compiler itself?
This can wait until 16.6. It's okay to keep MS.VB on netstandard2.0
for a while until this gets sorted out.
Is there a customer scenario for Embed on .NET Core 3+ or is it more something particular to constraints of building VB compiler itself?
More the latter. The compiler wants to be as dependency free as possible.
Since this issue requires us to single-target some of our projects to 'netstandard2.0', it ends up forcing us to build Microsoft.CodeAnalysis.CSharp among others in both netstandard2.0 and netcoreapp3.1 flavors in order to build a netcoreapp3.1 test project, which adds a significant bit of time to the inner loop of editing and rerunning tests.
It would be great if this could get fixed and we could multi-target "netcoreapp3.1;netstandard2.0" all the way down.
Workaround:
<Target Name="WorkAroundDotnetSdk10591"
AfterTargets="ResolveTargetingPackAssets"
Condition="'$(Language)' == 'VB' AND '$(VBRuntime)' == 'Embed'">
<ItemGroup>
<Reference Remove="@(Reference)" Condition=" '%(FileName)' == 'Microsoft.VisualBasic' or '%(FileName)' == 'Microsoft.VisualBasic.Core' " />
</ItemGroup>
</Target>
Works on a trivial library project.
Repro steps:
netcoreapp3.1
<VBRuntime>Embed</VBRuntime>
The expectation here is that Microsoft.VisualBasic is not passed as a reference to the compilation. The actual behavior is that it is passed as a reference. Notice also if you change the target framework to
netcoreapp2.1
ornetstandard2.0
it is not passed as a reference.This is making it hard to multi-target the Visual Basic compiler because our code is written with the expectation that the real runtime is not provided as a reference.
Related: https://github.com/dotnet/roslyn/issues/40766