I have one ASP.NET 3.5 web application project. I would like to deploy most of this to my web server, but I would like to deploy CSS, images, and JavaScript to a second “image server”.
How to do this using Web Deploy or even the publish function for Visual Studio 2010 and above?
Some asked what I tried. I have not tried anything because I do not know anything to try.
In the past, I did some serious deployment work on the Internet. I even used Web Deploy to deploy non-web applications, manually adding the appropriate targets to the project file. I have an MSBUILD book ( Inside Microsoft® Build Engine: Using MSBuild and Team Foundation Build , Sayed Ibrahim Hashimi and William Bartholomew), and an Application , and I know how to do things like adding extra files to the MSDEPLOY package that aren’t in the project, and add folders and set access protection, etc.
What I do not know how to do is make two packages from one project, and then deploy these two packages to two separate servers.
Here are two things I could try. In my opinion (yes, to an expert), it’s not worth the time. I would be glad if someone showed me where I am mistaken.
The publishing profile in Visual Studio not only contains information about which files should be published and at which destination; it also includes configuration solutions for build and deployment. I could either
- You have two solution configurations: Release and ReleaseImage. The "Images" project will not be built in the "Release" configuration, and the "normal" project will not be built in the "ReleaseImage" configuration. The publishing profile for the “normal” project will build the Release configuration, and the publishing profile for the images will create the ReleaseImage configuration. I didn’t have to say how painful it would be to have images, CSS and JavaScript not in the same project as the code that uses it.
- Like the first, but keeping everything in one project. This time with two configurations, manually edit the .csproj file to place the legend in the
ItemGroup elements containing the content. In fact, one project will become two projects, depending on the solution configuration. I did not need to indicate how impractical it would be to manually edit the project file each time a new element is added to the project.
I can’t think of a practical way to do what I need to do. I was hoping that someone would find out about a practical method that I don’t know about - perhaps about some feature of Web Deploy 3.5 that I did not know about.
source share