【发布时间】:2016-10-06 22:48:17
【问题描述】:
我创建了一个新的 ASP.Net 核心项目并将其设置在源代码控制中,当我签入时它会发布到 Azure。我能够正确设置所有内容并且工作正常。
但是,我随后向解决方案添加了一个类库项目,现在 MSBuild 任务不是发布我的网站项目,而是尝试发布我的类库,这当然会失败。
部署命令中的行是:
"%MSBUILD_PATH%" "%DEPLOYMENT_SOURCE%\MySolution.sln" /nologo /verbosity:m /p:deployOnBuild=True;AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release;UseSharedCompilation=false;publishUrl="%DEPLOYMENT_TEMP%"
当它运行时,它首先构建模型项目,这很好:
D:\Program Files (x86)\dotnet\dotnet.exe build "D:\home\site\repository\MySolution.Models" --configuration Release --no-dependencies
但随后它也会尝试发布该项目:
D:\Program Files (x86)\dotnet\dotnet.exe publish "D:\home\site\repository\MySolution.Models" --output "D:\local\Temp\PublishTemp\MySolution.Models71" --configuration Release --no-build
D:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Publishing.targets(149,5): error : Can not find runtime target for framework '.NETStandard,Version=v1.6' compatible with one of the target runtimes: 'win8-x86, win7-x86'. Possible causes: [D:\home\site\repository\MySolution.Models\MySolution.Models.xproj]
哪个是错误的项目(应该是 web 项目)。我似乎找不到任何包含此设置或解决方案文件本身中的设置的文件。
我需要做什么才能发布正确的项目?
【问题讨论】:
-
尝试使用指定的project.json发布:dotnet publish ~/projects/app1/project.json
-
那么把MSBuild任务改成不在build时部署然后手动部署?这可能行得通,但似乎必须有一种方法来指定要部署的项目。
标签: azure msbuild asp.net-core