davisnw
asked on
How to include common aspx pages into different Web Application Projects?
Hi, I have two separate web applications which include many common aspx pages. I would like to separate the common pages into a single directory which are then referenced by the two Web Application Projects, rather than having actual copies.
I can easily share simple class files across the projects by simply adding references. However, that does not seem to work for aspx pages. How can I do this?
I can easily share simple class files across the projects by simply adding references. However, that does not seem to work for aspx pages. How can I do this?
Can you try adding the aspx from another project by using Add Existing Item? Lets see if it creates a new copy for itself or tries to share the same physical file
ASKER
Add Existing Item creates a copy. What I need is for it to share the same physical file.
Why not add a link to the other web page from the Menu ?
ASKER
Because these two applications are published on different servers - one internal and one external. Also, the unique pages of the individual applications need to share session state with the common files. Thus the common files actually need to be part of the Web Application Project, but linked to the same file for development purposes.
I dont think it is possible to reference to the same physical files from two different projects. Even if the IDE lets us point to another physical directory it would defy all rules of security, session sharing, deployment in my opinion.
ASKER
To be clear, it is only needing to reference the same physical file during development for the purposes of maintaining the same common codebase. At deployment, copies of the common files will be deployed to their separate directories.
Even during development all these rules would apply and thats the reason i think it is not possible
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
BTW: another neat trick I discovered:
In order to edit the csproj files with full Intellisense, do the following:
Right click on the Project and select "Unload Project"
Right click on the Project agian and select "Edit Project"
When done editing, Right click on the project and select "Reload Project"
In order to edit the csproj files with full Intellisense, do the following:
Right click on the Project and select "Unload Project"
Right click on the Project agian and select "Edit Project"
When done editing, Right click on the project and select "Reload Project"
ASKER
One other part of the solution that I forgot to mention:
In order for you to be able to debug the individual applications within the IDE, you may find it necessary to add a process to copy the appropriate web.configs from their individual configuration directories to the root application directory. The links will take care of publishing, but they don't seem to get processed for a build within the IDE.
For example:
<Target Name="BeforeBuild">
<Copy SourceFiles="..\App1Config \Web.confi g;..\App1C onfig\App1 Authentica tion.confi g;..\App1C onfig\App1 AppSetting s.config;. .\App1Conf ig\App1Con nections.c onfig" DestinationFolder=".\" />
</Target>
In order for you to be able to debug the individual applications within the IDE, you may find it necessary to add a process to copy the appropriate web.configs from their individual configuration directories to the root application directory. The links will take care of publishing, but they don't seem to get processed for a build within the IDE.
For example:
<Target Name="BeforeBuild">
<Copy SourceFiles="..\App1Config
</Target>
Closed, 500 points refunded.
Vee_Mod
Community Support Moderator
Vee_Mod
Community Support Moderator
ASKER
<ItemGroup>
<Compile Include="..\Gateway.Common
<Link>index.aspx</Link>
</Compile>
<Compile Include="..\Gateway.Common
<Link>index.aspx.cs</Link>
<SubType>ASPXCodeBehind</S
<DependentUpon>index.aspx<
</Compile>
<Compile Include="..\Gateway.Common
<Link>index.aspx.designer.
<DependentUpon>index.aspx<
</Compile>
</ItemGroup>
However, although the files then show up in the project (as links) I get strange errors:
Error 1 Keyword, identifier, or string expected after verbatim specifier: @ C:\Documents and Settings\davisn.NMEAF\Desk
Error 2 Newline in constant C:\Documents and Settings\davisn.NMEAF\Desk
Error 3 Newline in constant C:\Documents and Settings\davisn.NMEAF\Desk
Error 4 Newline in constant C:\Documents and Settings\davisn.NMEAF\Desk
Error 5 Preprocessor directives must appear as the first non-whitespace character on a line C:\Documents and Settings\davisn.NMEAF\Desk
Error 6 A namespace does not directly contain members such as fields or methods C:\Documents and Settings\davisn.NMEAF\Desk
Error 7 Keyword, identifier, or string expected after verbatim specifier: @ C:\Documents and Settings\davisn.NMEAF\Desk
Error 8 Newline in constant C:\Documents and Settings\davisn.NMEAF\Desk
Error 9 Newline in constant C:\Documents and Settings\davisn.NMEAF\Desk
Error 10 Newline in constant C:\Documents and Settings\davisn.NMEAF\Desk
Error 11 Preprocessor directives must appear as the first non-whitespace character on a line C:\Documents and Settings\davisn.NMEAF\Desk
Error 12 A namespace does not directly contain members such as fields or methods C:\Documents and Settings\davisn.NMEAF\Desk
These errors are not due to errors in the page, because the page works fine when added directly rather than as a link.