none
UWP Code Behind Not Generated (g.i.cs) RRS feed

  • Question

  • When you create a Xaml file in Visual Studio, it automatically adds another file which has the same name, but with a .cs extension. Also, a "g.i.cs" file is created and placed in the obj folder. This file is hidden from Visual Studio but it contains all the definitions for the variables created by controls defined in Xaml. This works, but if the obj folder is deleted, the files are never created again until you open up the original Xaml file, change something, and then save the file. "Run Custom Tool" should generate the file, but this doesn't work either. Why is the happening? Do other people experience this?

    NOTE: This is NOT a UWP problem. This is a Visual Studio problem so please do not shift this thread in to a UWP section.

    • Moved by 宝宝徐 Monday, September 19, 2016 5:20 AM
    Thursday, September 15, 2016 3:04 AM

All replies

  • Hi MelbourneDeveloper,

    Thanks for your post.

    On my side, i delete the obj folder, after restart the VS or choose to refresh or build the UWP project again,

    the obj folder shows again (contain the "g.i.cs" file ).

    As we know, the "obj" folder is used to store temporary object files and other files used to create the final binary. If there is not any operation after delete the obj folder, obviously this folder is not created.

    So let's make these question be simplistic, if you delete the obj folder, just refresh or build it again.

    >> and then save the file. "Run Custom Tool" should generate the file, but this doesn't work

    Before choosing " Run Custom Tool", please compile your project first.

    Best Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.

    Click HERE to participate the survey.

    • Proposed as answer by 宝宝徐 Friday, September 16, 2016 1:53 AM
    • Unproposed as answer by MelbourneDeveloper Sunday, September 18, 2016 10:24 PM
    Thursday, September 15, 2016 8:11 AM
  • Lana,

    I created a new UWP process and followed the same process as you. I got the same result as you.

    However, in the project I am working on, this is not the case. The code behind code is never generated.

    Friday, September 16, 2016 7:02 AM
  • Hi MelbourneDeveloper,

    If you got the result as mine when creating a new UWP project, the root cause of this issue may be related to the project you are working on.

    Is it possible that some part of your project block generating the file under g.i.cs" file, or the whole project size is really big that could affect this?

    Since Our forum is discussing about VS general question like how to set/configure Visual Studio and Visual Studio tools, as your question seems pend on your specific project, how about checking your project to exclude some potential problems.

    Thanks for your understanding.

    Best Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.

    Click HERE to participate the survey.

    Friday, September 16, 2016 7:23 AM
  • I agree that it must be something that is specific to my project. Visual Studio is not behaving correctly for this particular project.

    How can I diagnose what the problem is?

    Sunday, September 18, 2016 10:25 PM
  • Hi MelbourneDeveloper,

    We are willing to help you find out the cause, but currently we have no idea about your project, so we couldn't reproduce this issue on my side. but you mentioned in your initial post that it's not a UWP problem, things are quite complicated. You need to diagnose this root cause on your own.

    Thank you for your understanding.

    Best Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.

    Click HERE to participate the survey.

    Monday, September 19, 2016 1:24 AM
  • I realise that, but I'm posting on this forum to get some ideas on what to try.

    Just saying that I'm on my own isn't helpful.

    Monday, September 19, 2016 3:37 AM
  • Hi my friend,

    I think i'm not capable help you deal with this issue currently, but you could share us your project , we could do a test about it on our side to see if the same issue happens.

    Best Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.

    Click HERE to participate the survey.


    • Edited by 宝宝徐 Monday, September 26, 2016 7:59 AM
    Monday, September 19, 2016 5:20 AM
  • That was very unhelpful.
    Monday, September 19, 2016 6:10 AM