tags:

views:

516

answers:

2

I'm using the command-line to call msbuild to generate a published version of a website using this command:

msbuild.exe /t:ResolveReferences;Compile;_CopyWebApplication /p:OutDir=dir/bin/ 
    /p:WebProjectOutputDir=dir/ /p:Debug=false /p:Configuration=Release 
    Website.csproj

This works fine other than the embedded resources not being present in the Website.dll. If I do the publish via Visual Studio it includes the embedded resources. Is there a flag I'm missing?

+2  A: 

An extra target is required like so:

msbuild.exe /t:PrepareResources;ResolveReferences;Compile;_CopyWebApplication 
    /p:OutDir=dir/bin/ /p:WebProjectOutputDir=dir/ /p:Debug=false 
    /p:Configuration=Release Website.csproj
Garry Shutler
How did you solve the problem. Did you capture the VS build output? How?
Ed Blackburn
I made VS output the build process "Detailed": Tools > Options > Projects and Solutions > Build and Run > MSBuild project build output verbosity. Then I looked at every target that related to resources and added it in. I've found that more than the one argument seems to be required now by the way. I've updated the above answer.
Garry Shutler
are they all called from a single target under the .csproj? there might be an abstracted target you can call instead of all those individual ones
Andrew Bullock
try microsoft.common.targets and microsoft.chsarp.targets
Andrew Bullock
+1  A: 

It appears

/t:PrepareResources

calls all the targets youve added to your msbuild call, try that

heres the top few levels of what gets called

PrepareResources 
    PrepareResourceNames
        AssignTargetPaths
        SplitResourcesByCulture
        CreateManifestResourceNames
        CreateCustomManifestResourceNames
    ResGen
        ResolveAssemblyReferences
        SplitResourcesByCulture
        BeforeResGen
        CoreResGen
        AfterResGen
    CompileLicxFiles
Andrew Bullock