Publishing for Web Applications from MSBuild

A search on this topic yields many answers for all the different possible combinations of Visual Studio web projects. Here is another.

Using .Net 3.5 MSBuild.exe take note of the following targets and the custom parameter, WebProjectOutputDir, passed when attempting to publish a web application project.

  • /t:ResolveReferences;_WPPCopyWebApplication
  • /p:WebProjectOutputDir=”c:\\Source\\Build\\My Web App\\” – this is the path to the output directory, all ‘\’ must be replaced with ‘\\’

A complete call will look something like this:

msbuild.exe MyWebApplication.csproj /p:Configuration=Release /t:ResolveReferences;_WPPCopyWebApplication /p:WebProjectOutputDir=”c:\Source\Build\My Web App”

The custom tool ‘MSLinqToSQLGenerator’ failed. Unspecified error

There is an issue in SP1 for Visual Studio 2008. If you have a partial class with Using statement at the top of the file for a Linq-To-SQL Data Classes context object. You will get above error. Visual Studio will delete the corresponding “.designer.cs” file for your data context and nothing will be compiled.

To solve this issue, you may have to move “Using” statements inside namespace declaration. This is a workaround provided by Microsoft.

MSExam 70-448 Part 5: KPI Trend Expression correction

Seems like the following trend expression isn’t quite correct in Chapter 6 > Lesson 2 > Exercise 2.

([Measures].[Reseller Sales Amount] - 
([Order Date].[Calendar].PrevMember, [Measures].[Reseller Sales Amount]))/
[Measures].[Reseller Sales Amount]

[Order Date] should be [Date] as previously there were instructions to rename [Order Date] as [Date]. This one is correct:

([Measures].[Reseller Sales Amount] - 
([Date].[Calendar].PrevMember, [Measures].[Reseller Sales Amount]))/
[Measures].[Reseller Sales Amount]

MSExam 70-448 Part 3: Chapter 4 dtExecUI

Seeing this error? “Could not find stored procedure ‘msdb.dbo.sp_dts_listpackages'”

Screen shot of dtExecUI 2005 error

Solution: Run the correct version of the dtExecUI tool, in SQL2008 this stored procedure was renamed from the above to sp_ssis_listpackages.

The correct path to the 2008 version of dtExecUI is C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE.

MSExam 70-448 Part 2: Chapter 1 query wrong

Page 52 of the self paced training kit asks you to use the following query:

select convert(nvarchar(15),SC.AccountNumber) as CustomerAlternateKey, 
C.Title, C.FirstName, C.MiddleName, C.LastName, C.Suffix, 
C.EmailAddress, C.AddressLine1, C.AddressLine2, D.BirthDate, 
D.MaritalStatus, D.YearlyIncome, D.DateFirstPurchase, D.Gender, 
D.TotalChildren, D.NumberChildrenAtHome, D.Education, 
D.Occupation, D.HomeOwnerFlag, D.NumberCarsOwned 
from Sales.vIndividualCustomer C inner join Sales.Customer SC 
on C.BusinessEntityID = SC.PersonID 
inner join Sales.vIndividualDemographics D 
on C.BusinessEntityID = D.BusinessEntityID

It didn’t work for me , however this did (BusinessEntityID column replaced with CustomerID in the joins):

select convert(nvarchar(15),SC.AccountNumber) as CustomerAlternateKey, 
C.Title, C.FirstName, C.MiddleName, C.LastName, C.Suffix, 
C.EmailAddress, C.AddressLine1, C.AddressLine2, D.BirthDate, 
D.MaritalStatus, D.YearlyIncome, D.DateFirstPurchase, D.Gender, 
D.TotalChildren, D.NumberChildrenAtHome, D.Education, 
D.Occupation, D.HomeOwnerFlag, D.NumberCarsOwned 
from Sales.vIndividualCustomer C inner join Sales.Customer SC 
on C.CustomerID = SC.CustomerID 
inner join Sales.vIndividualDemographics D 
on C.CustomerID = D.CustomerID

MSExam 70-448 Part 1: Getting started

There are many resources floating around with details of what you need, I wanted to collate, summarise and present them in a short format here. Here’s your checklist:

I used the MCTS Self-Paced Training Kit (Exam 70-448): Microsoft® SQL Server® 2008 – Business Intelligence Development and Maintenance. Buy it, it helps. Good, you’ve got it now:

  • Install the practice files
  • Install the practice tests
  • Use the eBook & glossary supplied on the disk

Now you’re ready to go.

Content page controls cleared after updating Master page controls

It seems like accessing a Master page’s controls before they have loaded will clear out the ContentPlaceHolders thereby not show content specified in a content page.

This is my scenario. I put a public property (bodycssclass) on my content page which I set in the following way:

<%@ Page MasterPageFile="MyMaster.master" bodycssclass="home" ... %>
    public class PageBase : System.Web.UI.Page
    {
        public string BodyCssClass
        {
            get;
            set
            {
                MasterPageBase mpbCurrent = this.Master as MasterPageBase;
                mpbCurrent.BodyCssClass = BodyCssClass;
            }
        }
    }

This public property then sets a public property on the master page.  The public property on the master page modifies some of it controls, it seems like this causes a problem. The content page simply shows blank areas where content has been defined in asp:Content tags. I think it may something to do with accessing Master page controls before the Master page OnLoad event has fired. For reference here is the order of page events:

Page.OnPreInit()
UserControl.OnInit()
MasterPage.OnInit()
Page.OnInit()
Page.OnInitComplete()
Page.OnLoad()
MasterPage.OnLoad() (I must have been setting my property before this step)
UserControl.OnLoad()
Page.OnLoadComplete()
Page.OnPreRender()
MasterPage.OnPreRender()
UserControl.OnPreRender()
Page.OnPreRenderComplete()
Page.OnSaveStateComplete()
UserControl.OnUnload()
MasterPage.OnUnload()
Page.OnUnload()

Solution

The Content page inherits from a common base page which saves the value defined and processes it later like so:

    public class PageBase : System.Web.UI.Page
    {
        public string BodyCssClass
        {
            get;
            set;
        }

        protected override void OnLoadComplete(EventArgs e)
        {
            MasterPageBase mpbCurrent = this.Master as MasterPageBase;
            mpbCurrent.BodyCssClass = BodyCssClass;

            base.OnLoadComplete(e);
        }
    }

Error when loading DMBL: could not retrieve the current project

Tried to open up my dmbl (containing my linq-to-sql objects) file and Visual Studio threw up a dialog saying that “a validation error occured please resolve and then try to re-open the file, see the error list for more details.”

The error list contained the following helpful message: could not retrieve the current project

Solution: Launch Visual Studio with the following command devenv /ResetSkipPkgs