Skip to content
This repository was archived by the owner on Oct 4, 2021. It is now read-only.
This repository was archived by the owner on Oct 4, 2021. It is now read-only.

MSBuild generators aren't picked up when using item update #6372

@wjk

Description

@wjk

Consider the following MSBuild props file:

<Project>
  <PropertyGroup>
    <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
  </PropertyGroup>

  <ItemGroup>
    <EmbeddedResource Update="@(EmbeddedResource)">
      <Generator>MSBuild:_ResGenForVS</Generator>
    </EmbeddedResource>
  </ItemGroup>
</Project>

This file, when included in the project, should set the Generator metadata of all EmbeddedResource items to the string MSBuild:_ResGenForVS. Therefore, the _ResGenForVS target should be run whenever an EmbeddedResource item is saved in the editor. However… it doesn't.

For reasons I haven't been able to determine, the above MSBuild snippet is not heeded. It doesn't matter if it is included directly in the project file itself, in an explicitly imported props file, or in a props file imported automatically via Directory.Build.props. The only way for VSMac to heed the Generator metadata is for it to be set manually, by hand, on the individual item, like this:

<ItemGroup>
  <EmbeddedResource Update="File1.resx" Generator="MSBuild:_ResGenForVS" />
  <!-- or; both work -->
  <EmbeddedResource Include="File2.resx" Generator="MSBuild:_ResGenForVS" />
</ItemGroup>

This issue will become a particular problem after dotnet/msbuild#3819 and dotnet/sdk#1782 are merged, as the MSBuild code described above would be required for the features those PRs are implementing to light up.

Version information


Visual Studio Community 2017 for Mac
Version 7.6.9 (build 22)
Installation UUID: 78c34274-6601-4936-b7f8-114fe76be48c
Runtime:
	Mono 5.12.0.309 (2018-02/39d89a335c8) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)
	Xamarin.Mac 4.4.1.178 (master / eeaeb7e6)

	Package version: 512000309

NuGet
Version: 4.3.1.4445

.NET Core
Runtime: /usr/local/share/dotnet/dotnet
Runtime Version: 2.1.3
SDK: /usr/local/share/dotnet/sdk/2.1.401/Sdks
SDK Version: 2.1.401
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.12.0/lib/mono/msbuild/15.0/bin/Sdks

Xamarin.Profiler
'/Applications/Xamarin Profiler.app' not found

Apple Developer Tools
Xcode 10.0 (14320.24)
Build 10A254a

Xamarin.Mac
Version: 5.0.0.0 (Visual Studio Community)
Hash: b40230c0
Branch: 
Build date: 2018-09-27 11:41:37-0400

Xamarin.iOS
Version: 12.0.0.15 (Visual Studio Community)
Hash: 84552a46
Branch: xcode10
Build date: 2018-09-17 21:54:33-0400

Xamarin.Android
Not Installed

Xamarin Inspector
Version: 1.4.3
Hash: db27525
Branch: 1.4-release
Build date: Mon, 09 Jul 2018 21:20:18 GMT
Client compatibility: 1

Build Information
Release ID: 706090022
Git revision: 0a0ba3c4593e9adb1c6ff6324e641036146af376
Build date: 2018-10-05 16:38:51+00
Build branch: release-7.6
Xamarin extensions: f7856b13f2c03a58e08381d3a5970bba18f5c7d7

Operating System
Mac OS X 10.14.0
Darwin 18.0.0 Darwin Kernel Version 18.0.0
    Wed Aug 22 20:13:40 PDT 2018
    root:xnu-4903.201.2~1/RELEASE_X86_64 x86_64

Enabled user installed extensions
AddinMaker 1.4.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions