Dinesh Persaud
Dinesh Persaud

Reputation: 155

Publish Asp.Net Solution

I have a solution, Asp.Net web application and inside the solution I have two projects. One contains VB code that handles the UI. forms etc. and the other one C# that basically uses Linq-to-Entity to handle my data. When I run the project from my local computer it works good. Now, to publish, I notice only when the UI Project is selected, the publish option is enabled. Why is that? If I publish this, would the other project not be published? Another question, I have XML files created in app_data folder, when I publish it, will I be able to access it?

Upvotes: 0

Views: 560

Answers (3)

felix Antony
felix Antony

Reputation: 1460

You have two projects inside your solution. One is web project and the next will be a Class Library project. All the codes related to Entity framework, LINQ queries, Database transactions, etc should be in the class library project. while building the class library it will automatically generate the DLL files. then you need only add a reference to the web project file. Then you will get all the classes, methods etc from the class library. there is no need for publishing the class library project. Because you have add the dll reference to your webproject. all the code file inside your App_Code folder shuold be converted to dll while publishing the web project. so dont worry about the files inside the App_code folder data.

Thank you

Upvotes: 0

Farrukh Subhani
Farrukh Subhani

Reputation: 2038

You dont need to publish reference projects individually or even the whole solution. It works simply by referencing the dll of your other project.

  1. Both projects need to be compiled if not already
  2. If your UI project has reference to dll from data layer project it will be published with your UI project.
  3. You can publish it locally in another folder and test using iis express or your local iis and then publish it online with database. Update connection string and it should work if setup correct.

Upvotes: 0

tvanfosson
tvanfosson

Reputation: 532465

Publishing only applies to web projects. If you've included a reference to the other project in your web project, it will be compiled and the DLL will be published along with your web project. Your XML files should be published along with your web project, if they aren't check their properties and make sure they are set to be published with the project (build action set to Content and Copy Always or Copy if newer is selected).

Upvotes: 1

Related Questions