VS 2005 Web Deployment Projects

Update: This shiped a few days ago.  More details here: http://weblogs.asp.net/scottgu/archive/2005/11/10/430283.aspx

 

Later this week Microsoft is shipping on the web a new free add-on to Visual Studio that enables what we call “Visual Studio 2005 Web Deployment Projects”.  This add-on provides a lot of additional deployment features and capabilities that complement the built-in web project support in the product.  The below blog post provides a quick overview of some of the new things coming.  There are also some MSDN whitepapers that will document it more exhaustively over the next week as well.

 

Some background

 

The web project model changed in a number of ways between VS 2003 and VS 2005.  There was a lot of discussion this August over missing features that weren’t supported or were broken by it in Beta2 (examples: exclude file from project support, file-based assembly refreshes, the ability to not check-in \bin assemblies in source control, etc).  These specific issues were fixed in the final release of VS 2005, and a number of folks who previously had a lot of concerns have posted positive impressions of the new model lately.

 

One of the things we on the team still weren’t happy with, though, was the level of support in the vanilla product for more advanced deployment configurations/options beyond the core "Publish Web" scenarios built-into VS 2005 – specifically around assembly naming/output, advanced MSBuild customization, and other common scenarios that we’ve heard requests for over the years (for example: the ability to modify connection string settings depending on the build configuration, etc).

 

A couple of guys on my team have cranked over the last 2 months adding richer support for these scenarios that integrate nicely in the shipping product.  We’ve packaged up this work in a new free download we call “VS 2005 Web Deployment Projects” and which we worked to make sure was available for download this week (which is the week of VS 2005 launch -- so basically immediately when the product releases).  This download does not touch any shipping binaries within VS 2005, but instead uses the extensibility support within the IDE and ASP.NET to integrate in a fairly cool way. 

 

We think the resulting feature-set offers the best of both worlds – specifically the productivity benefits of rapid development brought with the new dynamic web project model, as well as the richness of a highly customized build/deployment system.

 

VS 2005 Web Deployment Project Feature-Set

 

The VS 2005 Web Deployment Project download adds a number of features that integrate nicely inside VS 2005 including:

 

1) More control over the number of assemblies generated by a pre-compiled web project, as well as control over their naming.  Specifically, you can now generate a single named assembly for all pages + classes in your web project (for example: MyCompany.MyWebApp.dll).  Alternatively, you can also now optionally generate a separate named assembly for each directory of pages/controls in your project (for example: MyCompany.MyWebApp.SubFolder1.dll and MyCompany.MyWebApp.SubFolder2.dll).  This later option is particularly useful for large content web-apps where you would like the ability to incrementally patch code updates.

 

2) The ability to utilize the full power of MSBuild to customize your build process.  You can now use MSBuild to define pre and post build rules, exclude folders from building, automatically create IIS vdirs and site mappings, add custom assembly versioning information, and add any custom MSBuild task you want to your build process.

 

A VS 2005 Web Deployment Project stores all of its settings inside an MSBuild based project-file.  It also adds support for opening and editing the web deployment MSbuild project file directly in the IDE (w/ full intellisense support for it) – something that actually isn’t supported by any other project type in VS.

 

3) The ability to define and use custom build-configurations inside Visual Studio, and define per-build configuration options.  In addition to using the built-in “debug” and “release” configurations, for example, you could define custom build configurations like “staging”.  You can then vary your web deployment MSBuild tasks and actions based on these.

 

4) The ability to customize and modify a web application’s web.config file at deployment.  There is now IDE support for changing values likes connectionstrings or app-settings as part of the build process.  You can also vary these values based on the VS build configuration – so for example you could have one set of connectionstrings that you use for development (when you have the build configuration set to “debug”), and then have them modified as part of the build-process to your test/staging or production databases when you choose a “staging” or “release” build configuration in the IDE.

 

There are also a host of other features to take advantage of.  The upcoming whitepapers on MSDN will go into more detail on these, as well as the 40+ new web deployment related MSBuild tasks that it ships with that you can use to customize things even further.

 

Example Walkthrough of using a VS 2005 Web Deployment Project

 

Below is a simple example that walks-through using the VS 2005 Web Deployment Project download to customize the deployment of a VS 2005 based web site project.

 

Step 1: Development my web project

 

Below is a screen-shot of a common web application solution structure – where I have 1 or more class library projects and then a web-project containing my web app.

 

 

I can build the application using the standard web project model that ships with VS 2005, and take advantage of the productivity enhancements it provides.

 

Step 2: Adding a VS 2005 Web Deployment Project

 

As my web app progresses, I’ll need to think more about deployment.  To take advantage of the new deployment features the web deployment add-in provides, I can right-click on any of my web projects in the solution and add a Web Deployment Project (note: it is the 3rd item in the context menu below):

 

 

This will prompt me for what I want to name the project and where to store its project file:

 

 

The web deployment project will then show up as part of my solution:

 

 

Associated in the e:\WebSiteDeployment directory is a new MSbuild based project file that contains deployment and build settings for my web-project.

 

Note that a single web-site project can optionally have multiple deployment projects associated with it.  You can also have multiple web-site projects in a solution, each with a separate web deployment project (for example: a user control library project that you pre-compiled and then copied into another web app project that used it).

 

Step 3: Setting Build and Deployment Options

 

To customize build and deployment settings I can either use the built-in GUI property pages for the deployment project, or edit the MSBuild file directly.  I’ll show this second more advanced option later – for right now I can just right-click and pull up the property pages for the project, or double click on the WebSiteDeployment node (which is a short-cut for the same thing) to customize its properties.

 

There are several screens of information (the MSDN whitepaper will go into them all – for here I’ll just show a few highlights).  One thing to note is that the settings are configured per-VS build configuration – so you can have one set of options for “debug”, one set of options for “release” and optionally define your own build configurations like “staging” and configure custom options for that build configuration as well.  I’m going to change the settings below to apply for the “release” build configuration.

 

Here are a few of the more common things developers will want to control:

 

1) Developers can control whether to pre-compile the web entirely, or to support html source updates.  Only the later option was supported in VS 2003 – and meant that you always had to deploy your .aspx source files on your production server (these were in turn dynamically compiled by ASP.NET at runtime the first time the app was run).  ASP.NET 2.0 still supports this compile option (we call it the “allow updates” option in VS 2005).  ASP.NET 2.0 also now supports a mode where you can optionally compile everything inside VS – including the .aspx/.ascx control definitions and html source.  This produces a more efficient version of the app, and eliminates the need for a first-time dynamic compile performance hit when your app is run.  It also allows you to protect more of the IP of your site, and enables you better compile-time checking of your application.  The first property page in the web deployment project allows you to choose either this new compile mode, or the preserve .aspx source mode that VS 2003 used.

 

2) Developers can control what granularity of assembly output they want the website compiled down to, as well as what names to use for the assemblies (this is controlled on the output assemblies tab):

 

 

The default option is to merge the entire web-site into a single assembly that you can name however you want.  This merges the output of all page/control compilation, app_code, and web-services into a single assembly (leaving one file to deploy). 

 

There are other options you can choose as well for more granular control over the assembly generation.  For example, the second option above lets you compile each folder in your website into a separate named assembly (for example: MyCompany.MyWebApp.Folder1, MyCompany.MyWebApp.Folder2).  This is useful for patching large applications where you want to make a tactical update to just a portion of the site.

 

If you have an AssemblyInfo.cs/.vb class in your app_code directory, the deployment project will use the meta-data it contains to version the produced assemblies.  Alternatively, you can also set the version information specifically in the IDE.  This in turn saves it as an MSBuild variable in your project file.  You could optionally use a custom MSbuild task to set this variable dynamically at build-time (for example: to use a policy like we do at Microsoft where the build number is based on the current date).

 

3) The developer can then optionally use the deployment tab for other common deployment scenarios:

 

 

One of these is the ability to replace the application’s web.config settings at build-time.  This can be done on a configuration section by section basis.  Simply list the name of the section to replace, and an XML file containing the replacement settings.  You can choose to have them replaced either in-line within the web.config file (the default), or to use the new configSource attribute option in ASP.NET 2.0 to dynamically point the web.config file at external configuration files that contain the values.

 

Because all values in the settings dialog can be configured on a per-VS build configuration basis, this means that you can have one set of configuration file replacement settings per build configuration (for example: one connectionstring setting for “debug”, one connectionstring setting for “staging” and one connectionstring setting for “release”). 

 

The other options included on this dialog is the ability to dynamically create and map an IIS vroot to the output directory as part of the build process, as well as the ability to delete the app_data directory as a post-build step (useful in cases where you want to delete the SQL Express database you’ve been using for development, and instead map your Membership, Roles, Profile, Personalization and HealthMon providers to a full SQL Server production database).

 

Step 4: Adding Optional Advanced MSBuild File Customization Rules

 

The above GUI property pages provide support for the most common build configuration settings.  One neat thing about the Web Deployment Projects, though, is that there is easy IDE support for dropping down into the MSBuild file directly and customizing things further.

 

To-do this in the IDE, simply right click on the web deployment project and select “Open Project File”:

 

 

This will bring up an XML editor with intellisense support for the project file:

 

 

You can make changes, and then hit save to update things dynamically.

 

The web deployment project adds support for pre and post build events that you can use to customize things.  For example, if you wanted to make sure a custom directory was created in your generated app after building, you could use the built-in MSbuild <MakeDir> task in the AfterBuild event:

 

  <Target Name="AfterBuild">

    <MakeDir Directories="$(TargetDir)\Upload" />

  </Target>

 

If you want to exclude a “Test” directory that contains some sample test pages from building in your release configuration you could add something like this:

 

  <ItemGroup>

    <ExcludeFromBuild Include="$(SourceWebPhysicalPath)\Test\**\*.*"/>

  </ItemGroup>

 

Note that you can use wild-card extensions when excluding things (above it is using *.* to exclude everything under the test directory) – so you can get quite fancy with your exclude rules.  MSBuild itself ships with tons and tons of built-in build tasks (like MakeDir).  The Web Deployment Project download adds support for another 40+ custom tasks specific to web application development/deployment.  The really cool thing is that it is also easy to build your own MSBuild tasks and add them to projects as well.

 

Once you’ve made any custom tweaks, just hit save on the project file and close the window.  Note that you can still use the property page dialogs above even after customizing the project file – it will preserve your settings and not blow them away.

 

Step 5: Building the Web Deployment Project

 

Now that I have my deployment project all setup, I can simply do a “Build Solution” to build all the projects in my solution – including my new web deployment project.  This will then generate an output folder for my website.  Contained within it is a \bin directory that has two assemblies (one for my data class library, and one for my web project):

 

 

The web.config file for my application has also been updated to have my production connectionstring settings.

 

One typical optimization that we’ll recommend would be to only build the web deployment project when your application is ready to be deployed – and not during actual development (instead when actively developing just work with the web project directly as normal).  You can easily configure this in the VS build configuration manager:

 

 

For example: with the above settings we are configuring the WebSiteDeployment project to not build when the “debug” release configuration is set – and only do so when in “release” mode.

 

You can then use the build configuration drop-down on the toolbar to quickly switch between debug and release modes depending on where you are with the project:

 

 

Step 6: Optional Setup Project

 

One last bonus step that is also possible is adding a “Web Setup” project into our above solution.  This is a standard VS 2005 project type that supports packaging a .msi file along with logic to create a vroot and deploy an application when executed:

 

 

I can easily configure the WebSetup project to pipe in the output from my WebSiteDeployment project into the MSI. 

 

Then, while I select “Build Solution” again I’ll build my web deployment project, pipe it into the setup project, and I’ll be left with a .MSI setup program for my web application that will walk me through creating an IIS vroot and deploy my production app on a web-server when run:

 

 

Next Steps

 

Our plan is to post the first release of the VS 2005 Web Deployment Project for free download on MSDN this week.  We'll then gather and incorporate feedback and release an updated version later this year. 

 

