How to add non dll dependencies in a ASP.Net project ?

  • Thread starter Michel de Becdelièvre
  • Start date
M

Michel de Becdelièvre

Here is my scenario :

I have a library libA.dll, this library is built by a project
(projectA), which may be used by several "solutions"
=> 1 dll assembly
=> this library uses a xslt transform => there is a "A.xslt" file
that must be put somewhere inside the project that includes the library, and
a DTD, and a base xml file, and... all these files should be updated at the
same time as the dll

I know how I can tell Visual Studio that my main project depends on
projectA, I know that the library will be AUTOMATICALLY updated when I
change something and copied at the right place.

How can I tell Visual Studio.Net (2003) that I want A.xslt to be
AUTOMATICALLY updated in my main project when I change it in projectA ?
 
S

Scott Allen

One approach would be to add a build event to the class library
project (Project -> Properties -> Common Properties -> Build Events.
The build event can copy the file to the $(SolutionDir) destination.
 
M

Michel de Becdelièvre

Scott Allen said:
One approach would be to add a build event to the class library
project (Project -> Properties -> Common Properties -> Build Events.
The build event can copy the file to the $(SolutionDir) destination.

I'll try that, but it's a "push" approach that does not take modification
times into account. I'd rather "pull" and use timestamps.

Strange there is no more answers : this should be a faily commn scenario if
you are writing Controls that need a Javascript library or a css style
sheet.
 
S

Scott Allen

The other option is to make the files embedded resources in the
assembly - that way the 'family always travels together' so to speak.
I think this is what you'll want if the XLST is being delivered at
runtime.
 
M

Michel de Becdelièvre

Scott Allen said:
The other option is to make the files embedded resources in the
assembly - that way the 'family always travels together' so to speak.
I think this is what you'll want if the XLST is being delivered at
runtime.

--

Great idea. I'll see if I can manage to implement this.

Do you know of a way to do this for JavaScript or css support files ? These
are not pulled out by C# code but by IIS directly.
 
S

Scott Allen

Well - for embedded script it will work best if you use
RegisterClientScriptBlock, like Phil here:
http://haacked.com/archive/2005/04/29/2879.aspx

Of course, you could change the IIS script mappings to route requests
for .js files through the ASP.NET runtime, and implement an
IHttpHandler to dig a script file it doesn't find on disk out of an
assembly...
 
M

Michel de Becdelièvre

Scott Allen said:
Well - for embedded script it will work best if you use
RegisterClientScriptBlock, like Phil here:
http://haacked.com/archive/2005/04/29/2879.aspx

Of course, you could change the IIS script mappings to route requests
for .js files through the ASP.NET runtime, and implement an
IHttpHandler to dig a script file it doesn't find on disk out of an
assembly...

RegisterClientScriptBlock is *real bad news* for big scripts or scripts that
are reused at several places in the web site. Kills off all caching.
 

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

Top