Error placing conditional build on Assemblyinfo.Cs file

Asked

Viewed 193 times

0

When I put this in my Assenblyinfo.Cs do not compile

#if DEBUG
[assembly: Application(Debuggable=true)]
#else
[assembly: Application(Debuggable=false)]
#endif

and gives error in almost all classes.

Unexpected "Generatejavastubs" task failure. System.Invalidoperationexception: Application cannot have Both a type with an [Application] attribute and an [Assembly:Application] attribute. in Xamarin.Android.Tasks.ManifestDocument.Createapplicationelement(Xelement manifest, String applicationClass, List1 subclasses, List1 selectedWhitelistAssemblies) in Xamarin.Android.Tasks.ManifestDocument.Merge(List1 subclasses, List1 selectedWhitelistAssemblies, String applicationClass, Boolean embed, String bundledWearApplicationName, Ienumerable`1 mergedManifestDocuments) on Xamarin.Android.Tasks.GenerateJavaStubs.Run(Directoryassemblyresolver res) in Xamarin.Android.Tasks.GenerateJavaStubs.Execute() in Microsoft.Build.Backend.TaskExecutionHost.Microsoft.Build.Backend.ITaskExecutionHost.Execute() in Microsoft.Build.Backend.TaskBuilder.d__26.Movenext() Authorizer.Android

so was the file Assemblyinfo.Cs

using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Android.App;
using Xamarin.Forms;

#if DEBUG
[assembly: Application(Debuggable=true)]
#else
[assembly: Application(Debuggable = false)]
#endif

// General Information about an assembly is controlled through the following 
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Autorizador.Android")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Autorizador.Android")]
[assembly: AssemblyCopyright("Copyright ©  2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]

// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version 
//      Build Number
//      Revision
//
// You can specify all the values or you can default the Build and Revision Numbers 
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

// Add some common permissions, these can be removed if not needed
[assembly: UsesPermission(Android.Manifest.Permission.Internet)]
[assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)]
//[assembly: ExportRenderer(typeof(TabbedPage), typeof(BadgedTabbedPageRenderer))]

Do I need to enable some permission or not? I am waiting.

  • 1

    Have you entered this attribute in your Assemblyinfo and class? The error is saying that it cannot occur.

  • @Gabrielcoletta, that’s right. I was sorry, I should have read more details. The mistake is all mine.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.