We hope you find it useful.  Let us know what you think and what additional features and MSBuild tasks you’d like to see added to it.

 

Thanks,

 

Scott

 

Published Sunday, November 6, 2005 9:01 PM by ScottGu

Comments

# re: VS 2005 Web Deployment Projects

Monday, November 7, 2005 1:04 AM by John Walker
Coool!! Was looking for something like this.

# re: VS 2005 Web Deployment Projects

Monday, November 7, 2005 3:37 AM by AsbjornM
wow!, looks like the "problems" of ours finally wil be solved.
But there is one thing I really don't understand.. When we create an asp.net project, vsnet automatically creates an App_Data catalog, and an database within that. As if I need an database there?
And when I use the current deployment tool, it tries to do something with the database file, which of course is locked by sql server.. so I exlude it, but that renamed the file.. sigh..
Will these things also be fixed with this?

# re: VS 2005 Web Deployment Projects

Monday, November 7, 2005 5:32 AM by Igor
Where can we doanload this nice add-on?

# re: VS 2005 Web Deployment Projects

Monday, November 7, 2005 5:39 AM by Steven
Very cool, but where can we download this? Can you provide us with a link?

# re: VS 2005 Web Deployment Projects

Monday, November 7, 2005 5:48 AM by scottgu
Hi Steven,

It should be on the web later this week. I'll post a new entry with a link to the download as soon as it is out.

Thanks,

Scott

# re: VS 2005 Web Deployment Projects

Monday, November 7, 2005 6:17 AM by LeeB
Scott,

One of the things I miss with the standard VS2005 setup is being able to call static methods on a page from another page within the project. This is no longer possible due to each page being compiled into its own assembly.

However, this download will provide the option to deploy a web site as a single assembly (as VS2003) used to do. Will this tool change the development-time experience too. For example will I be able to reference one page from another (maybe even have Intellisense for this)? - or is the single assembly feature for deployment only?

# re: VS 2005 Web Deployment Projects

Monday, November 7, 2005 8:45 AM by Steve Baker
Looks great, but is there any equivalent in vs 2003 to use until we have upgraded to .NET 2.0?
Particuarly we are looking for a better way to version our assemblies and deploy to virtual dirs and non-default websites but still use the web setup project / msi

# re: VS 2005 Web Deployment Projects

Monday, November 7, 2005 8:53 AM by Shiv
Scott,

Can't wait to get this tool! Thank you for the heads up and explanation on what and how etc.

# re: VS 2005 Web Deployment Projects

Monday, November 7, 2005 9:40 AM by Smith
Hi Scott,

Sounds intersting, but i gatta one questions, what are the pitfalls on this approach(i mean disadvantages) or can you please tell me the Best Practice for this approach(Do's and Don'ts)?

Thanks,
Smith

# re: VS 2005 Web Deployment Projects

Monday, November 7, 2005 10:24 AM by Chad Geidel
I have noticed that my "Build Configuration" drop-down does not have a "Release" option when I have a web project open (just the website, no solution showing in the IDE). The "Release" option is available in a Windows Forms project. Does this mean I have to have my website in a solution to see that build option?

# re: VS 2005 Web Deployment Projects

Monday, November 7, 2005 12:52 PM by scottgu
Hi Lee,

The above utility doesn't change the development time experience (where multiple assemblies are created to enable quicker updates) -- instead it uses a post-build step that merges these assemblies into one. So it won't change the existing semantics you see in your code.

You can still use static (or instance) methods across pages or controls in VS 2005. Simply add a <%@ Reference %> directive to the top of a page to the control or page you want to directly access. You can then call static methods on it. In general, though, where possible we recommend storing your statics as standalone classes that you keep in a client library project or in the app_code directory -- since that ends up being a little cleaner architecturally and avoids you building up two many intra dependencies across your UI forms.

Hope this helps,

Scott

# re: VS 2005 Web Deployment Projects

Monday, November 7, 2005 3:18 PM by Deylo Woo
I like the idea of building assemblies for seperate directories, I know it will make life much easier for large websites. Will the update of certain assemblies on certain directories kill the application state? And if so, would it be easier to let IIS compile the pages on demand?

# re: VS 2005 Web Deployment Projects

Monday, November 7, 2005 3:51 PM by Scott Lee
How does this compare to the Team Build server as part of Team System? Can this integrate into that? Or are they completely 2 different procedures?

Thanks for another gread add-on to an already terrific product.

~slee

# re: VS 2005 Web Deployment Projects

Monday, November 7, 2005 4:57 PM by Marcus McConnell
I'd love to see an option in the web setup project where the user who is running setup.exe can override the default destination folder and IIS root name during install.

# re: VS 2005 Web Deployment Projects

Tuesday, November 8, 2005 11:33 AM by Israel Aece
Hello Scott,

"Merge all outputs to a single assemby" options can be used with aspnet_compiler, where all DLLs and compiled files would be embedded in this "single assembly"?

Many people/developers don't like to have serveral DLL files. Maybe, this developers are accustomed with ASP.NET 1.x version.

Regards,

# re: VS 2005 Web Deployment Projects

Tuesday, November 8, 2005 1:38 PM by scottgu
Hi Deylo,

When you replace an assembly in the \bin directory, it does cause the app-domain of the running application to restart. So unfortunately this would cause the loss of application state.

Hope this helps,

Scott

# re: VS 2005 Web Deployment Projects

Tuesday, November 8, 2005 1:40 PM by scottgu
Hi Scott Lee,

The above solution ends up generating a MSbuild based project file that can be easily integrated into Team Build or any other command-line or automated build process you might have. So you can use it either in the IDE (as I've shown above), or on the command-line or Team Build environments (which makes it a pretty sweet solution).

Thanks,

Scott

# re: VS 2005 Web Deployment Projects

Tuesday, November 8, 2005 1:46 PM by scottgu
Hi Israel,

Yep -- some people want a single dll. That is why we made it the default option with the Web Deployment Projects (even though I personally think multiple DLLs are more flexible as long as they are named consistently and can be easily updated).

One thing to call out is that when using the web deployment project we first build the web-site into several DLLs, and then as a post-build step merge them into the final assemblies (we are using ILMerge functionality to-do this -- which means you can do cool things like merge a VB and C# assembly together). This does mean that you get the same compilation semantics in terms of referencing types that you get today with the web-site projects in VS 2005 (the programming model is identical).

Hope this helps,

Scott

# Mr

Tuesday, November 8, 2005 2:40 PM by Robert W. Anderson
This looks awesome -- I worked around the unpredicatible naming using ildasm/ilasm and nant. Of course, this is a much more comprehensive solution!

Thanks for getting this done so quickly.

Cheers,
Robert

# re: VS 2005 Web Deployment Projects

Tuesday, November 8, 2005 3:37 PM by scottgu
Hi Robert,

Glad it looks good! We are also shipping a new command-line tool called "aspnet_merge.exe" which does the post-build assembly merging process (it also does a number of additional cool things). If you'd prefer to use nant or another build environment (vs. MSBuild), you should be able to easily wrap this utility (along with the already shipped aspnet_compiler) and accomplish the same thing as our VS 2005 Web Deployment Projects -- but using your own build system.

Hope this helps,

Scott

# re: VS 2005 Web Deployment Projects

Tuesday, November 8, 2005 6:37 PM by Robert W. Anderson
Thanks for the info (I read the rumors on aspnet_merge and also did an ILMerge / nant to solve the same problem). I don't prefer nant -- I just preferred it to VS2003's build support. Now we're pushing hard on a full release of our stuff (all .NET 2.0 / VS2005) and am leaving nant in place while I deal with bigger issues. BTW: I blogged on this port over the last month, if you are interested, check it out.

Thanks again,
Robert

# re: VS 2005 Web Deployment Projects

Wednesday, November 9, 2005 1:00 AM by anutthara
Hi Scott Lee,
Team Build does integrate with this cool add in. You can find the integration details soon on my blog as a follow up to the web deployment project post.
Thanks,
Anu

PS: Are you the super active "slee" on the VSTS forums :)

# re: VS 2005 Web Deployment Projects

Thursday, November 10, 2005 6:52 AM by Adam W
This is great - its exactly what I've been trying to do.

A couple of problems though;
I want to replace the web.config smtp settings under <system.net><mailsettings> using a config source. Is it possible to specify an XPath or similar to replace a sub node of the web.config?

As I can't currently do the above, I've changed it to replace the entire system.net node in the web.config but I get an error;
C:\Program Files\MSBuild\Microsoft\WebDeployment\v8.0\Microsoft.WebDeployment.targets(513,9): error : web.config(1): error WDP00002: missing section system.net.

Also, I can't compile my website into a single assembly;
C:\Program Files\MSBuild\Microsoft\WebDeployment\v8.0\Microsoft.WebDeployment.targets(474,9): error MSB6006: "aspnet_merge.exe" exited with code 1.
Done building project "HubDeploy.wdproj" -- FAILED.

Looks like it will be perfect when I cant get these problems resolved!

Thanks

Adam

# re: VS 2005 Web Deployment Projects

Thursday, November 10, 2005 9:52 AM by Firoz Ansari
Hey Scott,
Cool!!! Thank you very much for this information.

Firoz Ansari

# re: VS 2005 Web Deployment Projects

Thursday, November 10, 2005 10:50 AM by Martijn
Hi Scott,

Tnx for all the effort you guys put in and especially for the information you put online here, really helpfull ;-)

I still have one issue that we are struggling with here at our company, till now we had the following development architecture:

One single development server for all projects, which has a setup that is exactly the same as the Staging and Live server.

On this we have a share, each developer has one with for there own, in which the webproject is put.

i.e. I have projectname_martijn and a collegue has projectname_collegue
In the .webinfo we set the <VisualStudioUNCWeb>
<Web URLPath ="VD URL"> to the Virtual Directory on the central development server.

Using that we can develop and build using the filesystem Access but debug using the remote IIS.

I cannot seem to get this scenario working with VS2005. For us it is quite important, as a quality assurance, that the developers are working on the remote IIS Development Server. This also allows us to test the whole security architecture we have implemented during the development.

I hope you can give me a hint here.

Thanks, Martijn

# re: VS 2005 Web Deployment Projects

Thursday, November 10, 2005 11:50 PM by scottgu
Hi Adam,

Can you send me an email (scottgu@microsoft.com) with more details about your particular scenario? I want to understand better why the merge failed for your app. We can then debug and try and figure out what the issue is.

Thanks,

Scott

# re: VS 2005 Web Deployment Projects

Friday, November 11, 2005 8:46 AM by Andrey Skvortsov
Is add-in work(or planned to work) in WebDev Express?

Thanks.

# re: VS 2005 Web Deployment Projects

Friday, November 11, 2005 11:20 AM by scottgu
Hi Andrey,

WebDev express doesn't actually support this add-in in the IDE (it is only supports with Visual Studio Standard and above).

Sorry about that,

Scott

# re: VS 2005 Web Deployment Projects

Friday, November 11, 2005 3:52 PM by Alan
Maybe I'm missing it but I still don't see the ability to put my own namespace hierarchy on control libraries, even with this add-on tool.

I need to be able to develop a user control library as a single DLL with my company's namespacing conventions on all the controls. I certainly don't want each control to be in the generic ASP. namespace root.

Is this supported?

# re: VS 2005 Web Deployment Projects

Sunday, November 13, 2005 10:06 AM by Charles
Was wondering how all this helps me find out what configuration I am using from code? For example, I used to could use Conditional compilation in my code to run some code whaile in DEBUG and other code while in RELEASE. I would like to still be able to do this. The [Conditional] attribute does not seem to help as it only seems to apply to classes and class members. Am I missing something?

# re: VS 2005 Web Deployment Projects

Tuesday, November 15, 2005 1:07 AM by scottgu
Hi Charles,

Here are conditional statements you can use in code to conditionally compile code:

#if DEBUG
Response.Write("Debug!");
#endif

#if !DEBUG
Response.Write("Release!");
#endif

