-
Notifications
You must be signed in to change notification settings - Fork 41
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
How do I disable HotReload for Release builds? #115
Comments
Hi) Yeas, of course it's possible) |
can you share csproj file with me? |
Well, it looks like: <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebugType>pdbonly</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.1.0.555618" />
<PackageReference Include="Xamarin.HotReload" Version="1.4.19" />
</ItemGroup>
</Project> You need to put HotReload to Debug ItemGroup section (create new one) like: <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebugType>pdbonly</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.1.0.555618" />
</ItemGroup>
<ItemGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<PackageReference Include="Xamarin.HotReload" Version="1.4.19" />
</ItemGroup>
</Project> |
Does it help?) |
I thought it should work. But unfortunately, it did not disable the HotReload. I still saw I just added Xamarin.HotReload nuget to my portable project and did the changes.
After that, I built a new apk by Visual Studio App Center and the apk still contains Xamarin.HotReload. Any idea? @AndreiMisiukevich |
@TingtingAn try to remove bin/obj and remove HotReload from platform projects (leave it only in portable), then try to build again |
@AndreiMisiukevich Yea, I just kept Xamarin.HotReload in portable project and removed the bin/obj folders. Still not work. I created a demo project. Could you try to build the apk? |
@TingtingAn sure, it will take a look |
@TingtingAn , try Full: <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebugType>pdbonly</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<ItemGroup Condition="'$(Configuration)' != 'Release'">
<PackageReference Include="Xamarin.HotReload" Version="1.4.15" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.1.0.555618" />
<PackageReference Include="Xamarin.Essentials" Version="1.1.0" />
</ItemGroup>
</Project> |
Hm, have you got any ideas how to work around it? |
Then try it. And remember.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebugType>pdbonly</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<Choose>
<When Condition="'$(Configuration)' == 'Debug'">
<ItemGroup>
<PackageReference Include="Xamarin.HotReload" Version="1.4.15" />
</ItemGroup>
</When>
</Choose>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.1.0.555618" />
<PackageReference Include="Xamarin.Essentials" Version="1.1.0" />
</ItemGroup>
</Project> |
@AndreiMisiukevich It does not work. And I got the info here. You can use a condition to control whether a package is included, where conditions can use any MSBuild variable or a variable defined in the targets or props file. However, at presently, only the TargetFramework variable is supported. |
@TingtingAn agrh.. So, it's problem. Okay, you for now you may comment this line in csproj and build the apk.. need to investigate |
linking assemblies doesn't solve this? https://docs.microsoft.com/en-us/xamarin/android/deploy-test/linker |
This solution seems to work on my side. |
so you don't see useless DLLs in your apk? |
@AndreiMisiukevich Yes. No more libaot-Microsoft.CodeAnalysis.CSharp.dll.so. |
@rudyspano In fact, commenting HotReload PackageReference is my only soultion. According to the Microsoft documentation, we know only the TargetFramework variable is supported for packagereference condition. So I think your solution will not work. I've tried it before and it really doesn't work. What is your build environment? Could you try to build the apk by Visual Studio App Center? |
@TingtingAn It is working on Visual Studio for Mac "Archive For Publishing" feature (do not forget to manually delete obj and bin folders). And also in our on Premise CI Environment (Jenkins, MSBuild on Mac). In order to view the APK Package content, we use Android Studio. |
Yes, it is working for Archive feature on my local Visual Studio. So the issue is from Visual Studio App Center. |
I am happy to use HotReload for my Project. But it makes bigger size for android apk.
After unzipping the apk, I see
Xamarin.Forms.HotReload.Reloader.dll
,Microsoft.CodeAnalysis.CSharp.dll
andMicrosoft.CodeAnalysis.dll
in assemblies folder.Any way to remove them? Thanks!
The text was updated successfully, but these errors were encountered: