So I have been trying to create an APK in Release mode using the MSBuild command line executable.
Here is the contents of my batch file which I created:
ECHO Building DsdMobile Solution... >CON
cd "C:\Ross\DEVELOPMENT\HANDHELD\Android\Dsd Mobile MaterialDesign"
"C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" DsdMobile.sln /P:Configuration=Release /v:quiet /t:Clean /nologo
"C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" DsdMobile.sln /P:Configuration=Release /v:quiet /t:Rebuild,PackageForAndroid /nologo
The first line I change the directory to my solution location. Next, I do a Clean
Last, I do a Rebuild and PackageForAndroid (which I am expecting a ...apk file in my bin release folder. An apk is never created and I get an error.
The build is successful, but I get an error:
"C:Ross\Development\Handheld\Android\Dsd Mobile MaterialDesign\DsdMobile.sln.metaproj : error MSB4057: The target "PackageForAndroid" does not exists in the project. [C:\Ross\DEVELOPMENT\HANDHELD\Android\Dsd Mobile MaterialDesign\DsdMobile.sln]
I have also tried to use SignAndroidPackage
's :t/
parameter, but this also fails with the same error:
"C:Ross\Development\Handheld\Android\Dsd Mobile MaterialDesign\DsdMobile.sln.metaproj : error MSB4057: The target "SignAndroidPackage" does not exists in the project. [C:\Ross\DEVELOPMENT\HANDHELD\Android\Dsd Mobile MaterialDesign\DsdMobile.sln]
The resource I have been using was from a PowerShell script:
https://gist.github.com/postb99/8319234
Try building the Android csproj file instead of the solution file.
This works just fine for me from Visual Studio 2017 and 2019 command line prompts:
msbuild /t:SignAndroidPackage /p:Configuration=Release Application.Android.csproj
As already noted, build the csproj not the solution.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With