Note that the value of debug in a web app is driven by the value of the <compilation debug="true|false"/> value in your web.config file.

Hope this helps,

Scott

# re: VS 2005 Web Deployment Projects

Thursday, November 17, 2005 11:19 AM by vladimir
Can't get project references in .wdproj working. What I want is to build .wdproj using msbuild without building .sln file. It runs aspnet_compiler and aspnet_merge task only and doesn't build project references.

# re: VS 2005 Web Deployment Projects

Thursday, November 17, 2005 11:31 AM by Descartes
Good man! Thanks...

# re: VS 2005 Web Deployment Projects

Thursday, November 17, 2005 1:56 PM by Ben Hall
Im just trying to deploy my website and i'm getting the error:

Error 24 "aspnet_merge.exe" exited with code 1. 1 1 Project1

Anyone know a fix for this??

Using VS 2005 Pro RTM on XP Pro.

Cheers

Ben

# re: VS 2005 Web Deployment Projects

Friday, November 18, 2005 3:17 PM by Chris
Hi Scott,

Thanks for this tool, its a great addition! I'm setting up a test project right now for dev, stage and release builds. I have app and connection string replacement config files setup for each build type. When I run any one of the builds, all app and connection string config files are moved to the target directory. Near the end of the build, the app and connnection string config files for the current build are deleted. I then get an error in vs2005 stating that it can't find the relevant config files. Seems like the reverse should happen, (i.e. the app and connection config files for builds other than the current one should be deleted) unless I'm over looking something.

Any ideas?

Thanks,
Chris

# re: VS 2005 Web Deployment Projects

Friday, November 18, 2005 4:48 PM by Chris
Hi Scott,

I just sent in a message re all the config files being moved to the target dir during the build, and the config files matching the build type being deleted.

Here's an update:

I think this behavior was caused by my taking a short cut, namely giving both the appSettings and connectionStrings variables the same file name to merge. When I removed this, (a separate file for each variable) the behavior ceased.

I've since moved all the build specfic config files into their own dir, and excluded it from the deploy list and all is working as it should, (i.e; nothing but the merged web.config shows up in the target dir).

Thanks!
Chris

# re: VS 2005 Web Deployment Projects

Saturday, November 19, 2005 12:38 AM by scottgu
Hi Ben,

Usually an error like that is caused by having a duplicate class name in your project.

To find out which class is the error, you can configure additional levels of output information by selecting the Tools->Options menu item. Then under Project and Solutions->Build and Run you can select the MSBuild project verbosity dropdown to "Normal". Then check the output window after your next build and you'll see what the problem is.

Hope this helps,

Scott

# re: VS 2005 Web Deployment Projects

Saturday, November 19, 2005 12:39 AM by scottgu
Hi Vladimir,

Where are your references coming from? Are they from other projects in the solution or external references? If they are from other projects in the solution, then you'll need to compile those projects first (if you compile the .sln file it will compile them for you).

Hope this helps,

Scott

# re: VS 2005 Web Deployment Projects

Monday, November 21, 2005 2:02 AM by Derek Greer
Hey Scott. I've written a custom Task which I've been able to use as long as I declare a <UsingTask> with the AssemblyFile attribute, but I can't seem to get the assembly loaded when using the AssemblyName attribute. I receive a "Could not load file or assembly" error. The wdproj has a reference to the project which generates the assembly. What needs to be done to make the build process find my assembly? Thanks.


Derek Greer
dgreer@fedex.com

# re: VS 2005 Web Deployment Projects

Monday, November 21, 2005 3:16 AM by Vladimir
Hi scott

My references come from other projects in solution, but I can't build .sln - it includes some non-buildable projects. I need to build .wdproj only and it must update project references, similar to other project types. I looked through Microsoft.WebDeploy.targets - it includes _ResolveProjectReferences task but this task is always skipped due to wrong condition.

# re: VS 2005 Web Deployment Projects

Wednesday, November 23, 2005 2:18 AM by Babu
HI Scott

Please clarify this issue. when u say, "compile the entire Web application into a single assembly ", do u mean i will get one assembly with out any .aspx files which can be deployed in to my server..
My question is.. can i pack all of my applicaiton's..dll and .aspx files into a single dll... please clarify this as soon as possible.. thanks.. i got the impression like that by reading the point 1 above..

# re: VS 2005 Web Deployment Projects

Wednesday, November 23, 2005 2:52 AM by scottgu
Hi Babu,

If you compile the entire web application and do not select the "allow updates" option, then both the .aspx html source and the code-behind source will get compiled into a single .dll assembly. Note that there will also be a few .compiled files to enable ASP.NET to reference and find the appropriate classes for your pages -- but all of your .aspx source code (including its html content) will have been fully compiled.

Hope this helps,

Scott

# re: VS 2005 Web Deployment Projects

Wednesday, November 23, 2005 4:42 AM by Babu
scott , thanks for the update. where do i unselect that " allow updaes" option. is it under msbuild options under the project properties?

thanks

# re: VS 2005 Web Deployment Projects

Wednesday, November 23, 2005 11:16 AM by scottgu
Hi Babu,

That checkbox is on the "compilation" tab within the property pages window.

Hope this helps,

Scott

# re: VS 2005 Web Deployment Projects

Thursday, November 24, 2005 12:35 PM by Greg
Okay here is a good question then, I have implemented the Web Deployment Add-In and I have set not to include debug information but when I compile I still have pdb files in my bin folder from all other referenced projects?? They are all set to release mode as well.

How can I stop the produciton of the debug database files when creating a release build.

And one other thing.. If I use the standard vs2005 publich site to pre-compile and release it all works, but If I use the Web Deployment project to compile and release I get the error " The file blah blah has not been pre-compiled and cannot be requested....

Anyone any ideas on this please as I am now going round in circles.

Many Thanks

Greg

# re: VS 2005 Web Deployment Projects

Friday, November 25, 2005 9:02 PM by Humpy
I tried to deploy couple of my projects just converted to VS 2005. My pages are windows-1251 encoded. In PrecompiledWeb folder everything looks good, but in deployment folder all cyrillic characters are gone. Is there any way to help it without converting all the pages to Unicode?

Also, it would be nice to be able to perform parameter replacements on custom config files (other than web.config).

# re: VS 2005 Web Deployment Projects

Saturday, November 26, 2005 9:09 AM by widget
This was just what I was looking for. Thank you soooooo much!

# re: VS 2005 Web Deployment Projects

Sunday, November 27, 2005 4:11 PM by scottgu
Hi Greg,

By default when you build in a release configuration, VS generated PDB debug info along with your assemblies (the idea being that you can then optionally choose to deploy those or not as a post-build step).

Alternatively, if you want to change the build process to not build PDB files with your class libraries, you can do that by pulling up the properties for your class library project, select the "compile" tab, and then select "Advanced Compile Options". Within that there is a "Generate debug info" dropdown that you can set to none.

Hope this helps,

Scott

# re: VS 2005 Web Deployment Projects

Wednesday, November 30, 2005 6:41 PM by Martin
I have same problem as Humpy. My pages are windows-1250 encoded. All my aspx/ascx files are in Windows-1250 encoding, but in deployment folder all files are converted to UTF-8. I found bug (by reflector) in aspnet_merge utility.

/////////////////////////////////////////////////////////////
private static void FixWebSourceFile(FileInfo file, Hashtable assemblyMapping)
{
Encoding encoding1 = null;
using (StreamReader reader1 = new StreamReader(file.FullName, true))
{
encoding1 = reader1.CurrentEncoding; //This always return UTF-8, although input file encoding is windows-1250!!!
text1 = reader1.ReadToEnd();
}

.......

using (TextWriter writer1 = new StreamWriter(file.FullName, false, encoding1))
{
writer1.Write(text1);
}
}
/////////////////////////////////////////////////////////////

Over against aspnet_compiler tools is working correctly. This tool is using following construct ion (in method BuilderManager.CopyPrecompiledFile):

/////////////////////////////////////////////////////////////
Encoding encoding1 = null;
encoding1 = GetEncodingFromConfigPath(configPath)
using (StreamReader reader1 = new StreamReader(file.FullName, encoding1, true))
{
encoding1 = reader1.CurrentEncoding;
text1 = reader1.ReadToEnd();
}

internal static Encoding GetEncodingFromConfigPath(VirtualPath configPath)
{
Encoding encoding1 = null;
encoding1 = RuntimeConfig.GetConfig(configPath).Globalization.FileEncoding;
if (encoding1 == null)
{
encoding1 = Encoding.Default;
}
return encoding1;
}

/////////////////////////////////////////////////////////////
Please, anyone who is competent from ASP.NET team, correct this UTF-8 bug. Thanx.
Sorry for my bad english...

Martin

# re: VS 2005 Web Deployment Projects

Thursday, December 1, 2005 12:44 PM by scottgu
Hi Martin,

I developer on the team just saw your post on the asp.net forums system and is going to come up with a workaround for you short-term. We are also then looking to fix it in the next download of the web deployment project.

Hope this helps,

Scott

# re: VS 2005 Web Deployment Projects

Thursday, December 1, 2005 11:53 PM by Martin
Scott, thanks for the quick response and help!

Martin

# re: VS 2005 Web Deployment Projects

Friday, December 2, 2005 5:19 AM by Michael Mortensen
You are the masters!

This is exactly what I have been waiting for!

# re: VS 2005 Web Deployment Projects

Tuesday, December 6, 2005 2:02 PM by Greg K
Thanks for the addin!! You have saved me alot of headaches!!

# re: VS 2005 Web Deployment Projects

Friday, May 26, 2006 3:01 PM by Eric Schoen
I'm having trouble figuring out how to update custom sections in Web.Config.  Typically, my web service application is quite happy for me to (1) implement the config section handler in the App_Code directory, and (2) specify the name of the handler in the <section> element without qualifying the type with an assembly name.  This is great for a dynamic web site, because I frankly don't know the ultimate assembly name.  

However, when the ReplaceConfigSection task runs under the wdproj, it appears to do so in a context in which the <section> element doesn't do too much good.  If I leave the assembly name out of the section handler, the task tries to load the handler type from System.Web (and fails).  If I put the name of the precompiled assembly in the type specification, the task fails saying it can't find the assembly.  If I split the section handler out into a separate assembly and put its name into the handler type specification, the update task can't find the separate assembly either.

Any clues as to how to replace sections in web.config that are custom defined would be great!

Thanks,
Eric

# re: VS 2005 Web Deployment Projects

Monday, May 29, 2006 6:06 PM by ScottGu
Hi Eric,

Any chance you could send me email (scottgu@microsoft.com) detailing your scenario?  I can then loop a few people in who might be able to help.

Thanks,

Scott

# One Click Incremental Deployment

Wednesday, May 31, 2006 4:45 PM by Forsooth
Frontpage has it. Why not VS2005? It seems to me there is no technical reason why this couldn't be done. The deployment parameters should be specified once and then upon a single click of an icon just the changes should be propagated to the live site. This is obviously the optimal way to deploy a site.

Or is this possible now and I'm missing something?

# re: VS 2005 Web Deployment Projects

Thursday, June 1, 2006 1:21 AM by ScottGu
Hi Forsooth,

The VS 2005 Web Application Project option supports one-click incremental deployment of compiled apps.  You can learn more about this here: http://weblogs.asp.net/scottgu/archive/2006/03/27/441147.aspx

Hope this helps,

Scott

# re: VS 2005 Web Deployment Projects

Thursday, June 8, 2006 7:56 PM by Simon Morgan
For those that have problems with Error 24 "aspnet_merge.exe" exited with code 1.

The error does not say much; however, I did find out that it was a duplicate class. OK, with padi.com being so big, it was hard to find. So the following is a quick way to isolate the problem and fin the duplicate(s).
-Select Tools --> Options.  

-Then in the Projects and Solutions branch, select Build and Run.  

-You'll see a dropdown box for MSBuild Project Build Output Verbosity.  Change this to Diagnostic, and OK.

-show your build output by selecting the View --> Output option.  

