use*_*178 3 c# msbuild dacpac sql-server-data-tools visual-studio-2015
Tools: Visual Studio 2015, SSDT
I have an Visual Studio SQL Project which works fine on it's own. I run my build and the dacpac file is in debug\bin\*.dacpac as expected.
The problem is this SQL project is part of a WinForms solution.
I have included the SQL project as a project reference in the Winforms Project.
It looks like visual studio only copies dlls from project reference bin folders into the output path bin\debug folder.
How can I configure Visual Studio to ALSO copy the dacpac file to the winform project's bin\debug folder (outputpath)?
对于项目本身包含的其他文件,这很容易。我可以编辑文件属性以始终复制到输出路径。对于BIN输出,您无法执行此操作,因为dacpac文件是构建输出,而不是项目本身的一部分。
如何配置Visual Studio还将dacpac文件复制到Winform项目的bin \ debug文件夹(输出路径)?
您可以在添加复制任务Pre-build event的WinForms项目或在Post-build eventSQL项目。
生成后事件在SQL项目:
xcopy /y "$(ProjectDir)$(OutDir)*.dacpac" "$(SolutionDir)YourWindowsFormsProjectName\$(OutDir)"
Run Code Online (Sandbox Code Playgroud)
预生成事件在Winform的项目:
xcopy /y "$(SolutionDir)YourSQLProjectName\$(OutDir)*.dacpac" "$(ProjectDir)$(OutDir)"
Run Code Online (Sandbox Code Playgroud)
以下是一些常用的开关xcopy:
/I - treat as a directory if copying multiple files
/Q - Do not display the files being copied.
/S - Copy subdirectories unless empty.
/E - Copy empty subdirectories.
/Y - Do not prompt for overwrite of existing files.
/R - Overwrite read only files.
Run Code Online (Sandbox Code Playgroud)
希望能有所帮助。
| 归档时间: |
|
| 查看次数: |
1617 次 |
| 最近记录: |