Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xamarin Studio build targets? Trying to get Fody working?

I'm trying to get Xamarin Studio to use PropertyChanged.Fody. I have Fody installed via NuGet which puts Fody.targets in its NuGet packages folder. But when I build, the output never shows that the target is run.

How can I tell Xamarin Studio to use the Fody build target?

Thanks!

like image 929
Tyler Brinks Avatar asked Sep 11 '14 18:09

Tyler Brinks


3 Answers

I had the same issue and managed to figure out that if you remove the build\Microsoft.Bcl.Build.targets from the csproj file Fody runs as normal.

So try and remove this line.

<Import Project="..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets" Condition="Exists('..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" />
like image 60
rid00z Avatar answered Nov 15 '22 22:11

rid00z


As you tagged your question with monotouch, I assume you're having the issue on iOS. Until very recently, Xamarin.Studio wasn't using xbuild (or msbuild) to build the project, and then additional targets were skipped.

Starting with Xamarin.iOS 7.9 (or more realistically 8.0), the default is unchanged but you have the option to enable it from the project preferences :

use MSBuild build engine

Ignore the "unsupported" warning, but know that it's unsupported if you have any issue.

Then, provided that the nuget correctly added a line like

  <Import Project="PATH_TO/Fody.targets" />

the target should be executed.

like image 25
Stephane Delcroix Avatar answered Nov 15 '22 20:11

Stephane Delcroix


There is an error in the Fody.targets file. Just replace

Condition="Exists(@(IntermediateAssembly))"

with

Condition="Exists('@(IntermediateAssembly)')"

and it should work again.

Find the file in .../projectfolder/packages/Fody2.x.x/build/netstandard1.4/Fody.targets

like image 24
Gering Avatar answered Nov 15 '22 20:11

Gering