我创建了一个新的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]
哪个项目错误(应该是网络项目)。我似乎无法找到任何包含此设置或解决方案文件本身设置的文件。
我需要做些什么来发布正确的项目?
答案 0 :(得分:1)
我能够分两步完成这个。
首先从msbuild命令中删除deployOnBuild = True和publishUrl = [snip]。这意味着此步骤将构建项目但不进行任何发布。
接下来添加一个执行发布的新步骤。
为此,我首先创建了一个新变量来保存dotnet.exe的位置:
call :ExecuteCmd "%DOTNET_PATH%" publish "%DEPLOYMENT_SOURCE%\MySolution.Web" --framework netcoreapp1.0 --output "%DEPLOYMENT_TEMP%" --configuration Release --no-build
IF !ERRORLEVEL! NEQ 0 goto error
然后添加以下内容以发布Web项目:
USER with attributes id, username, phone, location, realname, password.
QUESTION with attributes id, desription, time, status.
IMAGE with attributes id, address
Image_question 1:n ( One question can have multiples images)
User_questions 1:n
然后将所有文件发布到部署临时文件夹,然后使用KuduSync步骤进行部署。