I am building a wixproject using Visual studio solution on Configuration= Release,Platform=x64 by unchecking x86 platform to skip some dependency wix projects.
Is there a way to do the same using MSBuild command line?
Skipping dependency wixproject using msbuild command line
Just like stijn said, you can specify the property in the command line when you build the project/solution file.
As we know, the property Platform= project-level property, which we could set or override the specified project-level properties by -property:name=value. Name is the property name and value is the property value.
Check the document MSBuild command-line reference for some more details.
So, to resolve this issue, you just need pass the property Platform=x64 in the command line, like:
MSBuild YourProjectPath.wixproj /property:Configuration=Release /property:Platform=x64
or use shorter form:
MSBuild YourProjectPath.wixproj /p:Configuration=Release /p:Platform=x64
Hope this helps.
Related
I have used msbuild from commandline to build my sln projects. But I can't find the exe output anywhere.
Can anyone explain me what I am doing wrong?
Thanks
If you use MSBuild command line to build your project, it can specify the outputpath of the project.
Use like this -p:outputpath=C:\test, C:\test is the new output folder of your project.
More msbuild command line arguments, you can refer to this document.
So you should use like this:
msbuild xxx\xxx.sln -t:build -p:outputpath=xxx(specified new output path)
I have Visual studio project solution which has multiple .csproj. Each .csproj has some reference libraries.The project settings are made in such a way the reference libraries are built first and then .csproj is built. This works as expected when i run it in visual studio IDE. But when i try to execute using msbuild i'm getting an error saying target doesn't exist. Gone through many posts related to this issue ,tried possible things.But didn't built.Looks like i might be doing something silly or missing something in the settings.
Also tried using devenv from commandline. With this option i dont see any error but at same time the project doesnt build.I dont see any message after execution of command.Im using visual studio 2015
Here is my project structure
Poject.sln
ProjectA
porjectB
projectC
Libraries
libA
libB
msbuild "project.sln" target:"D:\Projects\Source\Demo\ProjectA\ProjectA.csproj" /t:build
"/p:Configuration=Debug" "/p:platform=x86"
I see the below error
"D:\project.sln" (D:\Projects\Source\Demo\ProjectA\;build target) (1) ->
D:\project.sln.metaproj : error MSB4057: The target "D:\Projects\Source\Demo\ProjectA" does not exist in the project. [D:\project.sln]
Here is the command used using devenv
devenv.exe "project.sln" /build Debug /project `"D:\Projects\source\Demo\Applications\ProjectA\ProjectA.csproj" /projectconfig Debug
After executing the above its doesnt build and i dont see any error too.
error MSB4057: The target "D:\Projects\Source\Demo\ProjectA" does not
exist in the project.
The error indicates your path in command is not valid and project.sln can't recognize the path. So you actually meet one path-related issue. And you should pass the ProjectA to the targets argument instead of ProjectA.csproj! More details see tip3 in For MSBuild.
For MSBuild:
1.If you're only trying to build ProjectA and its reference libraries.
Navigate(cd) to path where ProjectA.csproj exists, and then use command msbuild ProjectA.csproj /t:build /p:Configuration=Debug /p:platform=x86
Also you can directly use command msbuild AbsolutePath\ProjectA.csproj /t:build /p:Configuration=Debug /p:platform=x86. It's not necessary to use " to cover the path and arguments.
(ProjectA.csproj file should have definitions about the reference to those two library projects, so msbuild ProjectA.csproj will build those two projects first. You don't need to specify the xx.sln in your command.)
2.If you're trying to build whole solution(all the projects):
msbuild project.sln /t:build /p:Configuration=xxx /p:platform=xxx
Navigate to solution folder when you run above command, or use absolutepath\project.sln with that command.
3.When you want to build specific projects(more than one) in solution:
Check How to: Build Specific Targets in Solutions By Using MSBuild.exe. Since you're only build ProjectA, you don't need to use this format. For example: Only when you need to build both ProjectA and ProjectB, but not build ProjectC... You can use command like:
msbuild xxx.sln /t:NotInSlnfolder:Build;NewFolder\InSolutionFolder:Build
Pay attention to the path when you use this format. Whether your project is in solution folder can affect the build result a lot ! And, the direct cause of your issue, this command's targets argument needs one ProjectName as input instead of ProjectName.csproj.
For Devenv command:
1.I always use VS2017 and VS2019,so I'm not certainly sure if VS2015's devenv related command has big difference from VS2017's or VS2019's. But according to details from this VS2017 document:
Commands that begin with devenv are handled by the devenv.com utility, which delivers output through standard system streams, such as stdout and stderr.
Alternatively, commands that begin with devenv.exe can use the same switches, but the devenv.com utility is bypassed. Using devenv.exe directly prevents output from appearing on the console.
I think that's why you don't see any message after execution of command. You should use devenv.com command to see the output in console. And it's by design that devenv.exe will prevents output from appearing on the console.
2.The following command builds the project CSharpWinApp, using the Debug project build configuration within MySolution.
devenv "%USERPROFILE%\source\repos\MySolution.sln" /build Debug /project "CSharpWinApp\CSharpWinApp.csproj" /projectconfig Debug
More details about devenv reference please check this document.
In addition:
1.Looks like you have one strange project structure. I checked your error message above and it seems your several projects(xx.csproj) are not under Solution(xx.sln) folder. Just a suggestion, the normal folder structure for VS2015 is always:
Solution folder
xx.sln
ProjectA folder
ProjectA.csproj
ProjectB folder
ProjectB.csproj
2.For most of the projects, build using msbuild is more powerful and convenient than build using devenv. So if you don't have special reason, I recommend using Msbuild, the build engine of VS.
Hope all above helps to resolve your issue and puzzle. Let me know if your issue persists:)
File "/Users/morel893/Desktop/env/lib/python3.7/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: relation "projects_project" does not exist
LINE 1: ...ct"."technology", "projects_project"."image" FROM "projects_...
I have created InstallShield Basic MSI project from Visual Studio (IS 2012 Spring, VS 2010). My InstallShield project having 2 product configurations and each configuration having one release.
Product Configuration 1
Release 1
Product Configuration 2
Release 2
For building project in VS IDE, I need to set the corresponding product configuration as 'Default Product Configuration' and build. This is working fine. The Default configuration release is getting build.
But, how can we achieve this in MSBuild command line?
I need to build both configuration separately using MSBuild command line (without changing Default configuration through IDE).
Could anyone please share the proper way to build IS project in MSBuild command line?
Thanks,
Saravanan
how can we achieve this in MSBuild command line?
You can use Properties in the MSBuild command line:
msbuild test.sln /t:project /p:Configuration="Release" /p:Platform="x86" /p:BuildProjectReferences=false
You can also build multiple projects at once:
msbuild test.sln /t:project;project2 /p:Configuration="Release" /p:Platform="x86" /p:BuildProjectReferences=false
Note:
what is assigned to /t is the project name in the solution, it can be different from the project file name.
One important note: if your project has a '.' in the name, you'll need to replace it with a '_' when specifying it with /t
I have an MSBuild command line that can build an entire solution. It looks something like this:
msbuild SomeSolution.sln /p:Configuration:CustomDebug;Platform=OurPlatform /nodeReuse:false /maxcpucount:4 /t:Build
I know that for C++ Solutions, specific projects can be targeted using the following syntax:
msbuild SomeSolution.sln /p:Configuration:CustomDebug;Platform=OurPlatform /nodeReuse:false /maxcpucount:4 /t:Folder\SomeCppProject;Build
I'm trying to achieve the same thing for .NET projects within a solution. This does NOT work:
msbuild SomeSolution.sln /p:Configuration:CustomDebug;Platform=OurPlatform /nodeReuse:false /maxcpucount:4 /t:SomeDotNetProject;Build
Does anyone know how to target a specific project within a solution using MSBuild on the command line for .NET projects? I know I can create a custom MSBuild project to achieve what I'm after, but I need to share the solution and projects with Visual Studio.
Thanks!
-Sean
You'll need to specify any solution folders in the Visual Studio solution file, and replace any "." in the project name with "_":
msbuild SomeSolution.sln /p:Configuration:CustomDebug;Platform=OurPlatform /t:Folder\Project_Name
For example, if you have a project in the solution folder "Deploy" named "MyApplication.Deployment.csproj", you'll need
msbuild SomeSolution.sln /p:Configuration:CustomDebug;Platform=OurPlatform /t:Deploy\MyApplication_Deployment
Incidentially this is a solution folder, as displayed in Visual Studio, not a file system folder: those are ignored.
You can use the following commandline for building your project using msbuild from commandline
msbuild Solution.sln /p:Configuration=Release;Platform=x86 /t:ProjectName:Rebuild
Invoke MSBuild on the project file instead of the solution file (ref.msbuild /?)
msbuild SomeDotNetProject\SomeDotNetProject.csproj /p:Configuration:CustomDebug;Platform=OurPlatform /nodeReuse:false /maxcpucount:4 /t:Build
The gtest's msvc directory has the gtest project file, and opening it with Visual Studio enables me to select the build out of 8 configurations(gtest/gtest_main/gtest_prod_test/gtest_unittest x release/debug) with Batch Build.
How can I do the same thing with msbuild tool? For example, how can I tell msbuild to build gtest/Debug or gtest_unittest/Release?
MSBuild projectfile /property:Configuration=Debug
http://msdn.microsoft.com/en-us/library/ms171452%28v=vs.80%29.aspx
Kyle Alons's answer works fine. When I run solution file that has four projects, it generates the release version of each project.
msbuild gtest-md.sln /property:Configuration=Release
I could run each project as follows, but the output names are based on solution name, so I need to modify to get correct results.
msbuild gtest-md.vcxproj /property:Configuration=Release
The solution was to specify target as follows.
msbuild gtest-md.sln /target:gtest-md /property:Configuration=Release