I need my application to start with administrator
privilege. When I do it in app.manifest:

level="asInvoker" uiAccess="false" />'


uiAccess="false" />'

I can start my application with administrator privilege.
But it starts every time the application starts. I need to
start the application with administrator privilege only once at
the first time of application usage.

Actually, I need to make the application to start with
windows instead of starting manually. So to do that I

\Run", True).SetValue

But it requires administrator privilege else it fails.

I suggest you create some sort of installation package which runs with admin rights to deal with registry.

But if your actual app needs to also manipulate reg HKLM then that will need admin rights too.

As suzie999 said, the only way to do that is to have a installer app.
So create a installer app in c# and make it copy your main app to its location and then create the registry key.

In your main app, check if the installer app is there and delete it.

Is theren't any ways to edit app.manifest file in runtime?