gpt4 book ai didi

visual-studio - 网站的发布工件转到 PrecompiledWeb

转载 作者:行者123 更新时间:2023-12-04 12:47:09 25 4
gpt4 key购买 nike

我正在尝试为一个旧项目设置 Continuations Integration

该项目仍然使用网站而不是网络应用程序。在 Visual studio 中,我创建了发布配置文件。我只想将其发布到解决方案中的本地文件夹。

当我从 Visual studio 中发布时效果很好,但只要我运行 MSbuild 命令,它就会创建一个 PrecompiledWeb 文件夹并放置里面的代码。

这会导致我的构建工件在我尝试设置我的 CI

时立即失败

这是我的发布配置文件设置

<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<publishUrl>.\Publish</publishUrl>
<DeleteExistingFiles>True</DeleteExistingFiles>
<PrecompileBeforePublish>False</PrecompileBeforePublish>
</PropertyGroup>
</Project>

我什至尝试将 PrecompileBeforePublish 设置为 false。但这也没有用。

我的 MSBuild 命令

c:\development\projectname>msbuild project.sln /p:deployOnBuild=true /p:publishProfile=projectFileSystem

最佳答案

It works great when i publish from within Visual studio but as soon as I run MSbuild command then it creates a PrecompiledWeb folder and places the code in there.

网站项目的发布过程没有进入构建过程。对于网站项目,因为没有正式的构建过程,所以我们没有什么可以真正扩展的。

在 VS 中创建发布配置文件后,将创建以下内容:

1) App_Data/PublishProfiles 下的发布配置文件(.pubxml 文件)

2) 网站根目录中的website.publishproj

website.publishproj 的目的是促进命令行发布。然后你可以尝试使用如下命令:

C:\Program Files (x86)\Microsoft Visual Studio 14.0>msbuild "C:\Users\UserName\Documents\Visual Studio 2015\WebSites\WebSite1\website.publishproj" /p:deployOnBuild=true /p:publishProfile=WebsiteTestDemo /p:VisualStudioVersion=14.0

enter image description here

之后,您会注意到它不会创建 PrecompiledWeb 文件夹,并且发布使用配置文件中的设置:

enter image description here

注意:发布文件应该是website.publishproj 而不是WebSite1(1).sln 文件。

关于visual-studio - 网站的发布工件转到 PrecompiledWeb,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43805055/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com