Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Packing iOS binding projects with NativeReference fails #176

Open
mattleibow opened this issue Aug 5, 2019 · 1 comment
Open

Packing iOS binding projects with NativeReference fails #176

mattleibow opened this issue Aug 5, 2019 · 1 comment

Comments

@mattleibow
Copy link
Contributor

mattleibow commented Aug 5, 2019

I have an iOS binding project that uses @(NativeReference) to pull in the frameworks. If I run a Pack, I get this error:

NuGet.Build.Tasks.Pack.targets(198,5): error : The file '/Users/matthew/Projects/square-bindings/binding/Square.Aardvark/bin/Debug/xamarinios1.0/Native.Square.Aardvark.manifest' to be packed was not found on disk.

My first attempt was to just create that file ('cause I be crazy). That results in another failure:

Unknown native reference type:

So I had a look, it appears to be a "conflict" of .NET (desktop) properties with Xamarin iOS properties. Both use the NativeReference item group, but for different things:

https://github.com/microsoft/msbuild/blob/v16.2.32702/src/Tasks/Microsoft.Common.CurrentVersion.targets#L5548-L5554

<_BuiltProjectOutputGroupOutputIntermediate Include="$(OutDir)$(_DeploymentTargetApplicationManifestFileName)" Condition="'@(NativeReference)'!='' or '@(_IsolatedComReference)'!=''">

My fix so far is to just add this in my project file:

<Target Name="_RemoveNativeReferencesManifest" AfterTargets="BuiltProjectOutputGroup">
  <ItemGroup>
    <_BuiltProjectOutputGroupOutputIntermediate Remove="$(OutDir)$(_DeploymentTargetApplicationManifestFileName)" />
    <BuiltProjectOutputGroupOutput Remove="$(ProjectDir)$(OutDir)$(_DeploymentTargetApplicationManifestFileName)" />
  </ItemGroup>
</Target>

I am not sure if there is any other way to avoid this because there aren't actual hooks that I can see. And, I think we should be safe because the Native.xxx.manifest file is not an iOS thing.

I have a sample here:
https://github.com/mattleibow/XamarinNativeReferencesBug

This issue also needs to be addressed in MSBuild directly: dotnet/msbuild#4584

mattleibow added a commit to mattleibow/MSBuildSdkExtras that referenced this issue Aug 6, 2019
The `@(NativeReference)` is used for other things in .NET, so make sure to remove the incorrect file.

novotnyllc#176
clairernovotny pushed a commit that referenced this issue Aug 13, 2019
@clairernovotny
Copy link
Collaborator

Before closing this out @mattleibow can you please take a look at the warning that gets generated now with this:

 C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targe ts(2002,5): warning MSB3341: Could not resolve reference "Resource1.resx". If this reference is required by your code,  you may get compilation errors. [D:\dev\MSBuildSdkExtras\Tests\ClasslibraryAsSdk\ClasslibraryAsSdk.csproj]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants