Creating a build for Visual Studio Deployment Project via command prompt - visual-studio

I am having issues with trying to create a Visual Studio Deployment Project via command prompt.
I have a visual studio 2015 installer I am trying to create, I am running the following command:
devenv.exe <SolutionName>.sln /Build "Release|Any CPU" /Project "<InstallerProjectName>.vbproj" /ProjectConfig "Release|Any CPU"
I also read that maybe the dependent projects need to be built as well, so I have also tried that as follows:
devenv.exe <SolutionName>.sln /Build "Release|Any CPU" /Project "<ProjectName>.vbproj" /ProjectConfig "Release|Any CPU" /Project "<InstallerProjectName>.vbproj" /ProjectConfig "Release|Any CPU"
No matter what I have tried the installer project does not build and it gives an error (pop's up the Microsoft visual studio helper window)
If I run the code without the installer such as the follow that project will be built just fine.
devenv.exe <SolutionName>.sln /Build "Release|Any CPU" /Project "<ProjectName>.vbproj" /ProjectConfig "Release|Any CPU"
What I am missing to get the installer project to build?
clarity:
- for devenv.exe I am pointing straight to the devenv.exe for VS 2015, I do have multiple versions of VS installed
- I am using "" around the locations paths to deal with the spaces in the names
- language is VB.Net

Suggestions that help to locate the cause of issue and then resolve it.
1.Try using devenv.com instead of devenv.exe, so that you can quickly get output info.
See this: Using devenv.exe directly prevents output from appearing on the console.
2.For installer project, it doesn't have platform like Any Cpu. See this:
For Release|Any Cpu solution configuration, the installer project(Setup1) doesn't have Any CPU project platform by default. Which mean your /ProjectConfig "Release|Any CPU" is not valid. I think it can build if you changes it to be /ProjectConfig Release
3.And make sure your path is all right. For me, I opened Developer Command Prompt for VS2015 and then navigate to solution folder by cd C:/solutionPath. Then i use command like this to build the installer project:
Normally the project file is in SolutionPath/ProjectName(one folder)/projectName.vdproj, so I use InstallerProjectName\InstallerProjectName.vdproj instead of InstallerProjectName.vdproj. (You may need to correct the InstallerProjectName.vbproj to InstallerProjectName.vdproj in your question...)
And now the devenv command will actually try to build the installer project. And if you meet HRESULT='8000000A', it's known issue about installer project. Check my another issue for more details to resolve that. (For VS2015, you should use corresponding way of VS2015)
Hope it helps:)

Related

Unable to specify project of solution for MSBuild

I have the following solution:
MySolution\
MySolution.sln
MyCSProject\
MyCSProject.csproj
MyCPPProject\
VC11\
projfile.vcxproj
VC8
projfile.vcproj
MyInstallationProject
MyInstallationPackage.vdproj
In Visual Studio I have MyCSProject set as main project. But for automated build I need to build MyInstallationProject with dependencies. MyInstallationProject depends on MyCSProject and MyCSProject depends on MyCPPProject. If I build from Visual Studio, it works.
But for MSBuild I can't compose correct command. Neither of the following worked:
"...\MSBuild.exe" MySolution.sln /t:MySolution\MyInstallationProject /p:Configuration="Release" /p:Platform="x64"
"...\MSBuild.exe" MySolution.sln /t:MySolution\MyInstallationProject.vdproj /p:Configuration="Release" /p:Platform="x64"
"...\MSBuild.exe" MySolution.sln /t:MyInstallationProject /p:Configuration="Release" /p:Platform="x64"
"...\MSBuild.exe" MyInstallationProject\MyInstallationProject.vdproj /p:Configuration="Release" /p:Platform="x64"
and so on, with various errors, mainly "The target *** does not exist in the project"
How to know correct command and or the name of target, associated with the project?
In fact, one of the third and the fourth msbuild command line should have worked in your side. Also, there is a document about it.
The truth is that MSBuild cannot build the vdproj file. It is from VS installer project extension and the build tool is a separate tool from the extension rather than in the MSBuild. You can easily open the vdproj file and could find that it is not a xml style.
MSBuild can only build the xml sytle proj file.
To test it, you could try the same msbuild command line for MyCSProject project to get the difference.
So the right way is to use VS IDE build or use devenv build command line which means you have to you have VS IDE on your local.
Try the following command line:
1) open Developer Command Prompt for VS:
2) run:
cd xxx\xxx\MySolution
devenv MyInstallationProject\MyInstallationProject.vdproj /build

