Asked by:
Resetting properties in web deployment project based on custom build config file

Question
-
User375014865 posted
I'm trying to create a general build environment for multiple projects that can take a some command line parameters and execute a build based on a custom config file.
The problem I am having is after I read in the config parameters with MSBuild.Community.Tasks XMLQuery, which works fine, I can't get aspnet_complier to see these parameters.
I keep getting "error MSB3462: Either MetabasePath or VirtualPath must be specified."
Here is my project file:
<Project InitialTargets="PreMessage" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="PreMessage">
<Message Text="Building..." />
</Target>
<PropertyGroup>
<PreBuildEventDependsOn>
PreBuild;
</PreBuildEventDependsOn>
<PrepareForBuildDependsOn>
PreBuild;
</PrepareForBuildDependsOn>
<BuildDependsOn>
PreBuild;
$(BuildDependsOn)
</BuildDependsOn>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets" />
<Target Name="PreBuild">
<Message Text="$(BuildDependsOn)" />
<!-- <Message Text="$(MSBuildProjectDirectory)" /> -->
<ReadLinesFromFile File="$(MSBuildProjectDirectory)\..\config\MSBuildConfig.xml">
<Output TaskParameter="Lines" ItemName="FileContents" />
</ReadLinesFromFile>
<!-- <Message Text="@(FileContents)" /> -->
<XmlQuery Lines="@(FileContents)" XPath="/MSBuildConfig/ProjectGuid">
<Output TaskParameter="Values" ItemName="xmlProjectGuid" />
</XmlQuery>
<!-- <Message Text="%(xmlProjectGuid.Value)" /> -->
<CreateProperty value="%(xmlProjectGuid.Value)">
<Output TaskParameter="Value" PropertyName="ProjectGuid" />
</CreateProperty>
<XmlQuery Lines="@(FileContents)" XPath="/MSBuildConfig/SourceWebPhysicalPath">
<Output TaskParameter="Values" ItemName="xmlSourceWebPhysicalPath" />
</XmlQuery>
<!-- <Message Text="%(xmlSourceWebPhysicalPath.Value)" /> -->
<CreateProperty value="%(xmlSourceWebPhysicalPath.Value)">
<Output TaskParameter="Value" PropertyName="SourceWebPhysicalPath" />
</CreateProperty>
<XmlQuery Lines="@(FileContents)" XPath="/MSBuildConfig/SourceWebProject">
<Output TaskParameter="Values" ItemName="xmlSourceWebProject" />
</XmlQuery>
<!-- <Message Text="%(xmlSourceWebProject.Value)" /> -->
<CreateProperty value="%(xmlSourceWebProject.Value)">
<Output TaskParameter="Value" PropertyName="SourceWebProject" />
</CreateProperty>
<XmlQuery Lines="@(FileContents)" XPath="/MSBuildConfig/SourceWebVirtualPath">
<Output TaskParameter="Values" ItemName="xmlSourceWebVirtualPath" />
</XmlQuery>
<!-- <Message Text="%(xmlSourceWebVirtualPath.Value)" /> -->
<CreateProperty value="%(xmlSourceWebVirtualPath.Value)">
<Output TaskParameter="Value" PropertyName="SourceWebVirtualPath" />
</CreateProperty>
<XmlQuery Lines="@(FileContents)" XPath="/MSBuildConfig/SingleAssemblyName">
<Output TaskParameter="Values" ItemName="xmlSingleAssemblyName" />
</XmlQuery>
<!-- <Message Text="%(xmlSingleAssemblyName.Value)" /> -->
<CreateProperty value="%(xmlSingleAssemblyName.Value)">
<Output TaskParameter="Value" PropertyName="SingleAssemblyName" />
</CreateProperty>
<Message Text="ProjectGuid=$(ProjectGuid)" />
<Message Text="SourceWebPhysicalPath=$(SourceWebPhysicalPath)" />
<Message Text="SourceWebProject=$(SourceWebProject)" />
<Message Text="SourceWebVirtualPath=$(SourceWebVirtualPath)" />
<Message Text="SingleAssemblyName=$(SingleAssemblyName)" />
</Target>
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.60403</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>$(ProjectGuid)</ProjectGuid>
<SourceWebPhysicalPath>$(SourceWebPhysicalPath)</SourceWebPhysicalPath>
<SourceWebProject>$(SourceWebProject)</SourceWebProject>
<SourceWebVirtualPath>$(SourceWebVirtualPath)</SourceWebVirtualPath>
<OutputPath>..\Site\Debug</OutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<ProjectGuid>$(ProjectGuid)</ProjectGuid>
<SourceWebPhysicalPath>$(SourceWebPhysicalPath)</SourceWebPhysicalPath>
<SourceWebProject>$(SourceWebProject)</SourceWebProject>
<SourceWebVirtualPath>$(SourceWebVirtualPath)</SourceWebVirtualPath>
<OutputPath>..\Site\Debug</OutputPath>
<EnableUpdateable>true</EnableUpdateable>
<UseMerge>true</UseMerge>
<SingleAssemblyName>$(SingleAssemblyName)</SingleAssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>false</DebugSymbols>
<ProjectGuid>$(ProjectGuid)</ProjectGuid>
<SourceWebPhysicalPath>$(SourceWebPhysicalPath)</SourceWebPhysicalPath>
<SourceWebProject>$(SourceWebProject)</SourceWebProject>
<SourceWebVirtualPath>$(SourceWebVirtualPath)</SourceWebVirtualPath>
<OutputPath>..\Site\Release</OutputPath>
<EnableUpdateable>true</EnableUpdateable>
<UseMerge>true</UseMerge>
<SingleAssemblyName>$(SingleAssemblyName)</SingleAssemblyName>
</PropertyGroup>
<ItemGroup>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WebDeployment\v8.0\Microsoft.WebDeployment.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.WebDeployment.targets. -->
<Target Name="BeforeBuild" DependsOnTargets="$(PreBuildEventDependsOn)">
<Message Text="Hello" Importance="high" />
<Message Text="$(BuildDependsOn)" Importance="high" />
<Message Text="ProjectGuid=$(ProjectGuid)" />
<Message Text="SourceWebPhysicalPath=$(SourceWebPhysicalPath)" />
<Message Text="SourceWebProject=$(SourceWebProject)" />
<Message Text="SourceWebVirtualPath=$(SourceWebVirtualPath)" />
<Message Text="SingleAssemblyName=$(SingleAssemblyName)" />
</Target>
<!--
<Target Name="BeforeMerge">
</Target>
-->
<!--
<Target Name="AfterMerge">
</Target>
-->
<!--
<Target Name="AfterBuild">
</Target>
-->
</Project>Here's the output from that:
Target PreMessage:
Building...
Target PreBuild:_PrepareForBuild;
_SplitProjectReferencesByType;
_ResolveReferences;
_ResolveProjectReferences;
ResolveAssemblyReferences;
_CopyBeforeBuild;
BeforeBuild;
AspNetCompiler;
BeforeMerge;
AspNetMerge;
AfterMerge;
ReplaceWebConfigSections;
CreateVirtualDirectory;
AfterBuildProjectGuid={F60CD28D-1B49-4B17-ADC9-1D197B82EE98}
SourceWebPhysicalPath=..\DummySite
SourceWebProject={34CF06F1-A620-46C3-B921-44BF255868EF}|DummySite\DummySite.csproj
SourceWebVirtualPath=/DummySite.csproj
SingleAssemblyName=SiteDeployment
Target BeforeBuild:
Hello_PrepareForBuild;
_SplitProjectReferencesByType;
_ResolveReferences;
_ResolveProjectReferences;
ResolveAssemblyReferences;
_CopyBeforeBuild;
BeforeBuild;
AspNetCompiler;
BeforeMerge;
AspNetMerge;
AfterMerge;
ReplaceWebConfigSections;
CreateVirtualDirectory;
AfterBuildProjectGuid={F60CD28D-1B49-4B17-ADC9-1D197B82EE98}
SourceWebPhysicalPath=..\DummySite
SourceWebProject={34CF06F1-A620-46C3-B921-44BF255868EF}|DummySite\DummySite.csproj
SourceWebVirtualPath=/DummySite.csproj
SingleAssemblyName=SiteDeployment
Target AspNetCompiler:
C:\Program Files\MSBuild\Microsoft\WebDeployment\v8.0\Microsoft.WebDeployment.targets(526,9): error MSB3462: Either MetabasePath or VirtualPath must be specified.
Done building target "AspNetCompiler" in project "SiteDeployment.wdproj" -- FAILED.Done building project "SiteDeployment.wdproj" -- FAILED.
Build FAILED.
C:\Program Files\MSBuild\Microsoft\WebDeployment\v8.0\Microsoft.WebDeployment.targets(526,9): error MSB3462: Either MetabasePath or VirtualPath must be specified.
0 Warning(s)
1 Error(s)Any help would be greatly appreciated!
-John Baughman
Wednesday, April 11, 2007 3:42 PM
All replies
-
User-1348502342 posted
Were you able to resolve this issue? I cannot figure out why aspnet_compiler is throwing that message
Thursday, December 9, 2010 4:02 PM