-Make sure that in the 'Show output from' box, you've selected "Build".  

-Then just build your project, and wait for the inevitable fail.  

You will see where the duplicates are when it fails to build.

Regards,

Simon Morgan

# re: VS 2005 Web Deployment Projects

Saturday, June 10, 2006 10:42 PM by Forsooth
Hi Scott thanks for that. So then I take it there is no one-click deploy for standard VS2005 web applications? :( And if not, is this something that will be added in the future?

# re: VS 2005 Web Deployment Projects

Sunday, June 11, 2006 12:45 PM by ScottGu
Hi Forsooth,

If you have a standard Web Site project, you can choose the "Publish Web" option from the build menu to build and publish a site remotely.  It doesn't have all of the features that web deployment projects provide -- but does provide basic 1 click deployment.

In the next release we are planning to add signficantly more features to this area as well.

Hope this helps,

Scott

# re: VS 2005 Web Deployment Projects

Friday, June 16, 2006 4:22 PM by Gabe
I am getting the same error as Adam regarding the:

"aspnet_merge.exe" exited with code 1.

The project compiles fine, but when i go to build it with the deployment project it throws this error.  I do get other projects to compile, but the one that I copied the Master Page from another project for is throwing this error.

Basically, my end goal is to have my core web application that has master pages.  I want to build plugins for this module that contains full asp.net pages, but I want those pages to use a master page in the core project.  The only way that it would let me compile that plug-in app is if I copied the Master page fromt the core project into the plugin project.  I don't like this concept but it does compile.  It just throws this error when I try to use the deployment project.

Any help would be appreciated,

Gabe
gkeller@r-effects.com

# re: VS 2005 Web Deployment Projects

Sunday, June 18, 2006 7:08 PM by ScottGu
Hi Gabe,

Simon has posted some steps above to get a more detailed error message for the "aspnet_merge exited with code 1" error.  You should be able to use these to figure out what is going on.

Thanks,

Scott

# re: VS 2005 Web Deployment Projects

Monday, June 19, 2006 5:29 AM by MedCon
Hi Scott:

we have a problem here publishing our VS2005 project, which uses 1 main DLL, which requires serveral other supporting DLLs. Problem is VS2005 seems not know anything about the other supporting DLLS even though we manually copy them over to the same folder which contains the main DLLS.

Any ideas?

regards

# re: VS 2005 Web Deployment Projects

Wednesday, June 21, 2006 5:26 PM by Saleem Javid
Hi Scott,

The Web Deployment Project is an excellent effort to ease the deployment of the web projects.
Thankyou all for this greate add-in.

I have problem similar to the one presented by Eric Schoen on 26th May, 2006.
My application has its own custom sectionGroup and its own sections.
I want to replace the entire sectionGroup during the Deployment or i can even perform replacement of the individual sections. But when i start defining the replacements in the property pages, i keep getting the error : web.config(1): error WDP00002: missing section PPCSections.

where PPCSections is my sectionGroup name.

If Eric has sent you an email as requested by you, then it would really help me if you can give me the solution for this scenario. I can send you the config file if you want for further analysis.

Thanks,
Saleem

# re: VS 2005 Web Deployment Projects

Thursday, June 22, 2006 1:01 AM by ScottGu
Hi Saleem,

Can you send me an email (scottgu@microsoft.com) with a few more details about the problem?  I can then loop you in with a person here who can help.

Thanks,

Scott

# re: VS 2005 Web Deployment Projects

Thursday, June 22, 2006 1:22 AM by ScottGu
Hi MedCon,

Can you send me an email (scottgu@microsoft.com) that contains more details about your problem?  I can then get someone on the team to help.

Thanks,

Scott

# re: VS 2005 Web Deployment Projects

Wednesday, July 26, 2006 2:31 PM by Mike Bridge

I don't know if I'm missing something here, but I still feel like there's a big gap in the VS2005 deployment utilities.  I would find it useful if there were an integrated tool to incrementally copy my webapp changes via something like FTP to its final destination.  It might exist, but I don't know what it is.  

We have a massive web site and only a small number of files are ever updated at one time.  I don't see any Microsoft utilities that support incremental updates.  Uploading the entire web site every time is not a good option.

I've been using WS_FTP's ftpsync utility in .Net 1.1 for this---I set up some definitions for what needs to be copied and what needs to be omitted, then every time I make an update, I click one button and it compares the dates and uploads just the changed files.

"Website->Copy Web Site" doesn't seem adequate for this.  Besides, I can't see how to point it to the deployment project that gets created using the Deployment Project extension.

Essentially, I want a one-button incremental deployment option.  Is there a way to accomplish this that I'm missing?

# re: VS 2005 Web Deployment Projects

Wednesday, July 26, 2006 11:57 PM by Natalie
Hi, The Web Deployment Project tool has two different release dates. One is around Nov 2005, and another one is April 4th 2006. What's the difference? How can I remove the eariler one in order to install the later version? Thank. Natalie

# re: VS 2005 Web Deployment Projects

Friday, July 28, 2006 12:24 AM by ScottGu

Hi Natalie,

The November 2005 release was the first version.  We have since released a newer version that has a number of bug-fixes and a few features.

To install the new version, just uninstall the old one, and then run the new version's installer.

Thanks,

Scott

# re: VS 2005 Web Deployment Projects

Thursday, August 3, 2006 4:34 AM by hassan
hi. when i copiled project i got below error. "aspnet_merge.exe" exited with code 1 i solved my problem by renaming/removing aspx file that has same class names in separate folders. generally this error occures when merging all assemblies in one can make error (e.g in my project, duplicate class name in one assembly) finally i have a question, in this post you said "you can now generate a single named assembly for all pages + classes in your web project ", can i complile asp.net websites that just one file needed to be deployed (for example MyWebsite.dll)? without any .aspx or html page? best wishes,

# re: VS 2005 Web Deployment Projects

Friday, August 4, 2006 7:02 PM by Ioan Cozma
Hi Scott, How can I exclude from a build the files that are not required for an application to run ? I don't need the folders "obj", "MyProject" and other files: .vbproj, .vbproj.user,PrecompileApp.config,.vbproj.vspscc that are created by default when building a WebDevelopmentProject ?. Thanks, Ioan

# re: VS 2005 Web Deployment Projects

Saturday, August 5, 2006 12:33 PM by ScottGu

Hi Ioan,

With web deployment projects you can add this content within your build file to explictly exclude certain files from being generated in the deployed directory:

 <ItemGroup>

   <ExcludeFromBuild Include="$(SourceWebPhysicalPath)\Test\**\*.*"/>

 </ItemGroup>

For example, above it is excluding the "test" directory and all its contents.

Alternatively, you can also use the VS 2005 Web Application Project (tutorials can be found here: http://webproject.scottgu.com).  Web Application Projects are like VS 2003 web projects and only deploy things within the project that are marked as "content" items.  You might find this easier to use for your specific scenario.

Hope this helps,

Scott

# re: VS 2005 Web Deployment Projects

Saturday, August 5, 2006 12:34 PM by ScottGu

Hi Hassan,

Unfortunately there isn't a way to have only one single file generated.  We still need some files on disk so that IIS knows how to map the urls to ASP.NET.  

Hope this helps,

Scott

# re: VS 2005 Web Deployment Projects

Monday, August 7, 2006 2:22 AM by hassan
thanks scott for reply, i thinking about a HttpHandler that has specific config section about mapping each ASPX page to specific class. but problem is until I just used ASP.NET for using! not for developing its self. i now how i can call asp.net engine to response to a request by creating page class instance and ... can you help me finding resources about that. best wishes,

# re: VS 2005 Web Deployment Projects

Monday, August 7, 2006 10:03 AM by Matt Evans
Hi Is it possible to add the web.config replacement files to the WDP project so that they get added to VSS etc? I tried to put them in my web site project and point the WDP project at those but it comes up saying they are invalid and have to be in the project folder or a sub folder... Thanks Matt

# re: VS 2005 Web Deployment Projects

Tuesday, August 8, 2006 1:00 AM by ScottGu

Hi Matt,

You should definitely be able to check-in these replacement web.config section files into VSS.  Can you provide more details on the issue you are seeing?  Could your paths not be correct?

Thanks,

Scott

# re: VS 2005 Web Deployment Projects

Tuesday, August 8, 2006 8:12 AM by John Huang
Thanks. I hope this will get around some problems with the Publish Website. However, I have some feature requests. I have a solution with multiple websites and multiple libraries. Adding a web deployment project for each website quickly added the cluster to the solution. So, it would be nice to set up one deployment project for multiple websites so I can do one build for everything. Second, it would still be nice to do the final step - FTP to the server, instead of requiring me to launch a different app. John

# re: VS 2005 Web Deployment Projects

Thursday, August 24, 2006 10:23 AM by Peter
Hi, I want to add password field to custom dialog page in VS 2005 Web Setup. How to go about it?? This field has to be masked. Thanks in Advance.

# re: VS 2005 Web Deployment Projects

Monday, August 28, 2006 10:27 AM by Steven
How do I modify sections in the web.config such as customErrors and sessionState using the WebConfigReplacementFiles?

# re: VS 2005 Web Deployment Projects

Tuesday, August 29, 2006 9:18 AM by Manish
Is it possible to execute an .exe file from target.. how we can achive that..and also I tried to include one .config file with WebConfigReplacementFiles tag by Debug condition for connectionString. when i tred to fetch the valve with ConfigurationManager.ConnectionStrings["MyConnection"].ConnectionString , it does not get that value accept an error "Object reference not set to an instance of an object.".. why it is so..

# re: VS 2005 Web Deployment Projects

Tuesday, August 29, 2006 1:32 PM by Steven
Daniel, "Web Deployment Projects" is what this blong entry is all about thus my question. At any rate the answer is: system.web/sessionState=myConfiguration.config;

# re: VS 2005 Web Deployment Projects

Tuesday, August 29, 2006 4:39 PM by Fuji
The Web Deployment Project does not work with DotNetNuke 4.3.4 when you select the option Merge each individual output to its own assembly". I challenge the WDP team to find a fix for this. DotNetNuke is an .NET open source and is free for download from www.dotnetnuke.com.

# re: VS 2005 Web Deployment Projects

Wednesday, August 30, 2006 1:49 AM by ScottGu
Hi Manish, I'm not 100% sure I understand the issue you are running into. If you want to send me email with more details I can try and loop you in with folks on the team to get it fixed. Thanks, Scott

# re: VS 2005 Web Deployment Projects

Friday, September 1, 2006 6:21 AM by Paul Dunstone
Whenever I build using a web deployment project I always receive the following error: Server Error in '/Community' Application. ---------------------------------------------------------------------------­----- Value cannot be null. Parameter name: type Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.ArgumentNullException: Value cannot be null. Parameter name: type Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [ArgumentNullException: Value cannot be null. Parameter name: type] System.Activator.CreateInstance(Type type, Boolean nonPublic) +2796915 System.Web.Profile.ProfileBase.CreateMyInstance(String username, Boolean isAuthenticated) +76 System.Web.Profile.ProfileBase.Create(String username, Boolean isAuthenticated) +312 CommunityServer.ASPNet20MemberRole.CSProfiles.Create(String userName, Boolean authenticated) +40 CommunityServer.Components.CommonDataProvider.PopulateUserFromIDataReader(I­DataReader dr, IMembershipUser member, Boolean isEditable, Boolean includeAudit) +157 CommunityServer.Components.CommonDataProvider.cs_PopulateUserFromIDataReade­r(IDataReader dr, Boolean isEditable) +59 CommunityServer.Data.SqlCommonDataProvider.GetUser(Int32 userID, String username, Boolean isOnline, Boolean isEditable, String lastAction) +516 CommunityServer.Data.SqlCommonDataProvider.GetAnonymousUser(Int32 settingsID) +457 CommunityServer.Users.GetAnonymousUser(Boolean fromCache) +242 CommunityServer.Users.GetAnonymousUser() +29 CommunityServer.Users.GetUser(Int32 userID, String username, Boolean isOnline, Boolean isCacheable) +147 CommunityServer.Users.GetUser(Boolean isOnline) +48 CommunityServer.Components.CSContext.get_User() +129 CommunityServer.CSHttpModule.Application_AuthorizeRequest(Object source, EventArgs e) +191 System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep­.Execute() +92 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64 ---------------------------------------------------------------------------­----- Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42 When I build using msbuild or in the IDE the solution works as expected. Any ideas?

# re: VS 2005 Web Deployment Projects

Saturday, September 2, 2006 12:14 PM by ScottGu

Hi Paul,

Can you send me email (scottgu@microsoft.com) with more details on the problem you are having?  I can then loop in some folks to look at it (it is a little hard above since the formatting was lost <g>).

Thanks,

Scott

# re: VS 2005 Web Deployment Projects

Tuesday, September 5, 2006 3:12 PM by Sriman Bapatla
Hi guys: How to set the port number in vs 2005, web setup projects. thanks Sriman

# re: VS 2005 Web Deployment Projects

Monday, September 11, 2006 1:35 PM by Mark Rae
Hi Scott, Another quickie about conditional compilation. Is there any possibility that conditional compilation could be tied to the currently active configuration, sort of like it used to be in v1.x? By that, I mean that by selecting to run in DEBUG mode, you used to be able to write something like: #if (DEBUG) this shows in normal font #else this shows greyed out #endif I realise that you can achieve similar functionality by toggling the setting in web.config, but that only goes part of the way. It would be really something if we could have something similar for WDP. E.g. supposing we defined three configurations (DEBUG, STAGING & RELEASE), it would be great to be able to write: #if (DEBUG) run this code #endif #if (STAGING) run this code #endif #if (RELEASE) run this code #endif Is that something worth considering? Best, Mark Rae

# re: VS 2005 Web Deployment Projects

Tuesday, September 12, 2006 10:52 AM by ScottGu

Hi Mark,

You can actually do this today with the VS 2005 Web Application Project option (http://webproject.scottgu.com for more details on this).  Specifically, you can use the active configuration option to control different compiler directives in your code.

Hope this helps,

Scott

# re: VS 2005 Web Deployment Projects

Tuesday, September 12, 2006 3:56 PM by Mark Rae
Hi Scott, Thanks for the reply. I've been through every page of your site and searched for DEBUG, but I'm unable to find it. Can you please point me to where you talk about using the active configuration option to control different compiler directives in code...? Thanks, Mark

# re: VS 2005 Web Deployment Projects

Tuesday, September 12, 2006 4:54 PM by Tony Roberts
Regarding the "Value cannot be null" error that Paul Dunstone wrote, you can fix this by unchecking the "Treat as library component" checkbox. It kept happening to me when I tried to use the Profile object. This seems to have fixed the problem.

# re: VS 2005 Web Deployment Projects

Friday, September 15, 2006 3:17 AM by ScottGu

Hi Mark,

Are you using a VS 2005 Web Site Project or a VS 2005 Web Application Project?

If you are using a VS 2005 Web Site Project, then the debug flag is set using the <compilation mode="debug"> attribute set in the application's web.config file.

Thanks,

Scott

# re: VS 2005 Web Deployment Projects

Friday, September 15, 2006 7:14 AM by Mark Rae
Scott, I'm using s VS 2005 Web Application Project. I understand about web.config - that's not what I'm asking about. I'm wondering whether it's possible to define three configuration options (DEBUG, STAGING and RELEASE) and then write something like: #if (DEBUG) run this code #endif #if (STAGING) run this code #endif #if (RELEASE) run this code #endif

# re: VS 2005 Web Deployment Projects

Friday, September 15, 2006 10:08 AM by ScottGu

Hi Mark,

If you are using the VS 2005 Web Application Project option, then you can choose the Build->Build Configuration Manager option to switch between configurations as well as define new configuration modes (for example: you could have one for DEBUG, STAGING and RELEASE like you outlined above).

#if (DEBUG) will be defined as true by default when the Debug configuration is selected.

You should be able to also associated other #ifdef flags with each configuration option as well.

Hope this helps,

Scott

# re: VS 2005 Web Deployment Projects

Friday, September 15, 2006 11:20 AM by Stephen
I used both the web deployment and web setup projects with success. However I would like to have the web.config encrypted on the production machine. If I do the encryption on the web deployment post build event the file gets encrypted but it can't be used on the production machine since it's using the machine key encryption. So I assume my only two options are using user key encryption for the web.config or finding some way to run the aspnet_regiis commands at the end of my web setup project. What's the best way to accomplish deploying an encrypted web.config? Thanks, Stephen

# re: VS 2005 Web Deployment Projects

Saturday, September 16, 2006 10:22 AM by Mark Rae
Scott, I think we're going round in circles here... To reiterate, I have three Build configurations: Debug, Staging and Release. I understand that #if(DEBUG) will be defined as true by default when the Debug configuration is selected. What I was asking was whether #if(STAGING) will be defined as true by default when the Staging configuration is selected... And whether #if(RELEASE) will be defined as true by default when the Release configuration is selected... I also understand that I can set up conditional compilation constants by hand using #define - but I would have to do that at the top of *every* page where I wanted conditional compilation to occur, and modify them in every page every time I want to change the conditional compilation logic. If I add another Build Configuration, I would then have to modify every #define statement to include that new Build Configuration... Mark

# re: VS 2005 Web Deployment Projects

Tuesday, September 19, 2006 12:16 AM by ScottGu

Hi Mark,

If you pull up your project's properties page, you can then click on the "Build" tab of the project.  Within this dialog there is space to specify custom conditional compilation symbols.  You could use this to specify "Staging" for example, and have it apply to every code-file in the project.

You can use the "Configuration" drop-down above this to configure it to apply to all build configurations - or just apply it to selective configurations.

If you use this later option, you can then define a custom "Staging" build configuration, and have the conditional #staging only apply to true when that build configuration is set.

Hope this helps,

Scott

# re: VS 2005 Web Deployment Projects

Tuesday, September 19, 2006 12:26 AM by ScottGu

Hi Stephen,

For encrypting values within your web.config file on the production server, I'd recommend writing a custom install action with your VS Setup project.  This could then programmatically encrypt the values for you.

Hope this helps,

Scott

# re: VS 2005 Web Deployment Projects

Wednesday, September 20, 2006 3:08 AM by Dv
Hi All, Great tool. Is there a tutorial or articles on using the external configuration source file to replace sections in the web config?

# re: VS 2005 Web Deployment Projects

Thursday, September 21, 2006 1:11 AM by ScottGu

Hi DV,

You can replace the entire file instead of the <configuration> section.  You can easily add an After Build target to your WDP project file that will copy whatever files you want.

For example here is a AfterBuild event that copies web.config.debug as web.config

 <Target Name="AfterBuild">

   <Copy SourceFiles="$(SourceWebPhysicalPath)\web.config.$(Configuration)"

   DestinationFiles="$(WDTargetDir)\web.config" />

 </Target>

Hope this helps,

Scott

# re: VS 2005 Web Deployment Projects

Thursday, September 21, 2006 1:15 AM by ScottGu

Hi Mark,

Any chance you could send me an email with more details on this error?  I can then loop in some folks who can help.

Thanks,

Scott

# re: VS 2005 Web Deployment Projects

Thursday, September 21, 2006 1:58 PM by Sascha
Hey Scott, I've been digging my way through the WDP, awesome work! One thing I have been wondering about, though, how come that {HintPathFromItem} is not included in the SearchPaths attribute for the ResolveAssemblyReference task in Microsoft.WebDeployment.targets? I am referencing binaries using HintPath, and now they are not being picked up correctly and I have to use my own ResolveAssemblyReference task. Am I missing something? Thanks, Sascha

# re: VS 2005 Web Deployment Projects

Thursday, October 5, 2006 1:23 PM by stfkbf
Hi Is there any way to get the Web Deployment Project to deploy in the same fashion the Build->Publish command does? Build->Publish seems to only require access to port 80, whereas the Web Deployment Project seems to requires access to port 80, 135 (RPC) + RPC auto assigned ports and possibly port 445 (if xcopy is used). None of the tasks available in task sets like MSBuild.Community.Tasks and Microsoft.Sdc.Common seem to be able to deploy using the same method Publish uses? Especially RPC is difficult to get through firewalls (due to the dynamic ports), yet this seems to be the only way to get the tasks to create virtual directories. It would be great to be able to use the Web Deployment Project since it is very flexible in many other ways.

# re: VS 2005 Web Deployment Projects

Sunday, October 8, 2006 9:34 PM by Amrinder Sandhu
It is a pain to have to uninstall the old application before being to install an updated version. Is there a way to have the msi installer just reinstall it with the new files?

# re: VS 2005 Web Deployment Projects

Friday, October 13, 2006 4:14 PM by Jignesh
How do i customize my web deployment projet so that it install web service to IIS with settings of using ASP.net 2.0 instead of 1.1 and Using windows Authentication

# re: VS 2005 Web Deployment Projects

Monday, October 16, 2006 11:46 AM by Vishal
I have vs2005 web application project, which I am including a custom library. When I create a web setup project without web deployment project, I get compilation Error. the error says " cs0246 The type or namespace name '' could not be found If I create a web deployment project and create a web setup project as explain above, I can deploy the application on the webserver. I would like to know, If I can deploy web applications without using web deployment project in VS2005. Thanks in advance.

# re: VS 2005 Web Deployment Projects

Tuesday, October 17, 2006 10:36 AM by ScottGu

Hi Vishal,

You don't need a web deployment project in order to deploy a web-application project.

You should just be able to go to the Build menu and select the "Publish" option to publish a project to a location.

Hope this helps,

Scott

# Keeping assemblies of referenced projects

Tuesday, October 17, 2006 5:10 PM by kookool
Web deployment is a great thing. I have a problem, though - the resulting compiled web site doesn't have assemblies that its referenced projects depends on. This makes it unusable. In my case I have a solution with a webdep proj myweb_deploy. It has project references for 3 .net assembly projects. These, in turn, have references to specific assembly dlls. In the resulting web site I have only the dlls of the compiled assemblies of the referenced projects but without the referenced dll assemblies. Am I doing something wrong? Should the web site that the webdep proj is referencing be marked for build, as well? thanks

# re: VS 2005 Web Deployment Projects

Wednesday, October 18, 2006 10:33 PM by Pure Krome
G'Day Scott. Is there a way to make sure the destination web site is completly cleaned/all files deleted after a build is successful? If so, is there a way to delete everything from the destination website except a folder or file? Cheers from Melbourne, Australia. -PK-

# Adding references to VS 2005 Web Deployment Projects

Thursday, October 19, 2006 8:44 AM by surekha
How do I add references to a DLL(System/otherwise)using a fully qualified physical path in the .wdproj file… I can't seem to be able to resolve references using ItemGroup with Reference Include="". I even tried the strong name, to no avail. Am using VS.net 2005 and the webdeployment.msi from Feb '06. Thank you.

# re: VS 2005 Web Deployment Projects

Thursday, October 19, 2006 11:58 PM by ScottGu

Hi Pure,

You can add custom tasks to your MSBuild file that delete files/folders if you want.  These could run as either pre or post build tasks - so could clean up stuff either before or after the build completes successfully.

Hope this helps,

Scott

# re: VS 2005 Web Deployment Projects

Friday, October 20, 2006 12:00 AM by ScottGu

Hi Kookool,

That is pretty odd - you should have the assemblies from the referenced projects as well.  Can you send me email with more details about the problem, and I can try and help.

Thanks,

Scott

# re: VS 2005 Web Deployment Projects

Friday, October 20, 2006 12:15 AM by ScottGu

Hi Surekha,

Instead of referencing the assembly from the web deployment project file, you should instead reference it from the project. It will then be pulled in as part of compilation.

Hope this helps,

Scott

# re: VS 2005 Web Deployment Projects

Sunday, October 22, 2006 3:20 AM by Arpita
I am able to deploy the project and also install. But i am unable to access it in IE. Plz help me .

# re: VS 2005 Web Deployment Projects

Friday, October 27, 2006 4:21 AM by xgene
Hi Scott, I'm trying out the Web Deployment project and replacing the connection strings in the web.config files works fine. However, my DAL (using typed data sets) is in a separate class library where the default behavior creating a new typed data set puts the connection strings into an App.config file local to the class libary. Is there any way to either: a) cause the data sets to use the connection strings in the web.config file, or b) use the web deployment project to rewrite the App.Config file? Or is there another / better way to do this? Thanks.

# re: VS 2005 Web Deployment Projects

Saturday, October 28, 2006 12:39 PM by ScottGu

Hi XGene,

What you'll want to-do is add the same connection string name that is currently within your app.config file to your web.config file.  As long as the connection-string name is the same, then the class library will use this at runtime to connect to the database.

Hope this helps,

Scott

# re: VS 2005 Web Deployment Projects

Monday, October 30, 2006 6:38 AM by Khurram Shahzad
Hello, I followd Mr. Simon's method, but can you describe some more detail, coz I've tried my best but I could't find anything what Mr. Simon mentioned after "SELECT --> TOOLS " in my Visual Studio 2005 IDE nothing there, plz plz help fellows.... If possible reply me at austinnpawerss@hotmail.com ********************** re: VS 2005 Web Deployment Projects Thursday, June 08, 2006 7:56 PM by Simon Morgan For those that have problems with Error 24 "aspnet_merge.exe" exited with code 1. The error does not say much; however, I did find out that it was a duplicate class. OK, with padi.com being so big, it was hard to find. So the following is a quick way to isolate the problem and fin the duplicate(s). -Select Tools --> Options. -Then in the Projects and Solutions branch, select Build and Run. -You'll see a dropdown box for MSBuild Project Build Output Verbosity. Change this to Diagnostic, and OK. -show your build output by selecting the View --> Output option. -Make sure that in the 'Show output from' box, you've selected "Build". -Then just build your project, and wait for the inevitable fail. You will see where the duplicates are when it fails to build. Regards, Simon Morgan **********************

# re: VS 2005 Web Deployment Projects

Monday, October 30, 2006 1:37 PM by Willie
Hello Scott, I'm having a problem deploying my webapp through WebDeploy project. I've created a webdeploy project and building through a build type. When execute the build type I getting the following error: "C:\Program Files\MSBuild\Microsoft\VisualStudio\v8.0\WebDeployment\Microsoft.WebDeployment.targets(311,24): error MSB4024: The imported project file could not be loaded. '?' is an unexpected token. The expected token is '='. Line 311, position 24. C:\Program Files\MSBuild\Microsoft\VisualStudio\v8.0\WebDeployment\Microsoft.WebDeployment.target" Do you know if there's a solution for this error, I haven't been able to find any solution for this. Please reply on this error, your support is greatly appreciated. Thanks, Willie

# re: VS 2005 Web Deployment Projects

Tuesday, October 31, 2006 1:08 AM by ScottGu

Hi Willie,

Can you send me an email with more details about your project and this error?  I can then connect you with someone who can help.

Thanks,

Scott

# re: VS 2005 Web Deployment Projects

Tuesday, November 7, 2006 4:56 AM by Jay
Hi Scott I have created a web deployment project for my ASP.NEY 2.0 application whose output I have piped to a websetup project . I want my web.config to be editable on the production server without provoding any other replacement config files.In the deployment section , what option should i select ..? Thanks Jay

# re: VS 2005 Web Deployment Projects

Wednesday, November 8, 2006 4:33 PM by Mark
The WDP project works great for replacing web.config's for different deployments! We have an issue in a multi-developer/VSS scenario though. Everytime you build VS.NET attempts to checkout the .wdproj file and this creates contention on the file for multiple devs. Is there a solution for this? Thanks!

# re: VS 2005 Web Deployment Projects

Wednesday, November 8, 2006 10:47 PM by ScottGu

Hi Jay,

IIS has an admin tool that allows you to configure connection-string values.  If you want to have an admin configure just those, one option would be to have them just use that.

Thanks,

Scott

# re: VS 2005 Web Deployment Projects

Wednesday, November 8, 2006 10:48 PM by ScottGu

Hi Mark,

I'm not entirely sure I understand the problem you are having.  Any chance you could send me email about it and I'll loop in a few folks who can help investigate?

Thanks,

Scott

# re: VS 2005 Web Deployment Projects

Thursday, November 9, 2006 3:31 AM by Ran Davidovitz
Hi. We are facing the excact same problem, When a developer takes the solution the IDE automatically checks out the Web Deployment Project. This causes a lot of frustration and i conceder as a high bug. Is there anything that we are doing wrong?

# re: VS 2005 Web Deployment Projects

Thursday, November 9, 2006 10:55 AM by Lorin Davis
Hi Scott, This web Deployment Add-in is awsome .. great work. I was wondering if any thought has been put into being able to Build and Deploy Multiple Websites within one Web Deployment Project? For myself we have built up a Enterprise Web Solution that includes 5 UI Websites, and 6 Webservice Websites, currently we have to create a deployment project for each of the 11 websites however it would be nice to be able to Deploy all of the Sites from one Project. Does this functionality currently exist, and if not are there plans to add it in the future? thanks Lorin.

# re: VS 2005 Web Deployment Projects

Saturday, November 11, 2006 1:02 AM by Web deployment
Dear All I am facing the problem while hosting my asp.net 2.0 application on the client side. I dont want to put source code i.e .cs files. Please help me. its urgent Thanks in Advance Saurabh Saxena

# re: VS 2005 Web Deployment Projects

Saturday, November 11, 2006 1:22 PM by ScottGu

Hi Ran,

Can you send me email about this issue, and I'll then loop you in with a few folks on my team who can help investigate.

Thanks,

Scott

# re: VS 2005 Web Deployment Projects

Saturday, November 11, 2006 1:23 PM by ScottGu

Hi Lorin,

Right now the web deployment project only really works against one web-site.  However, the MSBuild tasks within the project file for the web deployment project could be customized into your own MSBuild file to work against multiple web-sites in a single project.

Hope this helps,

Scott

# re: VS 2005 Web Deployment Projects

Saturday, November 11, 2006 1:24 PM by ScottGu

Hi Saurabh,

If you use the web deployment option above, you can build and remove all of the source code for your project.  You can then just copy and deploy it on your remote host.

Hope this helps,

Scott

# re: VS 2005 Web Deployment Projects

Monday, November 13, 2006 1:46 AM by Adam
Hi Scott, Awesome tool :) I just wanted to add a brief distinction for newer players (the ranks of which I only just graduated from on this one!)... It wasn't very clear to me that this Web Deployment Project was in fact different to the Web Setup Project that ships with VS2005 - since they both sound pretty similar! In other words, 3 different projects form part of the deployment: The initial Web Site Project -> Web Deployment Project -> Final Web Setup Project (which produces the .MSI). Cheers!

# re: VS 2005 Web Deployment Projects

Wednesday, November 15, 2006 6:51 AM by Paul Reed

I also have the null reference exception following building a WDP of a web application. It is to do with ProfileBase not being set up correctly, I expect that the reference is lost in the build somewhere. Is there a work around ? I suspect it is the same problem as:

"Friday, September 01, 2006 6:21 AM by Paul Dunstone"

was having which you took offline. Did you resolve his issue ?

# re: VS 2005 Web Deployment Projects

Thursday, November 16, 2006 4:16 AM by learnerplates

Hi Scott,

Great article, it's been very helpful.

Can you confirm for me that the website is deployed to IIS before the Custom Action functionality is started i.e. the Installer.Install method etc is called after the website has been deployed to IIS or whereever.

Thanks,

LP.

# re: VS 2005 Web Deployment Projects

Thursday, November 16, 2006 3:48 PM by Stuart Allen

I am also running into the issue where other developers are causing checkouts of several deployment projects just by loading the solution.

Scott, I already emailed you, but thought I would post here for an extra measure.

# re: VS 2005 Web Deployment Projects

Thursday, November 16, 2006 7:43 PM by Christian

HI,

I found this tool as I was searching for a way to pass deploymnt packages off to another team. I added the "Add-in" and created a new project. Then I output that to an MSI.

It works fine for deployment but when I added something to the project and turned off building the Setup and deployment projects, the app errors saying that "The type could not be loaded," in reference to a Master page in a sub folder. Copying the MAster page to the root folder then causes errors on every other Master Page.

I Noticed that after the Deployment project was created that the Master Pages inherited the Page and the Project, i.e.

<% Inherits 'Page', 'Project'>

Now the project refuses to build. In frustration i removed the projects and eventually deleted them but I still get the errors.

I noticed later in the post that it should be possible to not build the Setup/Deployment projects and continue to add/edit pages.

I'm really stuck.

# re: VS 2005 Web Deployment Projects

Friday, November 17, 2006 10:41 AM by ScottGu

Hi Christian,

Can you send me an email (scottgu@microsoft.com) with more details about your configuration and the issue you are running into?  I can then help try and figure out what the problem is.

Thanks,

Scott

# re: VS 2005 Web Deployment Projects: Error Removing Pages

Tuesday, November 21, 2006 2:20 PM by Jeff Welch

I have problems when I delete or remove pages.  Well, let me rephrase that, other people get errors when they get latest on my solution.  You see, even if I delete the file in the web project and the deployment project works fine; when they build that old deleted aspx file still exists in the deployment directory.  The deployment project throws an error when it tries to precompile the site, because it finds the aspx but no codebehind  class in the assembly.  

Or so it would seem.

Is that a correct assessment?  Is there a possible solution?

# re: VS 2005 Web Deployment Projects

Tuesday, November 21, 2006 2:21 PM by daniel liu

I have a DNN4.3.5 website which consists of many custom modules, when I try to build web deployment project, always error:

"aspnet_merge.exe" exited with code 1.

since we have many modules, so it is impossible for us to change the name or assembly one by one, so web deployment project could not be used in big web project, I assume.

also some dll in GAC could not be deployed or published to production server.

I think Website Publish and web deployment project is a failure in enterprise level website deployment.

# re: VS 2005 Web Deployment Projects

Tuesday, November 21, 2006 5:38 PM by Jeff Welch

OK, so I answered my own question.  I neglected to say I am building a Web Project rather than a Web Site.  That being said, when I exclude a file, it simply removes the project/file link.  The deployment still tries to precompile it.  If I were running a Web Site, and excluded a file, it would rename the extension to .exclude and the deploy project would still work fine.

So, if you are running Web Projects and you want to exclude a file, you'll have to delete it and find some other way of hiding it.

# re: VS 2005 Web Deployment Projects

Sunday, November 26, 2006 2:50 PM by ScottGu

Hi Daniel,

DNN has a duplicate class name in the project - which is what is causing the compile error.

To see what the duplicate class name is, follow the below steps:

1) Go to tools->options in VS

2) Choose Projects and Solutions->Build and Run

3) Change the MSBuild Project verbosity level to Detailed (by default it is minimal)

When you re-build the project you'll then see what class name is duplicated.  Once you rename one of them it should build clean.

Thanks,

Scott

# re: VS 2005 Web Deployment Projects

Wednesday, November 29, 2006 11:27 PM by ScottGu

Hi Stuart,

It is a very good suggestion and one we've heard before.

In the meantime, one thing you might look at is using the web deployment project to build your project into a staging directory, and then use an FTP program to just incrementally copy over files.

Hope this helps,

Scott

# re: VS 2005 Web Deployment Projects

Thursday, November 30, 2006 11:18 AM by Stuart Allen

That's essentially what we are doing now: deploying to staging location then copying over.

Would love to see a "don't clobber entire structure" option in the next release ... :-)

# Web Config configuration Error

Tuesday, December 5, 2006 5:39 AM by Phil

Hi Scott,

We have migrated our website from ASP.NET 1.1 to 2.0 and are trying to use the Web Deployment Project for deploying.  One thing we would like to use is the web config file section replacement for debug and release builds of the site.  Unfortuantely this isn't working because we have defined a custom configSection:

<configSections>

  <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, SystemFramework"/>

</configSections>

And when we try to build we get the error:

An error occurred creating the configuration section handler for log4net: Could not load file or assembly 'SystemFramework' or one of its dependencies. The system cannot find the file specified. (C:\pjm\ExpertMatch2\web.config line 7)

