Bug 53195 - [MSBuild] Doesn't respect EmbeddedResources in .fsproj(resource is not embedded)
Summary: [MSBuild] Doesn't respect EmbeddedResources in .fsproj(resource is not embedded)
Status: RESOLVED FIXED
Alias: None
Product: Tools
Classification: Mono
Component: msbuild ()
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: 15.2
Assignee: Ankit Jain
URL:
Depends on:
Blocks:
 
Reported: 2017-03-09 16:25 UTC by David Karlaš
Modified: 2017-04-18 17:54 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
sample project (7.04 KB, application/zip)
2017-03-09 16:25 UTC, David Karlaš
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description David Karlaš 2017-03-09 16:25:52 UTC
Created attachment 20250 [details]
sample project

Repro steps:
Download attached project(or create your own F# project and add embedded resource)
1) inside terminal navigate to fsharpFailsToEmbedResources.sln file
2) run `msbuild`
3) run `xbuild /t:Rebuild`
4) compare parameters passed to fcs.exe, msbuild is missing `--resource:obj/x86/Debug/FSharpBinding.addin.xml`

Command `monodis --presources fsharpFailsToEmbedResources/bin/Debug/fsharpFailsToEmbedResources.exe` can be used to verify that output .exe doesn't have resource inside.
Comment 1 Ankit Jain 2017-03-10 18:07:34 UTC
Suggested a workaround to David, so changing from `blocker` to `normal`. I have a fix that needs some work and testing.
Comment 2 Matt Ward 2017-04-03 14:48:31 UTC
Without applying a workaround it is not possible to run new F# projects that use Xamarin.Forms currently because the .xaml files are not added as embedded resources in the compiled assemblies. Switching to xbuild is OK.

Looking at the compiler parameters, whilst the .xaml files are identified as EmbeddedResources, the parameters passed to Fsc do not include any --resource parameters. 

xbuild:

--resource:obj/Debug/FooBarPage.xaml
--resource:obj/Debug/App.xaml

MSBuild:

No --resource parameters.

This was tested with VSMac and using the Xamarin.Forms 2.3.4 NuGet package.

The workaround is to change EmbeddedResource to AdditionalEmbeddedResource in the .fsproj.
Comment 3 Ankit Jain 2017-04-15 08:04:54 UTC
Fixed for command line: https://github.com/mono/msbuild/commit/31480424881941ea21d6551e5e332c7467855999
Comment 4 Ankit Jain 2017-04-15 08:24:15 UTC
PR to enable use of the msbuild fix: https://github.com/xamarin/bockbuild/pull/76 .
Comment 5 Ankit Jain 2017-04-18 17:54:50 UTC
Merged.