Roslyn: Verify ref assembly behavior regarding embedded resources

Created on 15 Nov 2018  路  8Comments  路  Source: dotnet/roslyn

From discussion with Neal, the expected behavior is that resources should not be embedded into secondary assemblies:

  • refout: main assembly has resources, ref assembly doesn't
  • refonly: ref assembly has resources

@jonathanpeppers reported that updating resources causes the ref assembly to change.

A quick look at the implementation and tests make me unsure about the current behavior, so I'll investigate further.

Ref assembly spec: https://github.com/dotnet/roslyn/blob/master/docs/features/refout.md
Ref assembly main PR: https://github.com/dotnet/roslyn/pull/19417

4 - In Review Area-Compilers Bug

All 8 comments

Here is a log where I updated a <EmbeddedResource Include="foo.txt"/> in a netstandard project and ran an incremental build: msbuild.zip

What made me think there might be an issue here, is this in the log:

Target Name=CoreCompile Project=HelloForms.csproj
...
Input file "foo.txt" is newer than output file "obj\Debug\netstandard2.0\ref\HelloForms.dll".

I was using this example project, and added <ProduceReferenceAssembly>True</ProduceReferenceAssembly> to HelloForms.csproj.

That log line seems fine.

What would be an issue is if the timestamp of the HelloForms.dll reference assembly (at C:\Users\jopepper\Desktop\Git\HelloWorld\HelloForms\HelloForms\bin\Debug\netstandard2.0\ref\HelloForms.dll) is updated when you modify the resource file and build.
If that timestamp is updated, then dependent projects will have to build too, even though the change was not significant for them.

Yeah, later in the log, in the Xamarin.Android project referencing HelloForms:

Target Name=CoreCompile Project=HelloForms.Android.csproj
...
Input file "C:\Users\jopepper\Desktop\Git\HelloWorld\HelloForms\HelloForms\bin\Debug\netstandard2.0\ref\HelloForms.dll" is newer than output file "obj\Debug\90\HelloForms.Android.dll".

Thanks. That second log definitely indicates a problem. I'll investigate further.

Confirmed the issue. A fix is pending for the next version of VS (dev16).

@jcouv just so I can try this when it is out, which Dev16 preview will this be in? thanks.

The PR is still in process. There is an open question on behavior for /refonly.
I'm aiming for dev16 preview2.

Fix slipped out of preview2. It's being reviewed for preview3.

Was this page helpful?
0 / 5 - 0 ratings