MSBuild windows 2012 Visual Studio 2015 cannot find AxImp.exe

I'm trying to set up Jenkins in a Windows Server 2012 and Visual Studio 2015 and I cannot build my application using MSBuild, I get some Windows SDK issue.
(ResolveComReferences target) ->
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(2015,5):
error MSB3091: Task failed because "AxImp.exe" was not found, or the
correct Microsoft Windows SDK is not installed. The task is looking
for "AxImp.exe" in the "bin" subdirectory beneath the location
specified in the InstallationFolder value of the registry key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft
SDKs\Windows\v8.0A\WinSDK-NetFx40Tools-x86. You may be able to solve
the problem by doing one of the following: 1) Install the Microsoft
Windows SDK. 2) Install Visual Studio 2010. 3) Manually set the
above registry key to the correct location. 4) Pass the correct
location into the "ToolPath" parameter of the task.
I've tried the following:
Create the Registry key pointing to the SDK installed. No sucess.
Uninstall all C++ Compilers, download Windows 7 SDK iso and install, as explained here. No success.
Modify Visual Studio 2015 installation adding and removing components, marking explicitly SDKs to be installed. No success.
When building from Visual Studio it builds fine.
I really don't know what's happening here and why I cannot get it working, seems a bug to me regarding Windows or Visual Studio 2015.
The solution was much easier than it seemed to be, just changing the ToolsVersion of the Project node from 4.0 to 14.0 made the trick:
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
So I had a really similar issue, using Jenkins and Msbuild to build projects, and getting this same error.
My solution steps:
first find out IF Aximp.exe exist on the Jenkins machine. I don't have access to the machine, so I included a stage in my jenkinsfile to run this command:
//temp, try and get location of aximp.exe on build machine
bat 'dir "C:\\Program Files (x86)\\Microsoft SDKs\\Windows" /b /s aximp.exe'
I then reviewed the output to see where it lives.
then, I added a parameter to my msbuild command in my jenkinsfile like this:
bat 'msbuild mysolution.sln /p:VisualStudioVersion=14.0 "/p:TargetFrameworkSDKToolsDirectory=C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v10.0A\\bin\\NETFX 4.6.2 Tools" ' //your folder where aximp.exe lives
And the build now runs!

Disable step in Visual Studio Extension build

While I am building own Visual Studio Extension in TeamCity (same applies to any CI server build that supports building VS solutions), my build stucks on the step DeployVsixExtensionFiles. As far as I understand, the target is defined in VS Extensibility files and is being imported into any .csproj by default. I also realize that this is an "aka test" step that tries to embed an extension into a virtual copy of VS via running a command:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe /RootSuffix Exp /ResetSettings General.vssettings /Embedding /Command File.Exit
I have two questions:
1. Should I disable this step for Release build of Extension?
2. If yes, how can this be done.
The VS SDK installs the extension as a part of a build so you can F5 and run it. If you're CI system doesn't care about that, update your CI configuration to pass /p:DeployExtension=false to MSBuild.

devenv command line does not show error for defective projects

We use Jenkins to build our solutions automatically. We call devenv (Visual Studio 2010) by a command line: devenv PathToProject\Project.sln /build Release
When the solution contains a defective project (*.vdproj, *.csproj), opening the solution in the Visual Studio IDE will result in an error message. But when building the solution with the above command line, no error message is shown at all, and consequently Jenkins reports success.
if you want to reproduce the problem, just open the vdproj file in an editor, and remove a } somewhere in the file.
How can that problem be solved?
On Visual Studio 2012, /Out writes the build messages to a text file.
devenv.exe YourVisualStudioSolution.sln /build "Debug|Win32" /Out "YourLogFile.txt"
According to MSDN, this switch should work on Visual Studio 2010 as well.

Under vs10 msbuild.exe how can a specific project within a solution.sln be Ignored?

Under vs10 msbuild.exe how can a specific project within a solution.sln be Ignored?
I am building a large project that is moving to Visual Studio 10.0. In the IDE I can uncheck a project within the configuration manager and it will not build it. I need to mimic that behavior with a command line call to msbuild.exe.
The project I want to bypass is an *.dll plugin with a link error. I am stuck on stupid with the link error at the moment and since it stands alone, I can run the main program with out it and just live with a warning at run time that it isn't present.
I need some switch magic concerning calls to msbuild.exe.
If you have a certain configuration in the sln (configured in VS Configuration Manager) that you want to build with MSBuild, you can do so with the following command line:
msbuild /p:Configuration=MyConfiguration MySolution.sln

Resources