Forum Visual Studio

Xamarin Studio - Assembly Cache Issue?

Hey guys,

I have had quite a bit of experience with Xamarin in the past and the company I work for is now doing cross-platform development including the Mac. Because the Xamarin/Nuget integration doesn't quite do all of the things we need, we have a custom solution to deploy all NuGet package files into a well known folder within the root of each branch. This has worked very well in Windows for some time and it works fairly well in OSX Xamarin Studio - but there is 1 gotcha.

If you do a complete clean, open the solution, download/extract all packages (we have a special .csproj in the solution that does this via MSBuild), and then build, Xamarin Studio doesn't see the assembly files - even though they're in the proper directory. The relative paths are all valid too. To workaround this, all you have to do is close the solution and re-open.

We're not quite sure why things fail but are wondering if Xamarin Studio is caching files as soon as you open the .sln? If so, is there any way to change this behavior? I'm willing to bet you could easily reproduce this by simply opening a solution w/ 1 assembly file references, ensure the folder is empty, open the solution, copy the assembly into that said folder, and then confirming that the build fails.



  • mattwardmattward GBMember Xamurai

    I have only seen build errors if assemblies are referenced via extra MSBuild targets or imports that are stored separately from the main project file and are restored after the project has been loaded and built by Xamarin Studio.

    Do you have any NuGet packages that use custom MSBuild targets?

    Xamarin Studio does not currently detect that the .targets files or other imported MSBuild files have changed. This can cause problems if they are restored outside of Xamarin Studio since there is a separate MSBuild process that may have already loaded the project file without these extra files. The NuGet addin in Xamarin Studio does extra work to make sure information about these .targets files is refreshed after a restore.

    With a project that references an assembly which is restored outside of Xamarin Studio, after the project has failed to build the first time, then the next build will complete without any errors.

  • Thanks for the feedback!

    In this case, these NuGet packages are very simple - they only include assemblies. It doesn't seem to matter how many times I rebuild - it just doesn't see the files even though they're there. I do believe that manually "loading" the project (or unloading->loading) will also work.

    I should also mention that we're on the 5.7 (build 661) release. It was the latest until just recently. I'll do a few more experiments but feel that you're describing something that we don't see. But putting that to the side, I could totally see how things like assembly reference icons and the like wouldn't be correct until, possibly, rebuilding - but it just seems to continually fail.

Sign In or Register to comment.