dotnet / dotnet/project-system

Resource designer files generated are incompatible with netstandard

Open
#3,366 7 comments 0 reactions 0 assignees View on GitHub
Feature-Multi-Targeting Triage-Approved
Dominant language
C#
Stars
1k
Forks
415
PR merge metrics
No merged PRs in 30d

Description

_From @emgarten on April 6, 2017 21:49_

Resource designer files generated are incompatible with netstandard if a desktop framework is included first in the ``TargetFrameworks`` list.

### Steps
1. Create a new netstandard library with VS 2017
1. Add a resource file to the project
1. Change ``$(TargetFramework)=netstandard1.3`` to ``$(TargetFrameworks)=net45;netstandard1.3``
1. Right click on the resource file and select ``Run Custom Tool``
1. Rebuild

### Expected
The project will build

### Actual
The project fails to build with an error about being unable to find the ``Assembly`` property.

### Observation

When a desktop framework is first in the list of target frameworks the designer file is generated incorrectly for netstandard.

``.GetTypeInfo()`` is missing from the designer file:

```global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ClassLibrary12.Resource1", typeof(Resource1).Assembly);```

Using netstandard only you would get:

```global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ClassLibrary12.Resource1", typeof(Resource1).GetTypeInfo().Assembly);```

### Workaround
Using ``$(TargetFrameworks)=netstandard1.3;net45`` instead of ``$(TargetFrameworks)=net45;netstandard1.3`` generates the correct file.

_Copied from original issue: dotnet/sdk#1092_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.