Segregating designtime from runtime

  • Thread starter General Chaud Caliente
  • Start date
G

General Chaud Caliente

I am working on a .NET component library and I am trying to figure out
how to segregate designtime code from the runtime assembly. Delphi made
this easy.

My natural inclination is to put all of the designtime source files into
their own namespace and drop them into a sub-folder under the main
source folder. Then create a design project which contains all of the
runtime code, as well as all of the designtime code. The runtime
assembly would be called whatever.dll and the designtime assembly would
be called design.whatever.dll. All of that is easily done.

The problem is instructing the compiler to substitute the runtime
assembly for the assembly which was used at compile time.

In the compact framework, there is an attribute called "RuntimeAssembly"
that instructs the compiler to deploy another assembly to the device.
This is absolutely necessary in the compact framework, but also
desirable in the full framework.

If anyone out there has an idea on how to target a different assembly at
runtime, I'd sure be happy to hear about it.

--
With Regards,

General Chaud Caliente
www.ScaryShark.com

Note: My email address is spam proofed. Replace _spam@proofing_ with @.
 
J

Jim Cheshire [MSFT]

Hi General,

You can't target a different assembly at runtime, but you can run certain
code depending upon whether you are in design-time or runtime by checking
HttpApplication.Context which will be null if you are in design-time.

Jim Cheshire [MSFT]
Developer Support
ASP.NET
(e-mail address removed)

This post is provided as-is with no warranties and confers no rights.

--------------------
 
V

Victor Garcia Aprea [MVP]

Hi guys,

I would highly recommend to have your design-time code implemented in its
own assembly, i.e.:

YourCompany.YourControls.dll
YourCompany.YourControls.Design.dll

instead of filling your code checking if you're at design-time or run-time.
You'll need to deploy both files; but at run-time, the .Design assembly
won't be used.

Not sure why you want to mess with the compiler for this.

--
Victor Garcia Aprea
Microsoft MVP | ASP.NET
Looking for insights on ASP.NET? Read my blog:
http://obies.com/vga/blog.aspx
To contact me remove 'NOSPAM'. Please post all questions to the newsgroup
and not by private mail.


Jim Cheshire said:
Hi General,

You can't target a different assembly at runtime, but you can run certain
code depending upon whether you are in design-time or runtime by checking
HttpApplication.Context which will be null if you are in design-time.

Jim Cheshire [MSFT]
Developer Support
ASP.NET
(e-mail address removed)

This post is provided as-is with no warranties and confers no rights.

--------------------
Date: Fri, 17 Oct 2003 16:45:21 -0600
From: General Chaud Caliente <gcc_spam@proofing_scaryshark.com>
Reply-To: gcc_spam@proofing_scaryshark.com
Organization: Scary Shark Limited
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5b) Gecko/20030723 Thunderbird/0.1
X-Accept-Language: en-us, en
MIME-Version: 1.0
Subject: Segregating designtime from runtime
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.aspnet.buildingcontrols
NNTP-Posting-Host: co-ratlsnk-u2-c6c-116.clspco.adelphia.net 68.71.60.116
Lines: 1
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet.buildingcontrols:7812
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.buildingcontrols

I am working on a .NET component library and I am trying to figure out
how to segregate designtime code from the runtime assembly. Delphi made
this easy.

My natural inclination is to put all of the designtime source files into
their own namespace and drop them into a sub-folder under the main
source folder. Then create a design project which contains all of the
runtime code, as well as all of the designtime code. The runtime
assembly would be called whatever.dll and the designtime assembly would
be called design.whatever.dll. All of that is easily done.

The problem is instructing the compiler to substitute the runtime
assembly for the assembly which was used at compile time.

In the compact framework, there is an attribute called "RuntimeAssembly"
that instructs the compiler to deploy another assembly to the device.
This is absolutely necessary in the compact framework, but also
desirable in the full framework.

If anyone out there has an idea on how to target a different assembly at
runtime, I'd sure be happy to hear about it.

--
With Regards,

General Chaud Caliente
www.ScaryShark.com

Note: My email address is spam proofed. Replace _spam@proofing_ with @.
 
G

General Chaud Caliente

Victor said:
Not sure why you want to mess with the compiler for this.

Because I don't want users of my controls to deploy my designtime stuff.
If you have my designtime stuff you can easily load the assemblies
into visual studio and use the components to write your own software
without having to pay me for the right to use my product.

Designtime functionality should never be shipped to an end user.

ever.

That should be expressly forbidden by the license. Users of my
component libraries (developers) have paid me for the right to use the
product in their own creations, as well as the right to deploy a runtime
only version of my components for their end-users.

I am having a hard time believing that Visual Studio makes it difficult
to separate designtime code from runtime code. This is crazy.
 
V

Victor Garcia Aprea [MVP]

Because I don't want users of my controls to deploy my designtime
stuff.
If they're using your control to develop an app they will need your
design-time stuff, period.
The whole idea of separating runtime and designtime code is not to stop
someone from pirating your component but to avoid the need to deploy
designtime code with the final app (smaller final size, smaller memory
footprint, etc)
Let's see if we can agree on a few terms here:
1) You = control developer
2) Your client = page developer - building an app
3) Your client's client = end user using the app built using your controls
At 2) you will need to ship runtime & designtime assemblies; At 3) only
runtime assembly will be needed. This is actually possible today, without
doing anything special.
Well, not having your design-time stuff won't stop anyone from using your
component, they may not have a nice design-time experience, but not having
designer-support should not stop them from deploying and using your control.
There are other better mechanisms (which doesn't include messing with
design-time support), i.e. a licensing scheme, to make it harder for
unauthorized people from using your components.

Bottom line, I think you're trying to protect your controls from piracy with
the wrong approach.

--
Victor Garcia Aprea
Microsoft MVP | ASP.NET
Looking for insights on ASP.NET? Read my blog:
http://obies.com/vga/blog.aspx
To contact me remove 'NOSPAM'. Please post all questions to the newsgroup
and not by private mail.
 
J

Jim Cheshire [MSFT]

General,

You need to use a license provider. Here are some links that might help
you. The first one is probably best for your situation.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html
/aspnetcontrollicensing.asp
http://support.microsoft.com/default.aspx?kbid=822680
http://www.developer.com/net/asp/article.php/3074001

Jim Cheshire [MSFT]
Developer Support
ASP.NET
(e-mail address removed)

This post is provided as-is with no warranties and confers no rights.


--------------------
 
G

General Chaud Caliente

Bottom line, I think you're trying to protect your controls
from piracy with the wrong approach.

No. I am trying to find out how to separate designtime from runtime so
that my users don't have to deploy designtime code.
At 2) you will need to ship runtime & designtime assemblies; At
3) only runtime assembly will be needed. This is actually
possible today, without doing anything special.

*NOW* we're getting somewhere...

.... and exactly how do I do that?
 
V

Victor Garcia Aprea [MVP]

No. I am trying to find out how to separate designtime from runtime so
Ok. Your previous post about your concern about people using your components
without paying for them made me believe you were looking for a licensing
solution.

As I said before, there is nothing special about this; you just build two
assemblies, one containing your control's runtime code and the other one for
contanining their design-time stuff. If you're encountering any specific
errors/problems while doing this, please detail them.

--
Victor Garcia Aprea
Microsoft MVP | ASP.NET
Looking for insights on ASP.NET? Read my blog:
http://obies.com/vga/blog.aspx
To contact me remove 'NOSPAM'. Please post all questions to the newsgroup
and not by private mail.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top