Skip to content

Conversation

@jonathanpeppers
Copy link
Member

Xamarin.Android.sln has two issues that make Xamarin.Android.sln not
work too well in VS Windows:

  • It builds MSBuild tasks and uses them within the same solution, such
    as xa-prep-tasks.csproj and
    Xamarin.Android.Tools.BootstrapTasks.csproj.
  • We have conditional @(ProjectReference)

To improve things, I completely removed the $(XAIntegratedTests)
MSBuild property and any @(ProjectReference) that were conditional.

I moved the two bootstrap .csproj files to a new
Xamarin.Android.BootstrapTasks.sln which gets built during make prepare or msbuild Xamarin.Android.sln /t:Prepare.

VS Windows was also complaining about the
CreateManifestResourceNames target missing for projects that merely
import Microsoft.Common.targets such as r8.csproj. I added an
empty target in Configuration.props to fix all cases of this.

Unfortunately, things are still not perfect as you can hit errors such
as:

Unable to copy file "obj\Debug\Xamarin.Android.Build.Tasks.dll" to "C:\src\xamarin-android\bin\Debug\lib\xamarin.android\xbuild\Xamarin\Android\Xamarin.Android.Build.Tasks.dll".
The process cannot access the file 'C:\src\xamarin-android\bin\Debug\lib\xamarin.android\xbuild\Xamarin\Android\Xamarin.Android.Build.Tasks.dll' because it is being used by another process.
Could not copy "obj\Debug\Xamarin.Android.Build.Tasks.dll" to "C:\src\xamarin-android\bin\Debug\lib\xamarin.android\xbuild\Xamarin\Android\Xamarin.Android.Build.Tasks.dll".
Exceeded retry count of 10. Failed. The file is locked by: "Microsoft Visual Studio 2019 (26660), MSBuild.exe (18800), MSBuild.exe (17416)"	Xamarin.Android.Build.Tasks

This occurs if you modify Xamarin.Android.Build.Tasks.csproj.

I am not yet sure if we can get around this remaining problem, but we
can revisit in the future.

@jonpryor
Copy link
Contributor

jonpryor commented Nov 5, 2019

Do we have an explanation for the file sharing issue on Xamarin.Android.Build.Tasks.dll? Why is it being held open?

@jonathanpeppers
Copy link
Member Author

VS Windows keeps MSBuild nodes alive, and if they have previously loaded Xamarin.Android.Build.Tasks.dll the assembly is locked.

At least under .NET framework, it seems like they are just using Assembly.LoadFrom in MSBuild: https://github.com/microsoft/msbuild/search?q=assembly.loadfrom

@jonathanpeppers jonathanpeppers marked this pull request as ready for review November 5, 2019 16:06
.PHONY: prepare
prepare: prepare-build
mono --debug $(PREPARE_EXE) $(_PREPARE_ARGS)
msbuild $(BOOTSTRAP_MSBUILD_FLAGS) $(BOOTSTRAP_SOLUTION)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this change on Windows?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR removes the "bootstrap" MSBuild tasks from the SLN, so we need make prepare to build them now.

I think it makes sense to build them at that step? or do you think make all should do that?

@jonpryor
Copy link
Contributor

I think we need to do the "same" thing in Java.Interop -- not that I'm asking @jonathanpeppers to do so -- as that may help the VSMac experience. (I think it'll also be needed to land PR #3393...)

Xamarin.Android.sln has two issues that make `Xamarin.Android.sln` not
work too well in VS Windows:

* It builds MSBuild tasks and uses them within the same solution, such
  as `xa-prep-tasks.csproj` and
  `Xamarin.Android.Tools.BootstrapTasks.csproj`.
* We have conditional `@(ProjectReference)`

To improve things, I completely removed the `$(XAIntegratedTests)`
MSBuild property and any `@(ProjectReference)` that were conditional.

I moved the two bootstrap `.csproj` files to a new
`Xamarin.Android.BootstrapTasks.sln` which gets built during `make
prepare` or `msbuild Xamarin.Android.sln /t:Prepare`.

VS Windows was also complaining about the
`CreateManifestResourceNames` target missing for projects that merely
import `Microsoft.Common.targets` such as `r8.csproj`. I added an
empty target in `Configuration.props` to fix all cases of this.

Unfortunately, things are still not perfect as you can hit errors such
as:

    Unable to copy file "obj\Debug\Xamarin.Android.Build.Tasks.dll" to "C:\src\xamarin-android\bin\Debug\lib\xamarin.android\xbuild\Xamarin\Android\Xamarin.Android.Build.Tasks.dll".
    The process cannot access the file 'C:\src\xamarin-android\bin\Debug\lib\xamarin.android\xbuild\Xamarin\Android\Xamarin.Android.Build.Tasks.dll' because it is being used by another process.
    Could not copy "obj\Debug\Xamarin.Android.Build.Tasks.dll" to "C:\src\xamarin-android\bin\Debug\lib\xamarin.android\xbuild\Xamarin\Android\Xamarin.Android.Build.Tasks.dll".
    Exceeded retry count of 10. Failed. The file is locked by: "Microsoft Visual Studio 2019 (26660), MSBuild.exe (18800), MSBuild.exe (17416)"	Xamarin.Android.Build.Tasks

This occurs if you modify `Xamarin.Android.Build.Tasks.csproj`.

I am not yet sure if we can get around this remaining problem, but we
can revisit in the future.
@jonathanpeppers jonathanpeppers force-pushed the xamarin.android.bootstraptasks.sln branch from e2cbb2d to dc56205 Compare November 11, 2019 14:24
@jonpryor jonpryor merged commit 91467bb into dotnet:master Nov 12, 2019
@jonathanpeppers jonathanpeppers deleted the xamarin.android.bootstraptasks.sln branch November 12, 2019 13:35
@github-actions github-actions bot locked and limited conversation to collaborators Jan 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants