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 06, 2005 9:01 PM by ScottGu

Comments

# re: VS 2005 Web Deployment Projects

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

# re: VS 2005 Web Deployment Projects

Monday, November 07, 2005 1:40 AM by Renee
This really is nice.

I still have not been able to identify an interface for web-side client consumption of a web service in VS-2005 and Atlas. If there is one, we need documentation.

# re: VS 2005 Web Deployment Projects

Monday, November 07, 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 07, 2005 5:32 AM by Igor
Where can we doanload this nice add-on?

# re: VS 2005 Web Deployment Projects

Monday, November 07, 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 07, 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 07, 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 07, 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 07, 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 07, 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 07, 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 07, 2005 12:18 PM by Andreas Kraus
Ah.. nice, that probably makes my asp.net deployment tool obsolete ( http://www.sunlab.de/Tools.aspx ).

Looking forward to test it out and use it :)

# re: VS 2005 Web Deployment Projects

Monday, November 07, 2005 12:48 PM by scottgu
Hi AsbjornM,

The ASP.NET database created under your app_data directory is added when you have the default SQL Express providers configured, and you use one of the new ASP.NET features that use them (for example: Membership/Login, Roles, Personalization, WebParts, etc).

If the database file is showing up as locked, it means that SQL Express or VS has it loaded. To unlock it, simply select the file in the solution explorer, right click, and choose "Detach". That should shut it down.

Alternatively, you can also consider using SQL server 2000 or 2005 directly instead of using SQL Express for your providers (then no database file will be created for you). Here is a blog entry I wrote on how to configure these: http://weblogs.asp.net/scottgu/archive/2005/08/25/423703.aspx

Hope this helps,

Scott

# re: VS 2005 Web Deployment Projects

Monday, November 07, 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 07, 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 07, 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 07, 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 08, 2005 4:14 AM by P
Great stuff!!!!

# re: VS 2005 Web Deployment Projects

Tuesday, November 08, 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 08, 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 08, 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 08, 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 08, 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 08, 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 08, 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 09, 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

Wednesday, November 09, 2005 10:57 AM by Andrew Renner
Hi Scott,

I posted this question on Pete's Blog pertaining to the dll creation when publishing a site...

http://blogs.msdn.com/petel/archive/2005/11/08/490684.aspx#comments


Can you point me to the answer...

Thanks

Andrew

# re: VS 2005 Web Deployment Projects

Wednesday, November 09, 2005 8:22 PM by BradleyB
It's now ready for download at http://msdn.microsoft.com/asp.net/reference/infrastructure/wdp/default.aspx

# 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

Thursday, November 10, 2005 11:53 PM by scottgu
Hi Martijn,

We should be able to support that scenario with VS 2005. Any chance you could re-post the question here: http://forums.asp.net/138/ShowForum.aspx

The VS 2005 web team monitors that forum very closely, and they should be able to help you walkthrough the scenario (might be easier than doing it on this blog).

Thx!

- 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

Friday, November 11, 2005 3:58 PM by scottgu
Hi Alan,

You can add your own namespace to pages and user-controls today. The default template doesn't add a namespace -- but you can manually add one. Here is an example walkthrough of how to add your own template that contains a namespace if you want to automate adding one: http://weblogs.asp.net/scottgu/archive/2005/09/09/424780.aspx

Hope this helps,

Scott

# 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

Thursday, November 17, 2005 9:13 PM by Mike
This tool looks great! A few minor suggestions...

- it appears .wdproj gets deployed as well, something i wouldn't expect.

- the web.config replacement feature is great!!! but... i would expect for only the merged web.config to deploy. my replacement files are also deploying.

not a big concern, for now i'll just use <ExcludeFromBuild> but i doubt these files would ever need to be deployed.

keep up the great work!!

thanks,
Mike

# 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

Sunday, November 27, 2005 4:13 PM by scottgu
Hi Humpy,

I just saw a similar thread regarding cyrillic characters here: http://forums.asp.net/1124785/ShowPost.aspx

Any chance you could follow up on it and provide more details with your scenario? We have folks actively monitoring that forum and so they will be able to investigate and help more.

Thanks,

Scott

# re: VS 2005 Web Deployment Projects

Sunday, November 27, 2005 4:15 PM by scottgu
Hi Vladimir/Derek,

Any chance you could ask those two question on this forum: http://forums.asp.net/138/ShowForum.aspx

We have team members who worked on the VS Web Deploy project monitoring it, and they should be able to help with those scenarios.

Thanks,

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 01, 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 01, 2005 11:53 PM by Martin
Scott, thanks for the quick response and help!

Martin

# re: VS 2005 Web Deployment Projects

Friday, December 02, 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 06, 2005 2:02 PM by Greg K
Thanks for the addin!! You have saved me alot of headaches!!

# Great Free MSBuild Tasks Available for Download