我可以從解決方案資源管理器中通過右鍵單擊選擇部署來部署SqlClr項目項目。不過,我想要一個命令行版本,我也可以指定自定義ConnectionString。如何通過MsBuild命令行部署CLR存儲過程?
4
A
回答
1
該命令是msbuild MySqlClrProject.csproj /T:deploy
。這裏假定代碼是建立的,至少在我的機器上默認構建了調試版本。如果要重新構建解決方案,請部署發佈二進制文件並使用自定義連接字符串,則命令爲msbuild MySqlClrProject.csproj /T:Clean;Build;Deploy /p:Configuration=Release;ConnectionString="Data Source= .;Initial Catalog=dropme;Integrated Security=True"
您需要從x86 2010命令提示符(MSBuild 4.0)執行此操作。它不適用於Visual Studio 2008(MSBuild 3.5)。我沒有Visual Studio 2012來查看它是否在那裏工作。
如果試圖從64位命令提示符下運行此您將獲得以下內容:
c:\Users\jdearing\Documents\MySqlClrProject\MySqlClrProject.csproj(48,11): error MSB4019: The imported project "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\SqlServer.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
下面是什麼運行命令成功看起來像一個例子:
Setting environment for using Microsoft Visual Studio 2008 x86 tools.
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC>cd c:\Users\jdearing\Documents\MySqlClrProject
c:\Users\jdearing\Documents\MySqlClrProject>msbuild MySqlClrProject.csproj /T:deploy
Microsoft (R) Build Engine Version 4.0.30319.1
[Microsoft .NET Framework, Version 4.0.30319.261]
Copyright (C) Microsoft Corporation 2007. All rights reserved.
Build started 7/11/2012 4:58:04 PM.
Project "c:\Users\jdearing\Documents\MySqlClrProject\MySqlClrProject.csproj" on node 1 (Deploy target(s)).
SqlClrDeploy:
Beginning deployment of assembly MySqlClrProject.dll to server . : dropme
The following error might appear if you deploy a SQL CLR project that was built for a version of the .NET Framework that is incompatible with the target instance of SQL Server: "Deploy error SQL01268: CREATE ASSEMBLY for assembly failed because assembly failed verification". To resolve this issue, open the properties for the project, and change the .NET Framework version.
Deployment script generated to:
c:\Users\jdearing\Documents\MySqlClrProject\bin\Debug\MySqlClrProject.sql
Dropping [MySqlClrProject].[SqlAssemblyProjectRoot]...
Creating [MySqlClrProject].[SqlAssemblyProjectRoot]...
The transacted portion of the database update succeeded.
Deployment completed
AfterDeploy:
---SqlReference---
Data Source=.;Initial Catalog=dropme;Integrated Security=True
Done Building Project "c:\Users\jdearing\Documents\MySqlClrProject\MySqlClrProject.csproj" (Deploy target(s)).
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:09.37
c:\Users\jdearing\Documents\MySqlClrProject>
相關問題
- 1. CLR執行命令的存儲過程
- 2. CLR存儲過程
- 3. 如何通過命令行配置本地部署和遠程?
- 4. 通過MSBuild部署BizTalk應用程序
- 5. CLR DLL在VS中部署良好,但不通過MSBuild
- 6. 你能通過命令行通過Gradle部署到設備嗎
- 7. 部署期間CLR存儲過程的架構
- 8. 使用WiX部署CLR觸發器/存儲過程
- 9. C#CLR存儲過程不會部署到SQL Server 2005
- 10. 通過執行命令調用另一個存儲過程
- 11. 如何配置CLR存儲過程
- 12. C++和CLR存儲過程
- 13. 調用CLR存儲過程
- 14. 調用CLR存儲過程
- 15. 從CLR存儲過程
- 16. SQL存儲過程執行命令
- 17. 通過命令行部署應用程序客戶端(asadmin)
- 18. 在IBM i上,如何通過QShell的DB2命令運行存儲過程?
- 19. 如何將SQL CLR存儲過程部署到多個服務器
- 20. 如何在通過Capistrano部署後執行「命令行」實用程序?
- 21. 如何通過命令行
- 22. 如何通過命令行
- 23. 如何通過命令行
- 24. 如何通過命令行
- 25. 如何通過執行外部命令來執行vim命令?
- 26. CLR存儲過程v常規SQL存儲過程
- 27. CLR存儲過程線程異常
- 28. 程序集配置CLR存儲過程
- 29. 如何從存儲過程啓動SQL命令行?
- 30. 如何查看命令行存儲過程輸出經由SQLPLUS
啓動VS命令提示符。然後運行'devenv/deploy/out log.log yoursolution.sln'。在log.log中查找如何部署的線索,對不起,我不能做得比這更好:/ –
Taheren,如果你接受他們的答案,人們會更傾向於回答你的問題。 –