When building my Xamarin project, it gets to this part of the build process and hangs forever. Left it overnight only to find it sitting in the same spot in the morning.
[aot-compiler stdout] Executing the native assembler: "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\Android
dk\aarch64-linux-android-as" -o obj\Release\110\aot\arm64-v8a\Xamarin.Forms.Core.dll\temp.s.o obj\Release\110\aot\arm64-v8a\Xamarin.Forms.Core.dll\temp.s
[aot-compiler stdout] Executing the native linker: "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\Android
dk\aarch64-linux-android-ld" -Bsymbolic -shared -o obj\Release\110\aot\arm64-v8a\libaot-Xamarin.Forms.Core.dll.so.tmp obj\Release\110\aot\arm64-v8a\Xamarin.Forms.Core.dll\temp.s.o
[aot-compiler stdout] JIT time: 139 ms, Generation time: 1707 ms, Assembly+Link time: 612 ms.
Is there somewhere else I can look to see if there are actual errors occurring, which might be causing the issue? App will run on emulator fine in Debug mode, but this happens when building in Release.
Note, that on occasion I can get it to complete, but not consistently.
In Archive Manager, the green bar just keeps scrolling, showing "packaging" of the app.
These are the configurations of the two builds:
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>portable</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AndroidLinkMode>None</AndroidLinkMode>
<AotAssemblies>false</AotAssemblies>
<EnableLLVM>false</EnableLLVM>
<AndroidEnableProfiledAot>false</AndroidEnableProfiledAot>
<BundleAssemblies>false</BundleAssemblies>
<AndroidPackageFormat>apk</AndroidPackageFormat>
<AndroidUseAapt2>true</AndroidUseAapt2>
<AndroidCreatePackagePerAbi>false</AndroidCreatePackagePerAbi>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>false</DebugSymbols>
<DebugType>portable</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AndroidManagedSymbols>true</AndroidManagedSymbols>
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
<AotAssemblies>false</AotAssemblies>
<EnableLLVM>false</EnableLLVM>
<AndroidEnableProfiledAot>true</AndroidEnableProfiledAot>
<BundleAssemblies>false</BundleAssemblies>
<AndroidPackageFormat>apk</AndroidPackageFormat>
<AndroidUseAapt2>true</AndroidUseAapt2>
<AndroidCreatePackagePerAbi>false</AndroidCreatePackagePerAbi>
<AndroidLinkTool>r8</AndroidLinkTool>
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
<AndroidKeyStore>false</AndroidKeyStore>
</PropertyGroup>
Is it possibly an R8 issue?
Related
I'm new here. i am testing visual studio for mac 2022. i am opening a xamarin project made in vs 2019 for mac. whenever I open it it deletes the android manifest and creates a new one. am i missing something?
I had the same issue and fixed it by updating the Android.csproj file with the configuration property groups created in a new VisualStudio 2022 Android project;
here's an example of one of the configuration tags I changed:
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>portable</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AndroidLinkMode>None</AndroidLinkMode>
<LangVersion>9.0</LangVersion>
<AotAssemblies>false</AotAssemblies>
<EnableLLVM>false</EnableLLVM>
<AndroidEnableProfiledAot>false</AndroidEnableProfiledAot>
<BundleAssemblies>false</BundleAssemblies>
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
<MandroidI18n />
<AndroidTlsProvider>btls</AndroidTlsProvider>
</PropertyGroup>
I have few projects in my solution - few for mobile (Xamarin.Forms) and one xUnit. xUnit is build with .NET5 and references mobile project.
There are 2 pipelines on Azure DevOps to build mobile app. One is for Android and runs on Windows, another for iOS and runs on OSX.
xUnit project build started to fail after I added new NuGet to mobile project (Rg.Plugins.Popup).
Initially, setting the TargetFramework for xUnit project looked like this
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
That setup worked on OSX, but did not work on Windows with error message Error NETSDK1136: The target platform must be set to Windows (usually by including '-windows' in the TargetFramework property) when using Windows Forms or WPF, or referencing projects or packages that do so.
Changing it to
<PropertyGroup>
<TargetFramework>net5.0-windows</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
fixes Windows problem, but it starts failing on OSX (with same error message, which is weird, as we are no longer on Windows).
I tried few other options, but could not make it to succeed on both machines.
<PropertyGroup>
<TargetFramework Condition=" '$(OS)' == 'Windows_NT' ">net5.0-windows</TargetFramework>
<TargetFramework Condition=" '$(OS)' != 'Windows_NT' ">net5.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<PropertyGroup>
<TargetFrameworks>net5.0;net5.0-windows</TargetFrameworks>
<IsPackable>false</IsPackable>
</PropertyGroup>
I also tried with Choose, When and Otherwise, but it looks like you cannot wrap TargetFramework into that at all.
Am I doing it completely wrong or it it just some coincidence that correct code does not work in my case?
Try to place Condition inside PropertyGroup not TargetFramework .
Try the code below
<PropertyGroup Condition=" '$(OS)' != 'Windows_NT' ">
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition=" '$(OS)' == 'Windows_NT' ">
<TargetFrameworks>netstandard2.0;net45</TargetFrameworks>
</PropertyGroup>
I am trying to publish my asp.net-core app via command line and use the "PublishedTrimmed" functionality.
I tried this both via
dotnet build -c Release './project.csproj' /p:DeployOnBuild=true /p:PublishProfile=FolderProfile
and
dotnet publish -c Release './project.csproj' -o "outputPath"
The publish profile used in the build command looks like this:
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<PublishProvider>FileSystem</PublishProvider>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>True</ExcludeApp_Data>
<ProjectGuid>1b763e24-74f7-453c-bf79-210861cd0fd7</ProjectGuid>
<publishUrl>[redacted]</publishUrl>
<DeleteExistingFiles>True</DeleteExistingFiles>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
<PublishSingleFile>False</PublishSingleFile>
<PublishTrimmed>True</PublishTrimmed>
<SelfContained>true</SelfContained>
</PropertyGroup>
</Project>
To use the publish command i added the relevant code to the csproj file as follows:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
<SelfContained>true</SelfContained>
<IsTransformWebConfigDisabled>true</IsTransformWebConfigDisabled>
<PublishSingleFile>True</PublishSingleFile>
<PublishTrimmed>True</PublishTrimmed>
</PropertyGroup>
</Project>
Sadly all tries i made resulted in the same error:
C:\Program Files\dotnet\sdk\3.1.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.ILLink.targets(83,5): error MSB6006: "dotnet.exe" has exited with error code -532462766.
This also happens if I use built in publish button in Visual Studio 2019
I have currently only the v.3.1.101 (x64) .net-core SDK installed and it builds and publishes correctly when not using 'PublishTrimmed'
The error message isn't really helping me much, so can anyone tell me why this error occurs and how to solve the problem?
Thanks!
I begun working on a new ASP.NET Core RC1 project months ago, and Publishing with Visual Studio 2015, was producing a folder tree ready to deploy without the project C# sources (because it was compiling it in assemblies placed into the folder tree).
Now that I've upgraded the Visual Studio (only the VS, not the project that remains in 1.0.0-rc1-final) with latest updates (circa May, 19 2016):
"Microsoft .NET Core 1.0.0 RC2 - VS 2015 Tooling Preview 1", "Microsoft .NET Core 1.0.0 RC2 - SDK Preview 1 (x64)", "Microsoft ASP.NET 5 RC1 Update 1" (1.0.11123.0) and "Microsoft ASP.NET 5 RC1 Update 1" (1.0.20204.0)
it looks that the new Publish functionality of latest VS2015 updates, does not compile anymore the sources, instead it places into the Publish folder tree the project c# sources.
Can someone please indicate me how to force VS Publish functionality to compile again instead copying c# sources into the Publish Folders?
we removed this option ("Compile source files into NuGet packages") from the Publish dialog in rc2 tooling because this is not applicable for dotnet projects any more.
In order to publish an rc1 project with the –no-source option from VS, you can add this target to the pubxml (target needs to be inside the project and outside the propertygroup).
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<all your existing property group values>
</PropertyGroup>
<Target Name="DnuNoSourcePublish" AfterTargets="GatherAllFilesToPublish" Condition=" '$(CompileSource)' == 'true' ">
<Exec
Condition="Exists('$(PublishOutputPath)') and '$(PublishOutputPath)'!='' "
Command="rmdir /S /Q "$(PublishOutputPath)""
WorkingDirectory="$(MSBuildProjectDirectory)" />
<PropertyGroup>
<DnuCommand>"$(SDKToolingDirectory)\bin\dnu.cmd" publish</DnuCommand>
<RuntimeArgument Condition=" '$(FinalPublishVersion)' != '' " >--runtime $(FinalPublishVersion)</RuntimeArgument>
<WwwRootArgument Condition=" '$(WebRoot)' != '' " >--wwwroot $(WebRoot)</WwwRootArgument>
<WwwRootOutArgument Condition=" '$(WwwRootOut)' != '' " >--wwwroot-out $(WwwRootOut)</WwwRootOutArgument>
<IISCommandArgument Condition =" '$(IISCommand)' != ''">--iis-command $(IISCommand)</IISCommandArgument>
<NoSourceArgument Condition=" '$(CompileSource)' == 'true' ">--no-source</NoSourceArgument>
<NativeArgument Condition="'$(NativeFlag)' == 'true'">--native</NativeArgument>
<IncludeSymbolsArgument Condition=" '$(IncludeSymbolsFlag)' == 'true'">--include-symbols</IncludeSymbolsArgument>
<QuietArgument Condition=" '$(QuietFlag)' == 'true'">--quiet</QuietArgument>
</PropertyGroup>
<Exec
Command="SET PATH=$(ExternalToolsPath);#(DnuPublishEnvironmentVariables)
$(DnuCommand) "$(KPackWorkingDirectory)" --out "$(PublishOutputPathNoTrailingSlash)" --configuration $(PublishConfiguration) $(RuntimeArgument) $(WwwRootArgument) $(WwwRootOutArgument) $(IISCommandArgument) $(NoSourceArgument) $(QuietArgument) $(NativeArgument) $(IncludeSymbolsArgument)"
WorkingDirectory="$(KPackWorkingDirectory)"/>
</Target>
</Project>
Make sure your property group has this property set
<CompileSource>true</CompileSource>
Looking how VS was publishing prior to the RC2 updates, I noticed the two:
C:\Users\(user)\.dnx\runtimes\dnx-clr-win-x86.1.0.0-rc1-update1\bin\dnu.cmd publish "(destinationFolder)" --out "C:\Users\(user)\AppData\Local\Temp\PublishTemp\(tempFolder)" --configuration Debug --no-source --runtime dnx-clr-win-x86.1.0.0-rc1-update1 --wwwroot "wwwroot" --wwwroot-out "wwwroot" --iis-command "web" --quiet
"C:\Program Files (x86)\IIS\Microsoft Web Deploy V3\msdeploy.exe" -source:contentPath='C:\Users\(user)\AppData\Local\Temp\PublishTemp\(tempFolder)\' -dest:contentPath='(destinationFolder)' -verb:sync -retryAttempts:2 -disablerule:BackupRule
so, deleting the two folders: (destinationFolder) and C:\Users\(user)\AppData\Local\Temp\PublishTemp\(tempFolder), and running the two commands above "by hands" in command prompt, I obtained the wanted result
I have a problem with Sqlite in my Windows Phone 8 app. I followed the ususal guides, where you have to add sqlite-net and sqlite-net-wp8 NuGet package, then add compilation parameter USE_WP8_NATIVE_SQLITE and then add link to Sqlite for Windows Phone Visual Studio Extension.
I have a problem with the last step because it requires specific Visual Studio extension to be installed and therefore it's not compatible with our requirement to have all source files and libraries in Git repository, without need to install any additional plugins when running Continuous integration or setting a machine for a new developer.
When I tried to add reference to the sqlite3.dll located in
C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\ExtensionSDKs\SQLite.WP80\3.8.7.4 \Redist\Retail\x86\sqlite3.dll
I got error "A reference to a higher version or incompatible assembly cannot be added to the project."
Is there a way how to overcome this problem and have all necessary Sqlite libraries in my Git repository, without referencing VS Extensions that need to be installed?
I know this is old, but I recently did something similar. Here is the approach I took:
Install the extension, and copy the files from C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\ExtensionSDKs\SQLite.WP80 and copy to your $(SolutionDir)packages directory
Edit the $(SolutionDir)packages\DesignTime\CommonConfiguration\neutral\SQLite.WP80.props file that is included in the package and change the path of IncludePath and LibraryPath:
<IncludePath>$(SolutionDir)packages\SQLite.WP80\latest\DesignTime\CommonConfiguration\Neutral;$(IncludePath)</IncludePath>
<LibraryPath>$(SolutionDir)packages\SQLite.WP80\latest\DesignTime\$(PackageConfiguration)\$(PlatformTarget);$(LibraryPath)</LibraryPath>
Modify the SQLite.vcxproj file
A. Add Property groups to add location of sqlite3.dll
`
<PropertyGroup>
<SQLiteBase>$(SolutionDir)packages\SQLite.WP80\latest\Redist</SQLiteBase>
<SQLiteWin32Debug>$(SQLiteBase)\Debug\x86</SQLiteWin32Debug>
<SQLiteWin32Release>$(SQLiteBase)\Retail\x86</SQLiteWin32Release>
<SQLiteArmDebug>$(SQLiteBase)\Debug\ARM</SQLiteArmDebug>
<SQLiteArmRelease>$(SQLiteBase)\Retail\ARM</SQLiteArmRelease>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<SQLiteBinPath>$(SQLiteWin32Debug)</SQLiteBinPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<SQLiteBinPath>$(SQLiteWin32Release)</SQLiteBinPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|Win32' ">
<SQLiteBinPath>$(SQLiteWin32Debug)</SQLiteBinPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|Win32' ">
<SQLiteBinPath>$(SQLiteWin32Release)</SQLiteBinPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|ARM' ">
<SQLiteBinPath>$(SQLiteArmDebug)</SQLiteBinPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|ARM' ">
<SQLiteBinPath>$(SQLiteArmRelease)</SQLiteBinPath>
</PropertyGroup>
`
B. Change the ImportGroup for the props file to reference the path in solution:
<ImportGroup Label="PropertySheets">
<Import Project="$(SolutionDir)packages\SQLite.WP80\version\DesignTime\CommonConfiguration\Neutral\SQLite.WP80.props" />
</ImportGroup>
C. Change the ItemGroup where the it references the SDK and change it to add the sqlite3.dll
<ItemGroup>
<CustomBuild Include="$(SQLiteBinPath)\sqlite3.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</DeploymentContent>
</CustomBuild>
</ItemGroup>
This copying the SQLite SDK files "locally" with this extension https://visualstudiogallery.msdn.microsoft.com/1f027247-1e01-4ec6-8f5b-70dabb375217.