In the deployment project.

Any ideas how to fix this?

Thanks, Phil.

# re: VS 2005 Web Deployment Projects

Tuesday, December 5, 2006 8:09 AM by Flavio Baldoni

We currently use an automated build process where I work. After you have set up the web deployment through the IDE is it possible to run the deployment through some command line utility ?

# re: VS 2005 Web Deployment Projects

Wednesday, December 6, 2006 12:20 AM by ScottGu

Hi Phil,

Any chance you could send me an email with the details of this issue?  I'll then loop in some folks from my team to help investigate.

Thanks,

Scott

# re: VS 2005 Web Deployment Projects

Thursday, December 7, 2006 8:37 AM by philmorley

Scott,

Just e-mailed you with the details of the problem.  If you require any more information, please let me know.

Thanks, Phil.

# re: VS 2005 Web Deployment Projects

Sunday, December 10, 2006 3:50 AM by Alex

Hi Phil,

I'm trying to publish website with option "Merge all outputs to a single assembly" and in this way to mimic VS-2003 behaviour wich should deliver one .dll file with consistent name. However I get number of App_Web_xxx.dll files. Actually the behaviour is the same as when I publish throw VS-2005.

Am I doing something wrong?

# re: VS 2005 Web Deployment Projects

Sunday, December 10, 2006 11:40 PM by ScottGu

