Error while building SSIS project using MSBuild during CI/CD implementation - visual-studio

Can someone assist with the following error which i am getting while building SSIS project using msbuild. I am having Visual studio 2015 in the machine. Using MSBuild 14.0
"*
error MSB4041: Th e default XML namespace of the project must be the
MSBuild XML namespace. If the project is authored in the MSBuild 200 3
format, please add
xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the
element. If the proje ct has been authored in the old 1.0 or
1.2 format, please convert it to MSBuild 2003 format.
*"
I have gone through some articles online but couldn't find solution with this scenario.

*" I have gone through some articles online but couldn't find solution with this scenario.
I'm afraid the answer is negative. For now this scenario(build SSIS project using msbuild) is not supported.
Someone has post this issue in DC forum, see Support SSIS, SSRS, SSAS in MSBuild. So if you're trying to use azure devops for CI/CD process, please vote and track this issue to get notifications when there's any update. And if you're using other tools for CI/CD process, I suggest you open a new feature request to support SSIS building for stand-alone msbuild tools in local machine.
And here're two workarounds which may help:
1.Since you have VS2015 installed, instead of msbuild command, you can try using devenv command.
For VS2015, we can find devenv.exe and devenv.com in path C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE. Both devenv.exe and devenv.com works for this, but note: Using devenv.exe directly prevents output from appearing on the console.
So devenv.xxx ... xxx.dtproj /build can work to build the SSIS project.
2.We can find binary(Microsoft.SqlServer.IntegrationServices.Build.dll) of the SQL Server Data Tools in C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE. Then we can use msbuild UsingTask element to call the tasks defined in that assembly.
The core is to call DeploymentFileCompilerTask task for SSIS build in our custom msbuild target after defining this statement:
<UsingTask TaskName="DeploymentFileCompilerTask" AssemblyFile="C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies\Microsoft.SqlServer.IntegrationServices.Build.dll" />
More details please refer to here and here.
Update:
If we have several Database projects and SSIS projects in same solution. Using command like devenv.com xx.dtproj directly will actually build all projects.
So I suggest we use command in this way:
Open Developer command prompt for VS
cd to solution directory
use command: devenv.com SolutionName.sln /Build Development /Project SolutionName\xxx.dtproj /ProjectConfig Development
This will only build the SSIS project actually.
In addition: If you see the message The project 'DatabaseProjectName.sqlproj' will close once model building has paused. If it doesn't affect your build, just ignore it. After my check if won't actually build Database project(the output of database project is empty) if we use command above.

Related

Azure devops failing to build visual studio sql database project: SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets" was not found

I have a sql database project in Visual Studio (2019).
I am trying to deploy it via azure devops.
The pipeline is failing due to the below error:
##[error]C:\azagent\A1_work\r1\a_Transcripts-SQLDeployment\SampleDatabaseProject\SampleDatabaseProject\SampleDatabaseProject.sqlproj(117,3): Error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk
The project builds without issue on my pc.
In the pipeline I have tried both the MSBuild and Visual Studio Build tasks, but the result is the same in each case.
Steps tried:
I found the reference in the sqlproj file xml, and removed it but this did not resolve the issue.
Appreciate any expertise on how to resolve this.

TeamCity publish using Visual Studio 2015

