简体   繁体   中英

Build order issue in an ASP.net Web Site

I had a Web Application that used to work just fine but I needed to use VB and C# and that's why I started the project as a Web Site.

I created two subfolders into the App_Code folder and I wrote this in the web.config file:

<codeSubDirectories>
  <add directoryName="VB_Code" />
  <add directoryName="CS_Code" />
</codeSubDirectories>

Then, I placed my Entity Data Model in the root of the App_Code folder. This way, I received the follow warning when I tried to compile:

Namespace or type specified in the Imports 'ProductizationModel' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.

and a lot of errors related with this fact: the EDM was not builded and its namespace didn't exist yet. This errors come from classes that access to the database through my EDM and that are declared inside the VB_Code folder.

Then, after research, I find that VS follows a build order and that the subfolders inside the App_Code are builded before the files in the root.

I've created one more subfolder called EF_Code and declared it in the web.config file:

<codeSubDirectories>
  <add directoryName="EF_Code"/>
  <add directoryName="VB_Code" />
  <add directoryName="CS_Code" />
</codeSubDirectories>

but I'm still receiving the same warnings and errors.

Anybody can light me?

Thanks a lot,

If I'm reading your question right, it sounds like you need your VB_Code folder to come first. While mixing languages is acceptable in a web site, this is definitely a bad usage of it. If you need to have these kinds of dependencies, I would recommend that you create separate projects for these classes and reference them directly. Even if you intend to continue using the App_Code folder to store your classes, setting up library projects in this manner may help you identify dependencies that are creating these conflicts.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM