Why do the webparts is change from CodeBehide to CodeFile when import a package

giang le asked on April 21, 2016 10:43

Hi all,

As my subject, when I export a site from my local site to import to server and all my webpart start with

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="xxx.ascx.cs" Inherits="xxxx" %>

But after I import to server then I check these webparts in FTP server, all of them are changed to start with:

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="xxx.ascx.cs" Inherits="xxxx" %>

So that my code (use RequestStockHelper function) always return null.

Can you tell me why my webparts are changed as above? How to keep all files with "CodeBehide" format?

Note: When I import, I have selected "Import Code File" option.

Recent Answers


David te Kloese answered on April 21, 2016 12:03

Hi,

CodeFile (is dynamic), not sure if it's a feature of Kentico but if you use a WebApplication project the code files usually are in a separate dll (so using CodeBehind).

Is your project setup as a webapplication or a website project? If it's a web application you should not select the export/import files, and just deploy the .dll.

1 votesVote for this answer Mark as a Correct answer

giang le answered on April 21, 2016 12:10

My project is webapplication project and I think we should import/export ascx file, correct? Because I often do that when import any changes in UI from local. DLL just contain codebehide code, not ascx code. But I don't understand why Kentico convert my ascx file from CodeBehide to CodeFile when I import.

1 votesVote for this answer Mark as a Correct answer

David te Kloese answered on April 21, 2016 13:31

Hi,

I think because you're explicitly saying to export/import files. Can you try without the "include files" option checked.

0 votesVote for this answer Mark as a Correct answer

giang le answered on April 21, 2016 13:37

If I un-check this option, all new ascx files is not copied overwrite to server.

1 votesVote for this answer Mark as a Correct answer

David te Kloese answered on April 21, 2016 13:43

Ah, of course... wasn't thinking! I usually deploy files manually.

Can you look into the export package itself with explorer (its just a zip with xml files) and see if the filechange is there (so its caused during export) or not (so caused during import).

0 votesVote for this answer Mark as a Correct answer

giang le answered on April 21, 2016 14:30

I think its cause during import. beucause I checked in export,these webparts are still "CodeBehide". It only changed after import successful.

1 votesVote for this answer Mark as a Correct answer

giang le answered on April 22, 2016 12:38

Hi all,

I have compared my old exported file and new exported file and I found the different is in the key "webapplication" of 'cms_info.xml.export' file. This key changed from False to True. I guess this is root cause, but I don't understand why this value is changed.

This is value in "cms_info.xml.export" of error package:

    <cms_info>
      <Key>webapplication</Key>
      <Value>True</Value>
    </cms_info>

Thanks!

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.