I've read many articles on publishing from TeamCity using various versions of Visual Studio. I'm currently using v.9.1.7 of TeamCity and Visual Studio 2015.
I have my 3 build steps on check-in:
Clean & Rebuild
Unit Test
Publish
When I check in my files I get a Tests Passed success message:
I can tell from here something isn't right as I'm expecting it to say something about publishing. When I look at the Build Log I see the following:
[12:48:22][API\API.sln] Publish [12:48:22][Publish] MSBuild [12:48:22][MSBuild] API\API\API.csproj: Build target: Publish
[12:48:22][API\API\API.csproj] _DeploymentUnpublishable
My Publish Build Step is setup this way:
In my API project in Visual Studio I can publish to the correct location on the network. Here is my publish profile:
I'm not sure what I'm missing. I'm expecting the Publishing build step to work like when I click the Build->Publish menu item in Visual Studio.
I'm guessing that I'm missing something or misunderstanding what the publishing build step is supposed to do.
Any help is appreciated.
I was able to get it to work after days and days of searching. I found part of the answer here on Stack Overflow. The trick was to get it to work from the MSBuild Command Line:
C:\TFS\project\myProject\APIproject>msbuild apiproject.csproj
/p:DeployOnBuild=true
/p:PublishProfile="Properties\PublishProfiles\DEV.pubxml"
/p:VisualStudioVersion=14.0
Once I got this running several times I was able to create a Build Step in Team City (see this question/answer) and I set the following:
Build file path: <location of the apiproject.csproj>
MSBuild version: Microsoft Build Tools 2015
MSBuild ToolsVersion: 14.0
Run platform: x86
Command Line Parameters: /p:DeployOnBuild=true /p:PublishProfile= "C:\TFS\API\API\Properties\PublishProfiles\DEV.pubxml" /p:VisualStudioVersion=14.0
IIRC, publishing from TeamCity requires certain files or alternatively VS installed on the build agent (which really isn't recommendable). Have you copied the necessary files to the build agent?
Where are artifacts location defined.
And you can use Tentacles for publishing build into various environments.
I guess, you need to look towards artifacts configurations.
You can use MSBuild runner to Deploy your Application/API
Add Command line parameter :
/t:Clean /p:DeployOnBuild=true /t:build /t:publish /p:PublishProfile=C:\_works\teamcity\publishprofiles\Publiush_Profile.pubxml /p:VisualStudioVersion=12.0
PublishPrfile URL should be your publish profile path.
This will work for you.
VS will probably find your publish profile with just the name, like:
/p:DeployOnBuild=true;/p:PublishProfile=DEV; very useful if you run more than one build agent.
And if you're deploying to an IIS you might need to add AllowUntrustedCertificate=true;

Can you call an earlier version of MSBuild from 2013 from TFS build definition

Our company just migrated our project from a TFS 2012 server to 2013 TFS server as well as our build controllers (2012 servers to 2013). I know within VS2013 MSBuild is now part of the application however I have a need to also reference older build machines that build some of our SSIS and SSAS projects as part of deployment. The challenge I have is these projects use Business Intelligence for 2008R2 and I cannot migrate the solution/projects forward.
Within my analytic's solution which was authored in VS2010 I have the following build command:
<Target Name="BeforeBuild">
<!-- Build SSIS Package-->
<Exec Command=""C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe" "$(MSBuildProjectDirectory)\..\AnalyticsSSAS\AnalyticsSSAS.dwproj" /Build" />
</Target>
<PropertyGroup>
<PostBuildEvent>xcopy "$(ProjectDir)..\AnalyticsSSAS\bin\*.*" /y</PostBuildEvent>
</PropertyGroup>
When I try to run a build using the 2013 definition the build fails and states that the msbiuld taks EXEC is not recognized. I can open the solution and projects individually and build them (running 2010) with no issues 2013 wants to migrate the solution to which I can't do.
Here is the actual message generated in the build log file:
"f:\blds\26\DevCI\src\Analytics.sln" (default target) (1) ->
"f:\blds\26\DevCI\src\Database\Dashboards\SSASBuild\SSASBuild.csproj" (default target) (2) ->
(BeforeBuild target) ->
f:\blds\26\DevCI\src\Database\Dashboards\SSASBuild\SSASBuild.csproj(85,5): error MSB3073: The command ""C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe" "f:\blds\26\DevCI\src\Database\Dashboards\SSASBuild\..\AnalyticsSSAS\AnalyticsSSAS.dwproj" /Build" exited with code 1.
"f:\blds\26\DevCI\src\Analytics.sln" (default target) (1) ->
"f:\blds\26\DevCI\src\Database\Dashboards\SSISBuild\SSISBuild.csproj" (default target) (3) ->
f:\blds\26\DevCI\src\Database\Dashboards\SSISBuild\SSISBuild.csproj(84,5): error MSB3073: The command ""C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe" "f:\blds\26\DevCI\src\Database\Dashboards\SSISBuild\..\AnalyticsSSIS\AnalyticsSSIS.dtproj" /Build" exited with code 1.
I suspect from what I have read that MSBuild in VS2013 will not allow for a lower version of MSBuild v9.0 to be referenced without migrating the project to a newer version.
Has anyone seen this before and is there any workaround for this type of build?
-cheers
I think there are many solution, but the basic idea is to force using the old MSBuild version.
Custom Build Template (old style)
Add an MSBuild activity and set the ToolPath Property to the old version. You must expose a list of solutions to build as Template arguments.
Script (new style)
Write a post-build (or pre-build) script that invokes the proper MSBuild version with the path to the solution.

Building InstallShield LE project with MSBuild - Error MSB4062

I work with Visual Studio 2012, and I just switched my deployment tools from NSIS to InstallShield. I've added new projects to my solution for InstallShield installers. When I build in Visual Studio (the IDE) I've no errors, no warnings and I'm happy.
Now, I want to have a script that build the full solution without launching the IDE. But when I run MSBuild in the command line, like that
MSBuild MySolution.sln /t:Build /p:Configuration=Release
I get following error MSB4062
C:\Program Files (x86)\MSBuild\InstallShield\2012SpringLimited\InstallShield.targets(21,3): error MSB4062: The "Microsoft.Build.Tasks.AssignProjectConfiguration" task could not be loaded from the assembly Microsoft.Build.Tasks.v3.5. Could not load file or assembly 'Microsoft.Build.Tasks.v3.5' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.
My searches lead me to the conclusion that I must buy the Premier Edition of InstallShield to take profit of ISCmdBuild. But I can't afford it, and I think there might be another solution.
Any idea?
Using Fusion logging the MSBuild checks for the DLL here: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Microsoft.Build.Tasks.v3.5.DLL.
I copied
c:\Windows\Microsoft.NET\Framework\v3.5\Microsoft.Build.Tasks.v3.5.dll
to
c:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Build.Tasks.v3.5.dll
And the error is gone.
Alternatively open your *.isproj file and change from "3.5" to "4.0" on top on the tag:
<Project ToolsVersion="3.5"...> --> <Project ToolsVersion="4.0" ...>
Another solution is to force MSBuild to use the x86 platform. See https://stackoverflow.com/a/1074699/870604
If you're building from a TFS build, this can be configured from the build options:
I found the solution. Use the command devenv.exe instead of MSBuild.exe. It will be similar to launching Visual Studio and clicking the Build button. That's all!
devenv.exe MySolution.sln /build Release

Publish doesn't work from build definition VS2012

What I thought would be simple is not. All I am trying to do is get MSBuild to copy website files to another server after my build.
In my Build definition Under Process --> Advance --> MSBuild Arguments I put
/p:DeployOnBuild=true /p:PublishProfile=WebsiteProfile
It builds fine but it never copies files to destination
BUT when I run this command locally, IT WORKS!!!!!
msbuild /p:DeployOnBuild=true /p:PublishProfile=WebsiteProfile
I have VS 2012 installed in Build Server so I think all the necessary files are there.
What is the problem?
UPDATE 1
Output in build log file
Run MSBuild for Project
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe /nologo /noconsolelogger "C:\Builds\1\MyProject\MyProject\src\MyProject.sln" /nr:False /fl /flp:"logfile=C:\Builds\1\MyProject\MyProject\src\MyProject.log;encoding=Unicode;verbosity=detailed" /p:SkipInvalidConfigurations=true /p:DeployOnBuild=true /p:PublishProfile=WebsiteProfile /p:VisualStudioVersion=11.0 /m /p:OutDir="C:\Builds\1\MyProject\MyProject\bin\\" /p:RunCodeAnalysis="False" /p:VCBuildOverride="C:\Builds\1\MyProject\MyProject\src\MyProject.sln.vsprops" /dl:WorkflowCentralLogger,"E:\Microsoft Team Foundation Server 11.0\Tools\Microsoft.TeamFoundation.Build.Server.Logger.dll";"Verbosity=Detailed;BuildUri=vstfs:///Build/Build/64;InformationNodeId=20178;TargetsNotLogged=GetNativeManifest,GetCopyToOutputDirectoryItems,GetTargetPath;TFSUrl=http://abc-tfs-p:8080/tfs/defaultcollection;"*WorkflowForwardingLogger,"E:\Microsoft Team Foundation Server 11.0\Tools\Microsoft.TeamFoundation.Build.Server.Logger.dll";"Verbosity=Detailed;"
REPRODUCTION STEPS
Created new website project
Made sure it worked on local machine
using development server
Checked code in TFS
Created a build definition using all the default settings Under the Process -->
Advance --> MSBuild Arguments I put
/p:DeployOnBuild=true /p:PublishProfile=WebsiteProfile
The publish profile copies the changeset to a remote server.
Installing the Web Tools 2012.2 update on the build server fixed this issue for me after I read this post and Scott Gu's Blog. I don't have Visual Studio installed on the server but installing the update got my DeployOnBuild working. I hope that helps.

Resources