Delivering a web application without distributing source code

We develop and sell a classic ASP web application (VBscript) which we aim to rebuild in ASP.NET (VB.NET). We will be using Visual Studio 2005 to develop the ASP.NET application.

Once the ASP.NET version of the application is ready to be distributed to our customers, we don't want them to receive the full source code anymore. Instead, we'ld like to distribute DLLs.

How do we best setup the development environment now so that we're able to create those DLLs lateron?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Christopher KileCommented:
First, make sure all server code is relocated from the .ASPX to code-behind files.  Code-behind files are one of the significant changes when moving from ASP to ASP.NET:  instead of using a dialect of VBScript designated to run on the server that is mixed in with the HTML and client script in one file, server code is moved to a VB.NET source file, which is then compiled (with any other VB.NET source files in your project) into a .DLL.

Client-side script will still be visible, as it is interpreted code that must run on the client (only code compiled into the DLL will not be visible).  Does this meet your requirements?
MarjaRAuthor Commented:
Thank you for your fast reply, but this is not exactly the information I'm looking for.

I know about code-behind. What I need to know is how to create a compiled version of the application so that we can deliver that to our customers without the source code.

We're now building several application classes in the App_Code directory. How would we create DLLs from that lateron?
Christopher KileCommented:
Well, first of all, don't place them in the App_Code directory.  That directory is SPECIFICALLY for code that will be compiled when it's referenced.  Instead of placing code in the App_Code directory, place that code in separate projects, compile these projects into DLLs, place these DLLs in the BIN directory of your ASP.NET application and reference them in that location.  This way, you distribute the DLLs instead of the source files.  Does this make sense?
Exploring SQL Server 2016: Fundamentals

Learn the fundamentals of Microsoft SQL Server, a relational database management system that stores and retrieves data when requested by other software applications.

Faizan SarwarSoftware / Database DeveloperCommented:
check Build menu then Publish Website the wizard will generate DLLs for you
Christopher KileCommented:
sm394's suggestion seems to make sense.  I've done some supporting research and found these two links which should be helpful

in this thread on ASP.NET forums

This article discusses the ins and outs of building a Web Deployment project, and includes a downloadable example:

This is a blog article from Scott Guthrie, who is apparently one of the development managers at MS, and this article delves into what the features do and how to use them best - and one of the scenarios he discussses seems to be what you are looking for:

Good luck, and good hunting.  Remember to give sm394 credit for pointing the way to this.
MarjaRAuthor Commented:
So where do I put my application classes if I shouldn't put them in the App_Code directory?

If I put them anywhere else in the directory structure, the application can't find them when trying to build/run.

Eg. I have a custom DataProvider class which is named wsDataProvider. When I don't put this class file in the App_Code directory, I get a compilation error when trying to instantiate a wsDataProvider object:

Dim l_oDP As wsDataProvider = New wsDataProvider()

Compiler Error Message: BC30002: Type 'wsDataProvider' is not defined.

Christopher KileCommented:
You put the compiled DLLs in the bin directory, then build a reference to that DLL in your bin directory.  You don't put the code there, just the compiled DLL.
MarjaRAuthor Commented:
Ah, but then the application classes are developed and compiled in a separate project, and not in the website project itself?
Should the website project itself only have ASPX pages with code-behind files then, and no other custom classes?
Christopher KileCommented:
Frankly, if you include the custom classes in the code without .ASPX pages (just as .vb or .cs files) then they get compiled in the main application DLL.  I have numerous examples of this in my own projects here.  Compiling these objects in separate DLLs does allow them to be used in multiple projects, however, so you may find this desirable, even if it isn't necessary.
MarjaRAuthor Commented:
As I said, I now have the custom classes in the App_Code directory of the website project, because otherwise I get compilation errors (see earlier in this thread).
I can't instantiate custom objects, unless the VB source files are placed in the App_Code directory.
MarjaRAuthor Commented:
I now created 2 Visual Studio projects:
1) a project of type "class library" in which I put my custom classes (general purpose classes and some business logic classes)
2) a project of type "web application" in which I will be creating web pages that use the custom classes from the class library

I built the class library and copied the resulting DLL to the BIN directory of the web application project. And in the web.config file of the application I added the line following line which should make sure that all assemblies found in the /Bin folder are to be loaded for the application:
<add assembly="*" />

But now when I try to build the application project, I get compilation errors, because the custom classes can't be found.
What am I missing?
MarjaRAuthor Commented:
I solved this specific problem by explicitly adding a reference in the application project to the DLL in the /bin directory.

I thought it should be possible to use DLLs in the /bin folder without explicitly referencing them in the Visual Studio project?
Christopher KileCommented:
That is exactly what I told you to do earlier, sorry if I didn't make that clearer.  Glad you've got it working :)
Christopher KileCommented:
Sorry, didn't address your question.  No, it's not possible to use a separate DLL in the bin directory without a reference in a .NET application.  I know this sort of thing worked in Win32, as long as the DLL was on the PATH, but in .NET the DLLs are more like COM objects, such that the creation of a reference is like registering a COM DLL with the operating system.  Does this make sense?  It does seem to work, yes? :)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MarjaRAuthor Commented:
Rereading this thread, I see indeed that you told me this earlier. But being new to this whole ASP.NET thing, I just didn't grasp it all at once.

Thank you for your time and effort and for your patience!  :)
MarjaRAuthor Commented:
It's working fine now. I've learned a lot. Thanks again!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.