dansiegel / Mobile.BuildTools

The Mobile.BuildTools makes it easier to develop code bases in a clean, consistent, secure, and configurable way. Determine at Build which environment your app needs to run on, and what Client Secrets it should have. Plus many more amazing features!
http://mobilebuildtools.com
MIT License
228 stars 29 forks source link

No AppSettings class is generated during build #318

Closed Sebosek closed 1 year ago

Sebosek commented 1 year ago

Description

I've added BuildTools to my existing Xamarin Forms app, added appsettings.json, and configured buildtools but no class with configuration is generated.

The folder structure is following:

+ .git
+ MyApp
   + MyApp
   + MyApp.Droid
   + MyApp.iOS
  MyApp.sln
  buildtools.json
  appsettings.json

buildtools.json file I've extended with the following:

  ...
  "appSettings": {
    "MyApp": [
      {
        "accessibility": "Internal",
        "className": "AppSettings",
        "namespace": "Helpers",
        "rootNamespace": null,
        "properties": [
          {
            "name": "Sample",
            "type": "String"
          },
          {
            "name": "AppCenterId",
            "type": "String"
          }
        ]
      }
    ]
  },
  "debug": true
}

And finally the appsettings.json

{
  "Sample": "Hello",
  "AppCenterId": "..."
}

Basically, I believe I did everything that should be done by documentation, but no class is generated during the build. But to be honest, I'm not really sure, where should I put appsettings.json. If it's an equivalent of appsettings.json from ASP.NET, then it should be placed into the root project, but the docs said "root folder" not the primary project from the solution.

Reproduction Steps

Steps to reproduce the behavior:

  1. Create a Xamarin Forms project
  2. Do the same as it's written above
  3. Build a project

Expected Behavior

After the project builds a configuration class should be generated.

Actual Behavior

No class is generated

Environment

Open questions

  1. How to define a path for generated class?
  2. In buildtool.json in the "appSettings" prop there is a key, in my case "MyApp". Does this key have any meaning?
  3. Can I move buildtools.json and appSettings.json to the primary (netstandard2.0) project?
dansiegel commented 1 year ago

What you have here looks right but this is why you so often see requirements for a sample app that reproduces an issue. It's really impossible for me to tell you why you were having this issue...