2016-05-23 39 views
3

幾個月前我開始研究一個新的ASP.NET Core RC1項目,並使用Visual Studio 2015發佈了一個文件夾樹,不使用項目C#源代碼進行部署(因爲它正在編譯放置在文件夾樹中的程序集中)。Visual Studio 2015(最新更新)發佈函數不能編譯ASP.NET Core RC1源碼

現在,我已經升級的Visual Studio(只有VS不是項目保留在1.0.0- RC1決賽)爲最新版本(大約五月,19 2016): 「Microsoft .NET Core 1.0.0 RC2 - VS 2015 Tooling Preview 1」,「Microsoft .NET Core 1.0.0 RC2-SDK Preview 1(x64)」,「Microsoft ASP.NET 5 RC1 Update 1」(1.0.11123.0)和「Microsoft ASP.NET 5 RC1 Update 1」(1.0.20204.0)

它看起來最新的VS2015更新的新發布功能不再編譯源代碼,而是它放置到發佈文件夾樹項目c#來源。

有人可以指示我如何強制VS發佈功能再次編譯,而不是將c#源複製到發佈文件夾?

+1

面對同樣的問題。任何幫助將不勝感激! –

+0

你是否以管理員身份運行VS? – Harvey

+0

是的,但沒有任何變化 – MarcMart

回答

3

我們從rc2工具中的發佈對話框中刪除了這個選項(「將源文件編譯成NuGet包」),因爲它不再適用於dotnet項目。

爲了使用VS的-no-source選項發佈rc1項目,您可以將此目標添加到pubxml(目標需要在項目內部和屬性組外部)。

<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 
    <PropertyGroup> 
<all your existing property group values> 
    </PropertyGroup> 

    <Target Name="DnuNoSourcePublish" AfterTargets="GatherAllFilesToPublish" Condition=" '$(CompileSource)' == 'true' "> 
     <Exec 
      Condition="Exists('$(PublishOutputPath)') and '$(PublishOutputPath)'!='' " 
      Command="rmdir /S /Q &quot;$(PublishOutputPath)&quot;" 
      WorkingDirectory="$(MSBuildProjectDirectory)" /> 

     <PropertyGroup> 
      <DnuCommand>&quot;$(SDKToolingDirectory)\bin\dnu.cmd&quot; publish</DnuCommand> 
      <RuntimeArgument Condition=" '$(FinalPublishVersion)' != '' " >--runtime $(FinalPublishVersion)</RuntimeArgument> 
      <WwwRootArgument Condition=" '$(WebRoot)' != '' " >--wwwroot $(WebRoot)</WwwRootArgument> 
      <WwwRootOutArgument Condition=" '$(WwwRootOut)' != '' " >--wwwroot-out $(WwwRootOut)</WwwRootOutArgument> 
      <IISCommandArgument Condition =" '$(IISCommand)' != ''">--iis-command $(IISCommand)</IISCommandArgument> 
      <NoSourceArgument Condition=" '$(CompileSource)' == 'true' ">--no-source</NoSourceArgument> 
      <NativeArgument Condition="'$(NativeFlag)' == 'true'">--native</NativeArgument> 
      <IncludeSymbolsArgument Condition=" '$(IncludeSymbolsFlag)' == 'true'">--include-symbols</IncludeSymbolsArgument> 
      <QuietArgument Condition=" '$(QuietFlag)' == 'true'">--quiet</QuietArgument> 
     </PropertyGroup> 

     <Exec 
      Command="SET PATH=$(ExternalToolsPath);@(DnuPublishEnvironmentVariables) 
      $(DnuCommand) &quot;$(KPackWorkingDirectory)&quot; --out &quot;$(PublishOutputPathNoTrailingSlash)&quot; --configuration $(PublishConfiguration) $(RuntimeArgument) $(WwwRootArgument) $(WwwRootOutArgument) $(IISCommandArgument) $(NoSourceArgument) $(QuietArgument) $(NativeArgument) $(IncludeSymbolsArgument)" 
      WorkingDirectory="$(KPackWorkingDirectory)"/> 
     </Target> 
</Project> 

確保您的屬性組有此屬性設置

<CompileSource>true</CompileSource> 
+0

如指示修改的.pubxml未被識別爲可運行的發佈配置文件 – MarcMart

+1

修改發佈配置文件(在項目部分內添加上述目標),您應該能夠從發佈對話框中調用發佈,並且在將內容發佈到服務器之前將執行此目標。 – vijayrkn

+0

它工作!,我的錯誤是取代.pubxml中的,一切都必須添加...標記的內容必須是:(我的原始版本, true)和(與發佈完全一樣) – MarcMart

0

展望VS是如何先於RC2更新發布時,我注意到兩個:

C:\Users\(user)\.dnx\runtimes\dnx-clr-win-x86.1.0.0-rc1-update1\bin\dnu.cmd publish "(destinationFolder)" --out "C:\Users\(user)\AppData\Local\Temp\PublishTemp\(tempFolder)" --configuration Debug --no-source --runtime dnx-clr-win-x86.1.0.0-rc1-update1 --wwwroot "wwwroot" --wwwroot-out "wwwroot" --iis-command "web" --quiet

"C:\Program Files (x86)\IIS\Microsoft Web Deploy V3\msdeploy.exe" -source:contentPath='C:\Users\(user)\AppData\Local\Temp\PublishTemp\(tempFolder)\' -dest:contentPath='(destinationFolder)' -verb:sync -retryAttempts:2 -disablerule:BackupRule

so,個刪除兩個文件夾(destinationFolder)C:\Users\(user)\AppData\Local\Temp\PublishTemp\(tempFolder),並且運行兩個命令上述「舉手」,在命令提示符下,我得到了想要的結果

相關問題