我正在尝试在 ASP.NET 文件系统发布中包含一个未包含在解决方案中的文件(它是从构建后脚本自动生成的)。根据这些说明,我应该能够使用元素在我的.pubxml
定义中添加对文件的引用。<_CustomFiles>
这是我的.pubxml
文件的样子:
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<LastUsedBuildConfiguration>Debug</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<publishUrl>(publish URL here)</publishUrl>
<DeleteExistingFiles>False</DeleteExistingFiles>
</PropertyGroup>
<PropertyGroup>
<CopyAllFilesToSingleFolderForPackageDependsOn>
CustomCollectFiles;
$(CopyAllFilesToSingleFolderForPackageDependsOn);
</CopyAllFilesToSingleFolderForPackageDependsOn>
<CopyAllFilesToSingleFolderForMsdeployDependsOn>
CustomCollectFiles;
$(CopyAllFilesToSingleFolderForPackageDependsOn);
</CopyAllFilesToSingleFolderForMsdeployDependsOn>
</PropertyGroup>
<Target Name="CustomCollectFiles">
<ItemGroup>
<_CustomFiles Include="scripts\app.min.js" />
<FilesForPackagingFromProject Include="%(_CustomFiles.Identity)">
<DestinationRelativePath>Extra Files\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
</FilesForPackagingFromProject>
</ItemGroup>
</Target>
</Project>
第二个<PropertyGroup>
和<Target>
元素是我添加的。
但是,Visual Studio 无法识别该<_CustomFiles>
元素,并且该文件未包含在发布中。注意元素下方的绿色波浪线:
当我将鼠标悬停在它上面时,会显示以下错误消息:
The element 'ItemGroup' in namespace 'http://schemas.microsoft.com/developer/msbuild/2003' has invalid child element '_CustomFiles' in namespace 'http://schemas.microsoft.com/developer/msbuild/2003'
为什么 Visual Studio 无法识别此元素?为了将此文件包含在我的文件系统发布中,我需要更改什么?