Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MSBuild publish website with embedded resources

Tags:

msbuild

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?

like image 901
Garry Shutler Avatar asked Feb 28 '23 06:02

Garry Shutler


2 Answers

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
like image 60
Andrew Bullock Avatar answered Mar 10 '23 10:03

Andrew Bullock


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
like image 38
Garry Shutler Avatar answered Mar 10 '23 10:03

Garry Shutler