Hi Alex,

I suspect that you aren't publishing via the web deployment project - which might be what is causing the problem.

If you want the same behavior as VS 2003, you actually might just want to skip the web deployment path and use the VS 2005 Web Application Project option.

You can migrate a web site project to it directly by following these steps:

C#: http://webproject.scottgu.com/CSharp/Migration2/Migration2.aspx

VB: http://webproject.scottgu.com/VisualBasic/Migration2/Migration2.aspx

Once you do this, then when you do a publish web it will output a single assembly.

Hope this helps,

Scott

# re: VS 2005 Web Deployment Projects

Tuesday, December 19, 2006 2:07 PM by ScottGu

Hi Thomas,

I haven't seen this issue before.  Any chance you could send me an email describing it?  I will then loop in some folks from my team who can help investigate.

Thanks,

Scott

# re: VS 2005 Web Deployment Projects

Wednesday, December 27, 2006 1:46 PM by Sandro Rudin

i was getting the "aspnet_merge.exe" exited with code 1 error message so i turned on diagnostic output. there it said that...

An error occurred when merging assemblies: Der Index war außerhalb des Arraybereichs.

what means:

An error occurred when merging assemblies: Index was out of range.

i'm building with the "Move all output to a single assembly" option.

what can i do to get any information that helps me solve the problem?

thx in advance

# re: VS 2005 Web Deployment Projects

Wednesday, December 27, 2006 9:32 PM by ScottGu

Hi Sandro,

Can you send me an email (scottgu@microsoft.com) with more details about the error you are seeing?  I can then loop in some folks to help you investigate.

Thanks,

Scott

# re: VS 2005 Web Deployment Projects

Tuesday, January 2, 2007 11:57 PM by Kelvin Tse

Found out what the problem is:  The Report Viewer 2005 Redistribute is not installed on production server.  On the other server, we install .Net framework 2.0, and then Report Viewer 2005 Redistribute, and then run the installation package.  Everything works fine.

The odd part is there's no clue that the Report Viewer assemblies are missing ...

# re: VS 2005 Web Deployment Projects

Wednesday, January 3, 2007 2:42 AM by kp low

hi Scott,

is there a way to know if report viewer is installed in the client pc when we install our web app?

thanks!

# re: VS 2005 Web Deployment Projects

Wednesday, January 3, 2007 9:26 AM by ScottGu

Hi KP,

To be honest with you, I'm not really sure how to detect if the report viewer control is installed.

Have you tried asking this question on the reporting services forum on MSDN?  Someone there probably has more experience with this feature than me and might know.

Thanks,

Scott

# re: VS 2005 Web Deployment Projects

Wednesday, January 3, 2007 7:09 PM by kp low

yeah, i've posted in the msdn report control forum, asp.net forum and google forum. no prob Scott, i was just trying my luck.

Thanks.

# re: VS 2005 Web Deployment Projects

Thursday, January 4, 2007 11:55 AM by Oscar

Hi Scott,

I'm having a similar problem to the one able. I get the following error when I compile to a single assembly:

   An error occurred when merging assemblies: ILMerge.Merge: The target assembly 'ImpalaSoft.Afromuse' lists itself as an external reference.

   C:\Program Files\MSBuild\Microsoft\WebDeployment\v8.0\Microsoft.WebDeployment.targets(574,9): error MSB6006: "aspnet_merge.exe" exited with code 1.

The project in question compiles fine when I build it on it's own.  Any idea?

# re: VS 2005 Web Deployment Projects

Saturday, January 6, 2007 6:36 PM by ScottGu

Hi Oscar,

You can configure additional levels of output information by selecting the Tools->Options menu item. Then under Project and Solutions->Build and Run you can select the MSBuild project verbosity dropdown to "Normal". Then check the output window after your next build and you'll see more information about what the problem is.

Thanks,

Scott

# re: VS 2005 Web Deployment Project for 2 web sites + 2 class

Monday, January 8, 2007 6:12 PM by Mingo-Jones

Hi Scott,

1st, thanks for your unrelentess help to us.

I'm having a problem that hasnt quite been explained in your posts.  I have a solution w/ 2 web sites and 2 class libraries and when I use the  Web Deployment Project I get the error "cs0246 The type or namespace name" (same as Vishal).  I dont want to use the "Publish Web Site" because I want to manage different web.config files. Thanks in advance.

# re: VS 2005 Web Deployment Projects

Wednesday, January 10, 2007 2:36 AM by ScottGu

Hi Mingo,

Can you explain a little more your scenario of wanting to manage different web.config files?  I'm not sure I understand the scenario completely.

Thanks,

Scott

# re: VS 2005 Web Deployment Projects

Thursday, January 11, 2007 9:15 AM by Pramod

Nice one,

Can this be used for MOSS 2007 project, is there a way to create a web application and deploy the web parts, controls and resource ?

Regards,

Pramod.

# re: VS 2005 Web Deployment Projects

Thursday, January 11, 2007 11:01 AM by Mingo-Jones

I've spent some considerable time on trying to create a WDP for a solution that has 2 class library projects and 3 web site projects.  At first I was getting lots of errors with the web.config when building a WDP for 1 of the web site.  Now, I'm able to deploy the site (and I think my original proble with deploying websites that are part of a VS solution with mixed project types is behind me) but I still find the following challenges:

1) How do I enable web.config replacement for elements that I have created e.g. <MyConfiguration>?

2) If replacements are not possible then how do I setup WDP to use different web.config files for different deployments (staging, production)?

I couldn't use configSource attribute, I would get build errors and I think its only useable for standard web.config elements.

Thanks!

Mingo

# re: VS 2005 Web Deployment Projects

Friday, January 12, 2007 2:16 AM by ScottGu

Hi Pramod,

Unfortunately I don't think you can use this for MOSS 2007 projects.  But you can use the SharePoint 2007 extensions of VS 2005 to help.

I linked off to this in a blog post here: http://weblogs.asp.net/scottgu/archive/2006/11/13/Office-2007_2C00_-VS-2005-Tools-for-Office_2C00_-and-VS-2005-Extensions-for-SharePoint.aspx

Hope this helps,

Scott

# re: VS 2005 Web Deployment Projects

Friday, January 12, 2007 2:29 AM by ScottGu

Hi Mingo,

Can you send me an email with more details about the configuration switching scenario you are after?  I'll then loop someone in to the email thread to help.

Thanks,

Scott

# re: VS 2005 Web Deployment Projects

Friday, January 12, 2007 12:46 PM by Mickey

So this provides incremental publishing but a Web Site Project does not?  It always deletes all target folder file on each publish?

# re: VS 2005 Web Deployment Projects

Sunday, January 14, 2007 4:57 PM by ScottGu

Hi Mickey,

Web Deployment projects allow you to build into a local disk directory (it does delete everything in that target directory though).  You can then copy the relevant files remotely to perform an incremental update.

Hope this helps,

Scott

# re: VS 2005 Web Deployment Projects

Tuesday, January 16, 2007 3:45 AM by Guhan

Yeah... Simon's steps helped me find the duplicates... I got rid of the ""aspnet_merge.exe" exited with code 1" error

Thanks

# re: VS 2005 Web Deployment Projects

Tuesday, January 16, 2007 7:16 AM by Martin Hansen

Scott,

A previous posting read:

"I just upgraded to SP1 Release and then installed WDP.  When I right-click and choose "Add Web Deployment Project", I do not get a dialog box prompting me for the location, and the option disappears from the context menu until I re-open the solution."

I too have done just that and am experiencing the same behavior. Have you found a solution?

Martin Hansen

Software Architect

Systematic

# re: VS 2005 Web Deployment Projects

Tuesday, January 16, 2007 9:05 PM by LifeKiller

I've got a encoding problem about WDP.

WDP build the page and output it in UTF-8(65001), but my page encoding is GB2312(936), so the chinese words in aspx file is messed up.

I know it can be solved by saving the aspx file in utf-8 encoding, but my project has over 300 pages, using vs2005 "File - Advanced Save Options" each page is unbelievable.

PS.Can i set the default page file encoding option in vs2005.My OS is Windows 2003 Server Simp Chs, and the visual studio is english version, when i add a new item to a website project, the aspx file encoding is always GB2312 but not UTF-8.

Thanks!

LifeKiller

# re: VS 2005 Web Deployment Projects

Wednesday, January 17, 2007 1:42 PM by Cory

I've updated Simon's instructions and added one more thing in CAPS below. You might miss this.

- Cory

------

For those that have problems with Error 24 "aspnet_merge.exe" exited with code 1.

The error does not say much; however, I did find out that it was a duplicate class. OK, with padi.com being so big, it was hard to find. So the following is a quick way to isolate the problem and fin the duplicate(s).

-Select Tools --> Options.  

-Then in the Projects and Solutions branch, select Build and Run.  

*******

IF YOU DO NOT SEE Projects and Solutions MAKE SURE THE "Show all settings" BOX IS CHECKED TO DISPLAY THE OPTION

*******

-You'll see a dropdown box for MSBuild Project Build Output Verbosity.  Change this to Diagnostic, and OK.

-show your build output by selecting the View --> Output option.  

-Make sure that in the 'Show output from' box, you've selected "Build".  

-Then just build your project, and wait for the inevitable fail.  

You will see where the duplicates are when it fails to build.

Regards,

Simon Morgan

# re: VS 2005 Web Deployment Projects

Friday, January 19, 2007 1:08 AM by Haroon Malik

How can I replace the System.Web section? or any of its sub sections?

# re: VS 2005 Web Deployment Projects

Friday, January 19, 2007 10:31 PM by ScottGu

Hi Life,

Can you send me email about the encoding issues you are seeing?  I can then loop in someone to help you with it.

Thanks,

Scott

# re: VS 2005 Web Deployment Projects

Friday, January 19, 2007 10:32 PM by ScottGu

Hi Martin,

Can you send me an email about the problem you are seeing with not finding the WDP project?  I can then loop someone in to help you.

Thanks,

Scott

# re: VS 2005 Web Deployment Projects

Friday, January 26, 2007 6:41 AM by jkz

Hey there...

Love the config-replacement feature...

However I do have a big problem.

