2017-05-05 72 views
1

我想为旧的项目设置Continuations Integration为网站发布文物转到预编译的网页

该项目仍然使用网站而不是Web应用程序。在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到假。但是这也没有奏效。

MSBuild命令

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

什么是您正在使用的Visual Studio的版本?您是否尝试使用Visual Studio 2013及更高版本? –

回答

2

当我在Visual Studio中发布,但只要我运行的MSBuild命令,然后它会创建一个PrecompiledWeb文件夹,并把代码中有它的伟大工程。

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

创建在VS发布配置文件以下内容的创建之后:下的App_Data/PublishProfiles

1)发布配置文件(文件.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文件。

+0

我正在使用VS2015 – R4nc1d

+0

@ R4nc1d,谢谢你的回复。根据你的回复,我已经更新了我的答案,并且在我的机器上正常工作,你可以检查它是否对你有帮助。 –

+0

好,让我试试,ps。投票支持 – R4nc1d