Why I cannot access project properties in "plugins" section of build.gradle.kts with Gradle Kotlin DSL (5.0)?

visual studio 2019 project properties not showing
there are no property pages for the selection
visual studio project properties does not open
an error occurred trying to load the project properties window. close the window and try again.
visual studio project properties missing
visual studio 2017 properties window not showing
visual studio properties window
visual studio c# project properties

Gradle 5.0, Kotlin DSL

Create gradle.properties file:

kotlinVersion=1.3.10

Create build.gradle.kts file:

val kotlinVersion: String by project

println(kotlinVersion) // works

plugins {
    kotlin("jvm").version(kotlinVersion)
    //                    ^ Unresolved reference: kotlinVersion

}

repositories {
    jcenter()
}

tasks.register("compute") {
    doLast {
        println(kotlinVersion) // works
    }
}

Run gradle compute, then change

kotlin("jvm").version(kotlinVersion)

to

kotlin("jvm").version("1.3.10")

and run again. Everything works.

Am I just doing something wrong? Or is it some sort of limitation or a bug?

I just wanted to move the Kotlin version out of the build script, so I could play with changing it later (e.g. via command line, ... -PkotlinVersion=1.3.0) and also to keep it the same both for dependencies and plugins.


The plugins block is evaluated separately from the rest of the build script, because the set of plugins you're using determines the classpath (and the name resolution scope) for the rest of the build script. Because of that, declarations outside of the plugins block cannot be used inside that block.

Can't open project properties page., Can't open project properties page. Works well in vs2017. Hide comments 5  You access project properties by right-clicking the project node in Solution Explorer and choosing Properties or by typing properties into the search box on the menu bar and choosing Properties Window from the results. .NET projects might also have a properties node in the project tree itself.


As @yole said in his answer, the plugins { ... } block is a special construct that is evaluated before the rest of the build script and has limited access to the Gradle model.

One way to pass a property and use it in the plugins { ... } DSL is to use system properties:

val kotlinVersion = System.getProperty("kotlinVersion")?.toString() 
    ?: error("Add a 'kotlinVersion' system property or pass -DkotlinVersion=...")
id("org.jetbrains.kotlin.multiplatform").version(kotlinVersion)

The way to pass a system property via command line is -DkotlinVersion=1.3.0.

Can't open project property in visual studio 2015 with Unity 5.3.2 , Found out the fix! You have to enable the "Access to project properties" option in the Tools>Options>Tools for Unity>General" section. Then just restart VS, and it should let you open the properties panel. To quote Venryx: "You have to enable the "Access to project properties" option in the Tools>Options>Tools for Unity>General" section. Then just restart VS, and it should let you open the properties panel." 8


I typically use the buildSrc directory to define objects that represent versions or properties that I wish to reuse, especially when I have multiple projects or multiple dependencies that stay lock-step with versioning. I put together a little example project here that demonstrates usage.

In buildSrc/src/main/kotlin/Versions.kt I have:

object Versions {
    // Library versions
    val Kotlin = "1.3.10"
    val logback = "1.2.3"

    // Plugin versions
    object Plugins {
        // Can be changed if we want to use a version other than one matching the library version
        val Kotlin = Versions.Kotlin
    }
}

And I use it elsewhere like so:

plugins {
    kotlin("jvm") version Versions.Plugins.Kotlin
}

// snip...

dependencies {
    compile(kotlin("stdlib-jdk8"))
    compile(group = "ch.qos.logback", name = "logback-classic", version = Versions.logback)
}

These are statically defined in the Versions.kt file, but you could also read them from the environment, or a file, or properties. The real key is that your buildSrc is evaluated before everything else, so it's available for all of the other phases in your build script (At least all the ones I've tried!).

Getting Project Properties, This walkthrough shows how to displays project properties in a tool Frame)) { throw new NotSupportedException("Cannot create window. You forgot to add settings to the class library project. You cannot access the settings of the EXE project directly. Giving a class library project its own settings is possible but it is a hassle. A DLL cannot have its own .config file, there's only one: the app.exe.config file.


Properties can be accessed by:

project.properties["kotlinVersion"]

Manage project and solution properties, You access project properties by right-clicking the project node in Solution Explorer and choosing Properties or by typing properties into the  You can refer to these methods to access the files/properties. Select a file/folder then press Alt and Enter keys together. Select a file/folder, click on Home option of file explorer and click on Properties. You can also refer to the steps mentioned in the following link. How to work with files and folders


Can't access project properties in VTPro-E : crestron, Can't access project properties in VTPro-E. Help New comments cannot be posted and votes cannot be cast just to clarify, this is what i am trying to access:​. Either in new projects or in existing ones, the properties palette and the project browser seems to be frozen - nothing happens when clicking anywhere in them. It can also occur when the Revit project browser and properties dialog are moved to a second monitor, they stop working.


Topic: Can't access Project Properties, When we right click on the project and try to open “VisualGDB Project in the tray, we see the VisualGDB property page but it cannot be seen or accessed. Do VisualGDB Project Properties work for a newly created project? On the Tools menu, click VBAProject Properties, and then click the General tab (In Word, click Project Properties, and then click the Protection tab). To lock your Visual Basic project, select the Lock Project for Viewing check box.


Configure Project-Specific Properties - Help, Similarly to other ReSharper settings, project-specific properties can be saved a Cannot access file error during the build because ReSharper has temporarily  Displays the Property Pages dialog box or Project Designer for the selected item. Property Pages displays a subset, the same or a superset of the properties available in the Properties window. Use this button to view and edit properties related to your project's active configuration. Properties Displays the properties for an object.