In my destination-folder I have an "uploads" folder, where the users of the website can upload stuff, and when I build the site to this folder it is deleted along with all the data. How can I deploy WITHOUT this folder beeing deleted? The same goes for mdb databases for example, we don't want them to be replaced, do we?

I've tried to do a

 <Target Name="BeforeBuild">

   <Copy SourceFiles="$(WDTargetDir)_upload\*.*" DestinationFolder="C:\temp\_upload\" />

 </Target>

to temporarily copy all the files and then copy them back AfterBuild, but all I get is "Illegal characters in path." (I've tried A LOT of different paths...)

Heeeelp meeee!

/J

# re: VS 2005 Web Deployment Projects

Friday, January 26, 2007 11:28 AM by Kevin

Has there been a solution to the problem with the log4net configuration section handler? I'm having the same issue:

"An error occurred creating the configuration section handler for log4net: Could not load file or assembly 'log4net' or one of its dependencies. The system cannot find the file specified."

Solution builds and runs fine, just not with the Deployment project.

# re: VS 2005 Web Deployment Projects

Monday, January 29, 2007 10:13 AM by Daneil

hi all,

i see i can put my website in a single dll or multiple ones. but can i create dlls for each page, and when that's done, only put a few in my website so they can't be changed or modified. this way i could specify which pages can be altered and which ones can't. is this at all possible i'm not even sure? any info would help.

thanks!

# re: VS 2005 Web Deployment Projects

Tuesday, January 30, 2007 12:01 AM by ScottGu

Hi Daneil,

Yep - in the compile tab above there is the option to compile each page in a separate assembly.  That allows you to update each one separately.

Hope this helps,

Scott

# re: VS 2005 Web Deployment Projects

Tuesday, January 30, 2007 12:38 AM by ScottGu

Hi jkz and Kevin,

Can you send me an email that contains details of your problem?  I can then loop you in with someone on the team to help.

Thanks,

Scott

# re: VS 2005 Web Deployment Projects

Thursday, February 1, 2007 2:47 AM by Vijay

Hi Scott,

I am creating a web deployment project and enterting some values in the TextBoxes(A). Is it possible to store these values in the web.config file during the installation so that they can used in the application?

This is very urgent!

Thanks

# aspnet_merge fails with internal IndexoutOfRangeException

Thursday, February 8, 2007 10:33 AM by Martin Lipovy

Hi Scott,

I use WDP to compile my web site and it ended up with this:

[IndexOutOfRangeException]: Index was outside the bounds of the array.

  at System.Compiler.BinaryWriter.Write(String str, Boolean emitNullTerminator)

  at System.Compiler.Ir2md.WriteCustomAttributeLiteral(BinaryWriter writer, Literal literal, Boolean needsTag)

  at System.Compiler.Ir2md.WriteCustomAttributeSignature(ExpressionList expressions, ParameterList parameters, Boolean onlyWriteNamedArguments, BinaryWriter si

gnature)

  at System.Compiler.Ir2md.GetBlobIndex(ExpressionList expressions, ParameterList parameters)

  at System.Compiler.Ir2md.PopulateCustomAttributeTable()

  at System.Compiler.Ir2md.SetupMetadataWriter(String debugSymbolsLocation)

  at System.Compiler.Ir2md.WritePE(Module module, String debugSymbolsLocation, BinaryWriter writer)

  at System.Compiler.Writer.WritePE(String location, Boolean writeDebugSymbols, Module module, Boolean delaySign, String keyFileName, String keyName)

  at System.Compiler.Module.WriteModule(String location, Boolean writeDebugSymbols)

  at ILMerging.ILMerge.Merge()

  at System.Web.Compilation.Merge.MergeToSingleAssembly(String outputFile, String[] inputAssemblies, Hashtable assemblyMapping, DirectoryInfo inputDirectory, D

irectoryInfo outputDirectory)

  at System.Web.Compilation.Merge.Main(String[] args)

After a couple of houes identifiyng the problem I found out, there must not be System.ComponentModel attribues in my ascx control. I removed [Browsable(false)] and since then merge works fine.

Is there any explanation?

What attribute should I use Instead Browsable(false)?

Thanks. I appreciate your work.

# re: VS 2005 Web Deployment Projects

Tuesday, February 13, 2007 1:21 AM by ScottGu

Hi Carl,

That is a good question - and to be honest I'm not 100% sure what the right behavior is.

Can you send me an email that repeats this question?  I will then loop someone in on the team who will know.

Thanks,

Scott

# re: Missing "Add Web deployment project ..."

Friday, February 16, 2007 3:20 PM by Dav

Hi, Scott,

When I right click my webproject, I don't see "Add Web Deployment Project ..." in the context menu. Where can I create the deployment project? I have VS2005+SP1. Thanks a lot.

# re: VS 2005 Web Deployment Projects

Saturday, February 17, 2007 8:59 PM by ScottGu

Hi Dav,

Can you try re-installing the web deployment project setup after installing SP1?  I believe this will cause it to be added back.

Thanks,

Scott

# re: VS 2005 Web Deployment Projects

Tuesday, February 20, 2007 11:23 AM by Ayazhoda

using XML and xsd trying to use report service with in web part on Default.aspx but not seems working, how can i use report in webpart any idea

# re: VS 2005 Web Deployment Projects

Wednesday, February 21, 2007 5:32 PM by Brian

Scott,

In this article you mention 40+ new tasks with the WDP.  I only see 6 in the Microsoft.WebDeployment.Tasks.dll:

AspNetMerge

CreateVirtualDirectory

GenerateAssemblyInfo

GrantServerAccess

ReplaceConfigSections

ToggleDebugCompilation

Am I missing something here or was this a typo or something?

# re: VS 2005 Web Deployment Projects

Thursday, February 22, 2007 12:15 PM by Bill Yeager

1) I added a web deployment project to my solution by right-clicking on my web project.

2) I then added a separate Setup and Deployment project to my solution and added the assembly from the above step which brought in all the dependencies, etc.

3) I then modified the Installation URL property by right-clicking on the project in step 2 above.

4) I compiled this project which created an MSI file. I then recompiled the whole solution.

5) When running the MSI file, during the second step (Select Installation Address), it does not allow me to change the Site (where to publish the site to) property.

What do I need to do in order to point this MSI file to a specific url in order to deploy it?

# re: VS 2005 Web Deployment Projects

Friday, February 23, 2007 1:22 AM by ScottGu

Hi Bill,

Are you saying that when you run the .MSI setup, it doesn't allow you to change the site location to create?

Thanks,

Scott

# re: VS 2005 Web Deployment Projects

Tuesday, February 27, 2007 2:36 AM by Chakshu Shah

Hi Scott,

I have a similar question like Stuart. I want to deploy multiple websites through a single Web deployment project. Is it possible? Can you let me know some way of doing it?

# re: VS 2005 Web Deployment Projects

Tuesday, February 27, 2007 3:07 AM by ScottGu

Hi Steve,

Any chance you can send me an email with the GAC question?  I can then loop in some folks on my team who will know the answer for sure (I'm not 100% certain on this one).

Thanks,

Scott

# re: VS 2005 Web Deployment Projects

Tuesday, February 27, 2007 3:31 AM by ScottGu

Hi Stuart,

Are all of your web application projects underneath a common root directory?  If so, then you should be able to setup a single web deployment project that points at the root directory, and which will then include everything underneath it.

The reason for this is because web deployment projects actually work against the file-system, and actually ignore the .csproj file.  

Send me mail about the double compile issue and I'd be happy to have someone take a look at it. I haven't heard anyone report that issue before, so I'd like to make sure we have it tracked.

Thanks,

Scott

# re: VS 2005 Web Deployment Projects

Tuesday, February 27, 2007 3:39 AM by Chakshu Shah

Hi Scott,

Further to my question above, I would want to give the user an option to choose between which websites to install. I have 3 different websites which need to be installed from a single deployment package. Basically, when the main msi is run, it should present the user with options to install three different websites I am talking about above. Is it achievable through the VS 2005 Web deployment project?

This is kind of urgent. Any prompt help will be appreciated.

Thanks.

# re: VS 2005 Web Deployment Projects

Tuesday, February 27, 2007 11:58 AM by Stuart Ballard

A-ha! In trying to make a reduced testcase for my rebuild issue so that I could send it to you, I actually identified the problem. It was a misconfiguration of one of the projects in the solution. I had a Class Library project that was a dependency of the various Web Application projects, and I guess out of habit (from configuring all the web applications this way) I'd set the build path for the class library to "..\bin\" just like the web applications were.

Changing this back to to "bin\Debug\" like it usually would be solved the problem. I still don't quite understand why this had the effect it did, but at least it's fixed and wasn't a bug. Sorry for the false alarm.

On the subject of the web deployment project ignoring the csproj file, though: argh! Wasn't the whole point of Web Application projects to get *away* from the notion that everything that happens to be in the filesystem is part of the project and should be deployed? I thought I could live with this for now by writing a pre-build script to parse the project files by hand and exclude anything that wasn't marked "Content", but looking at the options that are available, I don't even see a way to exclude files at all. Is there anything I can do here? Are you looking into deployment projects that will honor the project file (or files) for future versions?

Furthermore, is there any way to persuade the deployment project that it's okay to deploy into a folder that isn't empty?

Also, do you have any info about whether intellisense will work better for cross-project references in this scenario for Orcas? (ie, the fact that "~/" refers to the root of the outer project, not the root of the current project...)

# re: VS 2005 Web Deployment Projects

Tuesday, February 27, 2007 12:05 PM by Stuart Ballard

Forgot to mention on top of the other stuff I said...

Sincere thanks for - as always - timely and helpful answers :)

# re: VS 2005 Web Deployment Projects

Tuesday, February 27, 2007 12:12 PM by Travis

I keep see people asking questions about replacing other sections of the web.config than the typical connectionStrings, appSettings, etc....but i dont see a solution. Can you quickly give an example of how to replace another section, for example the siteMap section of web.config?

I want to replace a section with the new content coming from another config file.

# re: VS 2005 Web Deployment Projects

Thursday, March 1, 2007 8:26 PM by Dallas Martin

Scott,

My deployment team prohibits the use of web.config files in development, testing and

production IIS servers.

All application configurations are stored in the machine.config file on each server.

Of course, Each server points to different

databases,etc.

On my PC,I have all of my configurations in a

web.config file.

How do I compile my application so as to use the machine.config file on each server?

Thanks,

Dallas Martin

# re: VS 2005 Web Deployment Projects

Saturday, March 3, 2007 10:25 PM by ScottGu

Hi Dallas,

You actually don't need to recompile anything differently for the configuration paths (your code won't change depending on the path).

You should be able to develop locally using a web.config file, and then on the remote server just move the settings to the machine.config file - no code changes required.

Hope this helps,

Scott

# re: VS 2005 Web Deployment Projects

Tuesday, March 6, 2007 8:56 PM by Steve

I have been having good luck with web deployment projects, except for one issue:  embedded resources.  In our ASP 1.1 project we simply added resources (such as an a XML license file) to the web project and selected Embedded Resource as the build type.  I can't figure out how to get the same effect using ASP.NET 2.0 and Web Deployment projects.  

# re: VS 2005 Web Deployment Projects

Monday, March 12, 2007 7:46 PM by nuvic

Scott

Thanks for a great stuff

Part of my web application is a content management folder called admin which includes pages linked to a sql database. Admin should be able to use these psges as UI to edit db contents. How can I separate the website folders from the admin folder in deployment? I need the admin to access his area through a reparate link. I'm really lost there.

Thanks for clarfying this,

nuvic

# re: VS 2005 Web Deployment Projects

Thursday, March 15, 2007 7:07 AM by Naveen

Hi Scott,

I've built up a web setup project in VS 2005 and the deployment too works fine...

I've got Frameworks 1.1... and also 2.0... installed in my Machine and am looking for a procedure to set the framework in the deployment project rather than going and changing the ASP.NET version in IIS after the website is installed...

Can you please help me out...

Regards,

Naveen