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

[dotnet] Tell .NET to not generate files we don't need. Fixes #9687. #11693

Merged
merged 2 commits into from
May 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions dotnet/targets/Xamarin.Shared.Sdk.props
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,8 @@
<_XamarinSdkRoot Condition="'$(_XamarinSdkRoot)' == ''">$(_XamarinSdkRootDirectory)</_XamarinSdkRoot>
<!-- _XamarinSdkRootOnMac this should be passed to tasks that need to access the Xamarin Sdk dir on the Mac, this value will be overriden from Windows -->
<_XamarinSdkRootOnMac>$(_XamarinSdkRoot)</_XamarinSdkRootOnMac>

<!-- We don't need any dependency files -->
<GenerateDependencyFile Condition="'$(GenerateDependencyFile)' == ''">false</GenerateDependencyFile>
</PropertyGroup>
</Project>
3 changes: 3 additions & 0 deletions dotnet/targets/Xamarin.Shared.Sdk.targets
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@
<StartupHookSupport Condition="'$(StartupHookSupport)' == ''">false</StartupHookSupport>
<UseSystemResourceKeys Condition="'$(UseSystemResourceKeys)' == ''">true</UseSystemResourceKeys>
<UseNativeHttpHandler Condition="'$(_PlatformName)' != 'macOS' And '$(UseNativeHttpHandler)' == ''">true</UseNativeHttpHandler>

<!-- We don't need to generate reference assemblies for apps or app extensions -->
<ProduceReferenceAssembly Condition="'$(ProduceReferenceAssembly)' == '' And ('$(OutputType)' == 'Exe' Or '$(IsAppExtension)' == 'true')">false</ProduceReferenceAssembly>
Copy link
Contributor

Choose a reason for hiding this comment

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

hmm... iirc we're using .dll for the main assembly for net6 so that would never work (except for app extensions)

Copy link
Member Author

Choose a reason for hiding this comment

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

We use OutputType=Exe:

We also depend on this elsewhere in this exact file:

OutputType Custom variable
==================================================================
iOS Executable Project Exe
iOS App Extension Project Library IsAppExtension
iOS Binding Project Library IsBindingProject
iOS Class Library Project Library
tvOS Executable Project Exe
tvOS App Extension Project Library IsAppExtension
tvOS Binding Project Library IsBindingProject
tvOS Class Library Project Library
watchOS App Project Library IsWatchOSApp
watchOS App Extension Project Library IsAppExtension
watchOS Binding Project Library IsBindingProject
watchOS Class Library Project Library
macOS Executable Project Exe
macOS App Extension Project Library IsAppExtension
macOS Binding Project Library IsBindingProject
macOS Class Library Project Library

Copy link
Contributor

Choose a reason for hiding this comment

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

hmm... is that recent ?

because size comparison shows MySingleView.dll for .net

or maybe the issue is elsewhere... <OutputType> not doing what seems logical ?

Copy link
Member Author

Choose a reason for hiding this comment

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

hmm... is that recent ?

No, it's not recent, it's always been this way.

because size comparison shows MySingleView.dll for .net

or maybe the issue is elsewhere... <OutputType> not doing what seems logical ?

Yes, OutputType is doing something different now. I'm not quite sure what, but I believe it doesn't affect the extension for the output assembly anymore.

</PropertyGroup>

<PropertyGroup>
Expand Down