xamarin / xamarin-macios

.NET for iOS, Mac Catalyst, macOS, and tvOS provide open-source bindings of the Apple SDKs for use with .NET managed languages such as C#
Other
2.46k stars 512 forks source link

MSBuild 15.6.82 doesn't produce Xamarin.Mac20 target output #3746

Closed Cheesebaron closed 6 years ago

Cheesebaron commented 6 years ago

This started 2 days ago, when AppVeyor updated their build images to latest stable VS2017.

Steps to Reproduce

  1. Update VS2017 to latest stable 15.6
  2. Run MvvmCross build script .\build.ps1

Expected Behavior

Build should not fail

Actual Behavior

Build fails

Environment

AppVeyor latest, also fails on machine with latest VS2017 15.6

Switching to AppVeyor Previous VS2017 Image makes build work again. Something is wrong with the latest msbuild it seems.

Build Logs

Diagnostic build log: https://ci.appveyor.com/project/MvvmCross/mvvmcross/build/6.0.0-beta.3+154.Branch.pull/2685/merge.Sha.bfe7f23f51d81f3fd038e8db0a416e0dd4c032d6-1900

Minimal build log: https://ci.appveyor.com/project/MvvmCross/mvvmcross/build/6.0.0-beta.3+153.Branch.pull/2685/merge.Sha.bac27bdb4294959ac3f37dbe7e77b8a068661165-1899

Build on older version of msbuild: https://ci.appveyor.com/project/MvvmCross/mvvmcross/build/6.0.0-beta.3%2B152.Branch.pull%2F2685%2Fmerge.Sha.d9f5540f55f3b93f2ed88ad7a31b0a3eb55902cb-1898

can produce a diagnostic build log for that one too if needed.

Example Project (If Possible)

https://github.com/MvvmCross/MvvmCross

VS bug #593759

therealjohn commented 6 years ago

@Cheesebaron The diagnostic log is incomplete. It does not actually have any diagnostic info that is useful. Can you share one?

In one of the logs, you can see this too:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Windows.After.targets(66,3): warning VSX1000: No Address and User has been specified in order to establish a connection to a Mac Server, so only the main assembly was compiled for project 'MvvmCross.Plugin.Visibility'. Connect to a Mac Server and try again to build the full application. [C:\projects\mvvmcross\MvvmCross.Plugins\Visibility\MvvmCross.Plugin.Visibility.csproj]

That could be related.

dalexsoto commented 6 years ago

Another piece of information from #3758

From @arivoir

You can find all the details here 323760.

When the build starts it deletes the output folder content of a referenced project incorrectly, then it fails because it want to get what deleted.

Cheesebaron commented 6 years ago

@therealjohn ahh, crap. AppVeyor probably didn't like the massive size of the diagnostic log. I'll produce one and upload to gist later today.

arivoir commented 6 years ago

@dalexsoto today I tested to compile the solution with the server connected to a mac, and the same problem appeared.

2018-03-16T16:21:07.0732048Z 49:2>Project "C:\TfsAgentAWork\24\s\Mac\Controls\CollectionView\C1.Mac.CollectionView.csproj" (49:2) is building "C:\TfsAgentAWork\24\s\Shared\Controls\CollectionView\C1.CollectionView.csproj" (2:72) on node 4 (Clean target(s)). 2018-03-16T16:21:07.0732048Z 2>CoreClean: 2018-03-16T16:21:07.0742068Z Deleting file "C:\TfsAgentAWork\24\s\Shared\Controls\CollectionView\bin\Release\C1.CollectionView.xml". 2018-03-16T16:21:07.0742068Z Deleting file "C:\TfsAgentAWork\24\s\Shared\Controls\CollectionView\bin\Release\C1.CollectionView.deps.json". 2018-03-16T16:21:07.0742068Z Deleting file "C:\TfsAgentAWork\24\s\Shared\Controls\CollectionView\bin\Release\C1.CollectionView.dll". 2018-03-16T16:21:07.0772065Z ##[warning]C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(4978,5): Warning MSB3061: Unable to delete file "C:\TfsAgentAWork\24\s\Shared\Controls\CollectionView\bin\Release\C1.CollectionView.dll". The process cannot access the file 'C:\TfsAgentAWork\24\s\Shared\Controls\CollectionView\bin\Release\C1.CollectionView.dll' because it is being used by another process. 2018-03-16T16:21:07.0772065Z 2>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(4978,5): warning MSB3061: Unable to delete file "C:\TfsAgentAWork\24\s\Shared\Controls\CollectionView\bin\Release\C1.CollectionView.dll". The process cannot access the file 'C:\TfsAgentAWork\24\s\Shared\Controls\CollectionView\bin\Release\C1.CollectionView.dll' because it is being used by another process. [C:\TfsAgentAWork\24\s\Shared\Controls\CollectionView\C1.CollectionView.csproj] 2018-03-16T16:21:07.0782072Z Deleting file "C:\TfsAgentAWork\24\s\Shared\Controls\CollectionView\bin\Release\C1.CollectionView.pdb". 2018-03-16T16:21:07.0782072Z Deleting file "C:\TfsAgentAWork\24\s\Shared\Controls\CollectionView\obj\Release\C1.CollectionView.csprojResolveAssemblyReference.cache". 2018-03-16T16:21:07.0792068Z Deleting file "C:\TfsAgentAWork\24\s\Shared\Controls\CollectionView\obj\Release\C1.CollectionView.csproj.CoreCompileInputs.cache". 2018-03-16T16:21:07.0792068Z Deleting file "C:\TfsAgentAWork\24\s\Shared\Controls\CollectionView\obj\Release\C1.CollectionView.dll". 2018-03-16T16:21:07.0792068Z Deleting file "C:\TfsAgentAWork\24\s\Shared\Controls\CollectionView\obj\Release\C1.CollectionView.pdb". 2018-03-16T16:21:07.2922242Z 2>Done Building Project "C:\TfsAgentAWork\24\s\Shared\Controls\CollectionView\C1.CollectionView.csproj" (Clean target(s)). 2018-03-16T16:21:07.2952239Z 49>_GenerateBuildSessionId: 2018-03-16T16:21:07.2962238Z Generated session id: 27d6817a0b2aaceddf14a30e3e0d91c0 2018-03-16T16:21:07.2962238Z Generated build app name: C1.Mac.CollectionView 2018-03-16T16:21:07.2972299Z _SayHello: 2018-03-16T16:21:07.2972299Z Connecting to Mac server XXXXXXX... 2018-03-16T16:21:07.3092253Z _CleanIntermediateToolOutput: 2018-03-16T16:21:07.3092253Z Directory "obj\Release\actool" doesn't exist. Skipping. 2018-03-16T16:21:07.3102255Z Directory "obj\Release\ibtool" doesn't exist. Skipping. 2018-03-16T16:21:07.3112260Z Directory "obj\Release\metal" doesn't exist. Skipping. 2018-03-16T16:21:07.3112260Z Directory "obj\Release\scntool" doesn't exist. Skipping. 2018-03-16T16:21:07.3122253Z Directory "obj\Release\TextureAtlas" doesn't exist. Skipping. 2018-03-16T16:21:07.3122253Z Removing directory "obj\Release\". 2018-03-16T16:21:07.3142254Z _CleanMacBuild: 2018-03-16T16:21:07.3152247Z Directory "bin\Release\" doesn't exist. Skipping. 2018-03-16T16:21:07.3152247Z Directory "obj\Release\" doesn't exist. Skipping. 2018-03-16T16:21:07.3452279Z 19>_SayHello: 2018-03-16T16:21:07.3452279Z Starting Agent Build 4.9.0.749... 2018-03-16T16:21:07.4352365Z 49>Done Building Project "C:\TfsAgentAWork\24\s\Mac\Controls\CollectionView\C1.Mac.CollectionView.csproj" (Clean target(s)). 2018-03-16T16:21:07.7312626Z ##[error]C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Mac\Xamarin.Mac.Common.targets(463,3): Error : Could not find 'Xamarin.Mac' 2018-03-16T16:21:07.7322710Z 49>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Mac\Xamarin.Mac.Common.targets(463,3): error : Could not find 'Xamarin.Mac' [C:\TfsAgentAWork\24\s\Mac\Controls\CollectionView\C1.Mac.CollectionView.csproj] 2018-03-16T16:21:07.7332683Z 49>Done Building Project "C:\TfsAgentAWork\24\s\Mac\Controls\CollectionView\C1.Mac.CollectionView.csproj" (Rebuild target(s)) -- FAILED.

The build deletes the references files unexpectedly, before to connect to the mac,so it made no difference.

Do you think there is any way to avoid the "Clean" in the referenced project?

rmarinho commented 6 years ago

We are getting this with Xamarin.Forms too.

dalexsoto commented 6 years ago

@Cheesebaron / @arivoir We have a workaround

Add this to your Xamarin.Mac projects:

<Target Name="_VerifyBuildSignature" />

Right after the import of the Xamarin.Mac targets:

<Import Project="$(MSBuildExtensionsPath)\Xamarin\Mac\Xamarin.Mac.CSharp.targets" />
<Target Name="_VerifyBuildSignature" />
</Project> 

This should get your build going.

joj commented 6 years ago

This will be fixed in the next release. The bug is on VS, not macios, so it falls in the current ship schedule. That workaround should work for now. If it doesn't, please do comment.

arivoir commented 6 years ago

@dalexsoto The workaround worked. Thank you very much, you saved us just in time. @joj I hope to see the fix in the next vs release.

joj commented 6 years ago

It's already committed, just waiting for a release :)

gtbuchanan commented 6 years ago

How would you implement the workaround in the new csproj format for a multi-target project (such as this one in ReactiveUI)?

<TargetFrameworks>netstandard1.1;net45;uap10.0;Xamarin.iOS10;Xamarin.Mac20;MonoAndroid70</TargetFrameworks>

I've tried adding the following at the very end, but it still breaks:

<Target Name="_VerifyBuildSignature" Condition=" '$(TargetFramework)' == 'Xamarin.Mac20' " />

with:

ResolveAssemblyReferences: Primary reference "ReactiveUI". Could not find dependent files. Expected file "C:\Users\tbuchanan\Code\ReactiveUI\src\ReactiveUI\bin\Release\xamarin.mac20\ReactiveUI.dll" does not exist.

Cheesebaron commented 6 years ago

here is a log: https://ci.appveyor.com/project/MvvmCross/mvvmcross/build/6.0.0-beta.3+402.Branch.pull/2759/merge.Sha.de469d4c8dacb576352c67a7bb5fae1a00f7180b-2125/artifacts

It is a binlog since a text log is over 4 GB big. http://msbuildlog.com/ can show it

EDIT: This still seems to be an issue with the new 15.6.85. Nothing is output to bin/Release/xamarin.mac20

We are in the same boat as @gtbuchanan where we are using MSBuildExtras.

martijn00 commented 6 years ago

@joj Which release is the fix included in?

joj commented 6 years ago

This was fixed for 15.7 which is in alpha right now and will be our next stable release.

martijn00 commented 6 years ago

@joj I tried 15.7 preview2 just now and it had the same problem. Is this not released in the preview yet?

joj commented 6 years ago

It should be. I'll check with people here and get back to you.

martijn00 commented 6 years ago

@joj any news?

joj commented 6 years ago

We're looking into it. I'll update here soon. Sorry for that, the person who actually committed the fix was out last week.

martijn00 commented 6 years ago

@kzu @onovotny Any suggestions how we can workaround this issue when using the SDK Extras?