2016-09-08 4 views
0

Octopus를 사용하여 데이터베이스와 함께 MVC 프로젝트를 배포하려고합니다. 데이터베이스를 배포하기위한 단계가 충돌 할 때 나는 다음과 같은 오류를 받고 있어요 :Microsoft.SqlServer.Dac 문제

Types   : {Microsoft.SqlServer.Dac.BacPackage, 
       Microsoft.SqlServer.Dac.NestedDeploymentPropertyAttribute, 
       Microsoft.SqlServer.Dac.DacExportOptions, 
       Microsoft.SqlServer.Dac.DacImportOptions...} 
    LoaderExceptions : {System.IO.FileNotFoundException: Could not load file or 
       assembly 'Microsoft.SqlServer.TransactSql.ScriptDom, 
       Version=12.0.0.0, Culture=neutral, 
       PublicKeyToken=89845dcd8080cc91' or one of its 
       dependencies. The system cannot find the file specified. 
       File name: 'Microsoft.SqlServer.TransactSql.ScriptDom, 
       Version=12.0.0.0, Culture=neutral, 
       PublicKeyToken=89845dcd8080cc91' 
       WRN: Assembly binding logging is turned OFF. 
       To enable assembly bind failure logging, set the registry 
       value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 
       1. 
       Note: There is some performance penalty associated with 
       assembly bind failure logging. 
       To turn this feature off, remove the registry value 
       [HKLM\Software\Microsoft\Fusion!EnableLog]. 
       , System.IO.FileNotFoundException: Could not load file or 
       assembly 'Microsoft.SqlServer.TransactSql.ScriptDom, 
       Version=12.0.0.0, Culture=neutral, 
       PublicKeyToken=89845dcd8080cc91' or one of its 
       dependencies. The system cannot find the file specified. 
       File name: 'Microsoft.SqlServer.TransactSql.ScriptDom, 
       Version=12.0.0.0, Culture=neutral, 
       PublicKeyToken=89845dcd8080cc91' 
       WRN: Assembly binding logging is turned OFF. 
       To enable assembly bind failure logging, set the registry 
       value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 
       1. 
       Note: There is some performance penalty associated with 
       assembly bind failure logging. 
       To turn this feature off, remove the registry value 
       [HKLM\Software\Microsoft\Fusion!EnableLog]. 
       } 
Message   : Unable to load one or more of the requested types Retrieve 
       the LoaderExceptions property for more information. 
Data    : {} 
InnerException : 
TargetSite  : System.RuntimeType[] 
       GetTypes(System.Reflection.RuntimeModule) 
StackTrace  : at 
       System.Reflection.RuntimeModule.GetTypes(RuntimeModule 
       module) 
        at System.Reflection.Assembly.GetTypes() 
        at Microsoft.PowerShell.Commands.AddTypeCommand.LoadAssemblyFromPathOrName(List`1 generatedTypes) 
        at 
       Microsoft.PowerShell.Commands.AddTypeCommand.EndProcessing() 
        at 
       System.Management.Automation.CommandProcessorBase.Complete() 
HelpLink   : 
Source   : mscorlib 
HResult   : -2146232830 

Deploy.ps1 파일은 다음과 같다 : 나는 마이크로 소프트의 NuGet 패키지를 사용하고

try{ 

    # Add the DLL 
    # For 64-bit machines 
    Write-Host "Add Microsoft.SqlServer.Dac.dll" 
    Add-Type -path ((Get-Item -Path ".\" -Verbose).FullName + "\bin\Microsoft.SqlServer.Dac.dll") 
    Write-Host "Add Microsoft.SqlServer.TransactSql.ScriptDom.dll" 
    Add-Type -path ((Get-Item -Path ".\" -Verbose).FullName + "\bin\Microsoft.SqlServer.TransactSql.ScriptDom.dll") 

    # Create the connection string 
    $services = New-Object Microsoft.SqlServer.Dac.DacServices ("Data Source=$dbSource;User Id=$dbAdminUser;Password=$dbAdminPassword") 

    Write-Host "Load the dacpac " + ((Get-Item -Path ".\" -Verbose).FullName + "\Resources\Database.publish.xml") 
    #Load the dacpac 
    $dacpac = ((Get-Item -Path ".\" -Verbose).FullName + "\Resources\Database.dacpac") 
    $dacpacoptions = ((Get-Item -Path ".\" -Verbose).FullName + "\Resources\Database.publish.xml") 

    Write-Host "Add variables" 

    #Add the variables to the options 

    Write-Host $dacpac 
    Write-Host $dacpacoptions 


    Write-Host "setting dp" 
    #Load dacpac from file & deploy to database 
    $dp = [Microsoft.SqlServer.Dac.DacPackage]::Load($dacpac) 


    Write-Host "dacProfile set" 
    #Read a publish profile XML to get the deployment options 
    $dacProfile = [Microsoft.SqlServer.Dac.DacProfile]::Load($dacpacoptions) 


    Write-Host "Add dbName" 
    $dacProfile.DeployOptions.SqlCommandVariableValues["dbName"] = $dbName 
    Write-Host "Add dbUser" 
    $dacProfile.DeployOptions.SqlCommandVariableValues["dbUsername"] = $dbUser 
    Write-Host "Add dbPassword" 
    $dacProfile.DeployOptions.SqlCommandVariableValues["dbPassword"] = $dbPassword 

    Write-Host "About to deploy the dacpac" 
    # Deploy the dacpac 
    $services.Deploy($dp, $dbName, $TRUE, $dacProfile.DeployOptions) 

    # Configure IIS 
    .\DeployScripts\IISConfiguration.ps1 
} 
catch [Exception] 
{ 
    $_.Exception|format-list -force 
    Exit -1 
} 

. SqlServer.Dac v 1.0.1 및 Microsoft.SqlServer.TransactSql.ScriptDom v 13.0.1601.5 용 NuGet 패키지 이 두 NuGet 패키지는 현재 내 지식이있는 DLL의 최신 버전입니다. dacpac은 SQL Server 2014를 대상으로합니다. 다른 정보가 유용 할 지 모르겠습니다. 배포 할 서버에는 SqlPackage.exe가 없으므로 사용할 수 없습니다. 모든 도움이 매우 감사하게 생각합니다. 고맙습니다. 이처럼 보이는 로그에서

답변

0

는 그러나 나는 버전이,

+0

그래, 그것이 버전 12.0.0을 찾고 말했다의 위치 인 검색에서 어셈블리 "Microsoft.SqlServer.TransactSql.ScriptDom"를 찾을 수 없습니다 13.0.1 – Michelle

+0

Add-Type -path ((Get-Item -Path ". \"-Verbose) .FullName + "\ bin \ Microsoft.SqlServer.TransactSql.ScriptDom.dll") 올바른 디렉터리를보고 있습니까? C : \ Program Files (x86) \ Microsoft SQL Server \ 120 \ SDK \ Assemblies와 같이 명시 적 경로를 지정하여로드 할 수도 있습니다. – vikram