NETSTANDARD error Build action 'EmbeddedResource' is not supported by one or more of the project's targets

1.8k views Asked by At

We migrate our project to NET STANDARD, but when the project is compiled many errors appear on the errors list:

Severity Code Description Project File Line Suppression State
Error Build action 'EmbeddedResource' is not supported by one or more of the project's targets. MyApp C:\desenvolvimento\aplicativo\App\MyApp\App.xaml 0

the project runs normally but many of this errors appears...

i am using the latest version of Visual Studio 2015 and Xamarin, all the libs and softwares are up to date.

3

There are 3 answers

1
Adam On

These are only Intellisense errors. If you just switch your error list filter to Build Only (instead of Build + Intellisense), then you will see that they disappear and your project will continue to build.

0
AudioBubble On

I had this issue and searched online, eventually found this answer https://forums.xamarin.com/discussion/comment/89268/#Comment_89268

It looks like a tag in the older VS solution file is the cause.
As stated in the answer, you can fix the build error by opening up the .csproj file in a text editor, finding the EnsureNuGetPackageBuildImports Target and removing it.

<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
        <PropertyGroup>
              <ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
        </PropertyGroup>
        <Error Condition="!Exists('..\packages\Xamarin.Forms.1.2.2.6243\build\portable-win+net45+wp80+MonoAndroid10+MonoTouch10\Xamarin.Forms.targets')" Text="$([System.String]::Format('$(ErrorText)','..\packages\Xamarin.Forms.1.2.2.6243\build\portable-win+net45+wp80+MonoAndroid10+MonoTouch10\Xamarin.Forms.targets'))" />
  </Target>

Loaded solution and all working.

1
Fabricio Godoy On

If your project is building correctly but these errors persist, this is because Visual Studio keeps a cache of the errors on .suo (Solution User Options) and sometimes these errors are not refreshed as should.

To force refresh close Visual Studio and delete all .suo files (including inside .vs folder). You will loose all state for this project (open files and windows, windows positions etc).