How to reference code in website - asp.net

My code is divided into websites, one for each module (in TFS). Also, I have some application level code (like loginpage.aspx, webconfig.xml, Configuration.xml, Common.css, Logo.gif, masterpage.js, mainmaster.master, mainmaster.master.cs, etc) which is common for all module level websites. Is there a way I can reference the common application level files in each module level website. I want to avoid multiple copies of the application level code, by using a reference or some other mechanism.

The best way to handle this kind of shared code is in your solution-structure, so TFS can stay straightforward and your common code is not duplicated localy either.
So try to make the common-code shared by creating a project that provide baseclasses where the other projcets (the websites) can build on.

Related

Flex: conditional embedding of images

We are working on a flex project where we want to balance two challenges
a) want to ensure that there is minimal need to be connected to internet- so it can be used offline. This will be used in rural locations with flaky connections
b) Reduce file size by only embedding those assets in compile mode as is required
Broadly, the project will go down one of three flows in the module called, based on user choice- Path A, Path B and Path C, which will require image set-A, set-B & set-C respectively (based on settings in the module)
We want to send over all images in Set-A or set-B or set-C right upfront in the module called, based on choice made in primary project, to minimize need for connectivity once accessed. At the same time I want to avoid sending all three sets and bloating up download size three times.
The question is how do I conditionally embed images such that if I am going down path A, the module sent down only has images of set-A
We had to solve a similar problem with asset localization, and we ended up creating external RSLs to link in "asset packages". However, this does require a bit more attention to the build process, since you have to pay closer attention to linkage and dependencies across RSLs. Most of these problems go away if all of your libraries are linked as external as apposed to merged-in-code (not just for your app, but any local libraries you may use as well). This is not necessarily required, but it does help ensure everything you need gets linked in.
Are you compiling Flex on Fly/Runtime from primary project on server?
If NO, its mean you are compiling it in IDE, in that case i suggest build 3 Application
For Path-A B nd C, you dont need to rewrite whole application again just ReWrite Application.mxml for three apps and emebed rrelative assests in them
IF YES, same ans seprate app.mxml for each path
EDIT: Anotther option is conditional compilation It is To include or exclude blocks of code for certain builds, you can use conditional compilation
hopes that helps

Do app code support only to put one kind of file?

Do app code support only to put one kind of file, i mean either c# class or vb class?
Because if i put both sort of file and create an object then, application throws error.
How can i make App code compatible with both.
Within a single assembly or project you can only have one kind of source code, although you may reference multiple assemblies (of different languages) within the same project.

VS 2010 Web.config transformations for debugging

I’m a fan of the new VS 2010 Web.config transformations. I use this feature for deployment purposes and wondered if it is possible to use them for debugging too.
I think of using them in the IDE: I want to create different built configuration (with linked transformation configurations); choose one of them; start the web site in the IDE and debug the different configurations this way.
Update
Thanks to a 3rd party plugin, SlowCheetah, this is now possible. Scot Hanselman has a blog post about it.
Original response:
Unfortunately, the web.config transformations appear to effect only publishing sites and building deployment packages.
In our scenario we have two development groups, one with access to multiple environments (in-house) and the other with access to a single environment (offshore). We have periods where the in-house group needs to debug directly against QA, while offshore remains locked-out (so their web.config's must point to the dev environment).
We were hoping to have 1x build-configuration per-environment, and be able to choose the build-configuration which matched the environment to debug against--which, as I understand it is your question.
In case anyone is curious why they haven't built this feature, from:
http://forums.asp.net/p/1532038/3711423.aspx
"When the web app gets run, the web.config under project root folder will be picked up by asp.net and I know unfortunately it is under source control . I certainly understand the cleanness coming with letting runtime use a transformed web.config from a temp folder; however, asp.net runtime doesn't know anything about vs projec structure and it is totaly based on directory structure. Using alternate path might also break as a web.config under a subfolder expect to inherit settings from the upper level of directory."
I found an alternative solution that does not involve any third party tool: http://ledtalks.blogspot.in/2011/09/webconfig-transformations-when.html. I only tried this for the web.config file

Using web services in different environments

We have a series of web services that live in different environments (dev/qa/staging/production) that are accessed from a web application, a web site, and other services. There are a few different service areas as well. So for production, we have services on four different boxes.
We conquered the db connection string issue by checking the hostname in global.asax and setting some application wide settings based on that hostname. There is a config.xml that is in source control that list the various hostnames and what settings they should get.
However, we haven't found an elegant solution for web services. What we have done so far is add references to all the environments to the projects and add several using statements to the files that use the services. When we checkout the project, we uncomment the appropriate using statement for the environment we're in.
It looks something like this:
// Development
// using com.tracking-services.dev
// using com.upload-services.dev
// QA
// using com.tracking-services.qa
// using com.upload-services.qa
// Production
// using com.tracking-services.www
// using com.upload-services.www
Obviously as we use web services more and more this technique will get more and more burdensome.
I have considered putting the namespaces into web.config.dev, web.config.qa, etc and swapping them out on application start in global.asax. I don't think that will work because by the time global.asax is run the compilation is already done and the web.config changes won't have much effect.
Since the "best practices" include using web services for data access, I'm hoping this is not a unique problem and someone has already come up with a solution.
Or are we going about this whole thing wrong?
Edit:
These are asmx web services. There is no url referenced in the web.config that I can find.
Make one reference and use configuration to switch the target urls as appropriate. No reason to have separate proxies at all.

MSI for multiple websites WITHOUT custom actions

I would like to create an installer that installs 6 websites, all of which rely on a data access library. So the solution contains 6 web applications, and 1 class library.
Question is: how can I accomplish this without using custom actions?
So far, the only thing I've thought of is to make merge modules out of the web app projects, each of them throwing in the primary output of the class library project, and then making a main installer that has all the merge modules.
I would put each website in a feature that way you could give the end user the control over which website they require, if that is an option.
Although, you'll have to repeat the same type of code for each website in their respective.wxs file.

Resources