我们有一个用of 2015.1创建的解决方案,它有3个项目,所有这些项目都是DNX RC1。
| sln
|+---MVC6 Api
| project.json
| +---ClassLibrary
| Class.cs
| project.json
| \---Webjob
Program.cs
project.jsonAPI和Webjob都在它们的ClassLibrary文件中引用了project.json。
"frameworks": {
"dnx451": {
"dependencies": {
"ClassLibrary": "1.0.0-*"
}
}
}我们创建了两个WebApps,它们都绑定到解决方案回购的连续集成中,每个都带有指向API文件夹(在一个中)和指向Webjob文件夹(在另一个中)的设置。
API项目在没有问题的情况下部署,当它试图解决本地项目依赖时,它可以工作:
Using Project dependency ClassLibrary 1.0.0 for DNX,Version=v4.5.1
Copying source code from Project dependency ClassLibrary
Source D:\home\site\repository\ClassLibrary\project.json
Target D:\local\Temp\8d32044390806ef\approot\src\ClassLibrary另一方面,and作业失败了,它试图将其解析为nuget远程包,但失败了:
[01/21/2016 19:47:45 > b597c3: INFO] GET https://api.nuget.org/v3-flatcontainer/ClassLibrary/index.json
[01/21/2016 19:47:46 > b597c3: INFO] NotFound https://api.nuget.org/v3-flatcontainer/ClassLibrary/index.json 507ms
[01/21/2016 19:47:46 > b597c3: ERR ] Unable to locate Dependency ClassLibrary >= 1.0.0-*最后一部分我必须通过Kudu检查它,因为它显然是在WebJob的第一次运行时完成的,而不是在部署阶段(比如API)。
在本地运行WebJob是没有问题的。
我在publish dnx based WebJob with local dependencies中尝试了这个解决方案,但没有奏效。
发布于 2016-02-15 17:32:12
在与Product交谈之后,默认情况下,3项目场景现在无法工作。
在publish dnx based WebJob with local dependencies上描述的解决方案适用于2个项目场景,但是如果您需要部署依赖于同一个类库项目的WebJob和Webjob,并且这3个应用程序都在相同的回购程序上,则无法通过持续集成进行Web作业部署。
解决方案是为Web设置持续集成(默认情况下它将工作),并将WebJob手动部署为压缩文件。
进入您的WebJob文件夹并运行dnu publish。
进入bin/output/approot/src/YourWebJobFolder。
编辑自动生成的CMD文件。
通过自定义第4行来使用此脚本:
@ECHO OFF
:: 1. Prepare environment
SET DNX_CONSOLE_APP_PATH=Autocosmos.Trunk.Webjob
SET DNVM_CMD_PATH_FILE="%USERPROFILE%\.dnx\temp-set-envvars.cmd"
:: 2. Install DNX
CALL PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';$CmdPathFile='%DNVM_CMD_PATH_FILE%';& '%SCM_DNVM_PS_PATH%' " install latest
IF ERRORLEVEL 1 GOTO ERROR
:: 3. Put DNX on the path
IF EXIST %DNVM_CMD_PATH_FILE% (
CALL %DNVM_CMD_PATH_FILE%
DEL %DNVM_CMD_PATH_FILE%
)
call :ExecuteCmd dnx --project "%~dp0src\%DNX_CONSOLE_APP_PATH%" --configuration Release %DNX_CONSOLE_APP_PATH% run
goto end
:ExecuteCmd
setlocal
set _CMD_=%*
call %_CMD_%
if "%ERRORLEVEL%" NEQ "0" echo Failed exitCode=%ERRORLEVEL%, command=%_CMD_%
exit /b %ERRORLEVEL%
:error
endlocal
echo An error has occurred during web site deployment.
call :exitSetErrorLevel
call :exitFromFunction 2>nul
:exitSetErrorLevel
exit /b 1
:exitFromFunction
()
:end
endlocal
echo Finished successfully.然后ZIP /output/approot和将上传到Azure。
https://stackoverflow.com/questions/34947781
复制相似问题