Hey there I could really use a guru on msbuild.
Ultimate goal: Build web deployment packages with TeamCity
I'm trying to call the Package target in TeamCity on my build server and it fails as path: Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.5 doesn't exist. 10.5 doesn't exist on my dev laptop either, I am using VS 2012, yet I can call MSbuild package target on the command line of my laptop with no problem.
I could make a copy of Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0 that does exist on the build server and rename it 10.5, but this just feels wrong.
Any pointers gratefully received.
EDIIT
For now I have just:
created the path: "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.5"
Copied contents of V10.0 into it.
Copied "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\web\Microsoft.WebSite.Publishing.targets" into it.
It's a case of getting the VisualStudioVersion right, override it on the command line and all is good.
C:\>msbuild web_site.publishproj /T:Package /P:Configuration=Release;PackageLocation=C:\packages;VisualStudioVersion=11.0
Related
How is this possible?
I installed .net sdk 6.0.405: dotnet-sdk-6.0.405-win-x64.exe
I can in windows terminal and power shell run: dotnet --version: 6.0.405 ✅
I CAN ALSO IN VSCODE IN ITS BUILTIN TERMINAL, run: dotnet --version: 6.0.405 ✅✅
But in the OUTPUT tab, choosing OmniSharp Log from the dropdown, it says:
[ERROR] A .NET 6 SDK for x86_64 was not found. Please install the latest x86_64 SDK from ...
I switched vscode explorer settings to use external terminal.
And this terminal setting to command prompt:
Terminal › Integrated › Default Profile: Windows
The default profile used on Windows. This setting will currently be ignored if either terminal.integrated.shell.windows or terminal.integrated.shellArgs.windows are set.
I have dotnet in the PATH (and it works in terminals and in vscode's terminal)
I restarted vscode, AND REINSTALLED the dotnettools "C# for Visual Studio Code (powered by OmniSharp)" extension. I went to the online store and from the right column under Resources I downloaded the ms-dotnettools.csharp-1.25.2#win32-x64.vsix to make sure I get the right one. And restarted vscode.
I tried this setting:
Omnisharp: Dotnet Path
Specified the path to a dotnet installation to use when "useModernNet" is set to true, instead of the default system one. This only influences the dotnet installation to use for hosting Omnisharp itself. Example: "/home/username/mycustomdotnetdirectory".
C:/Program Files/dotnet/sdk/6.0.405
And this setting:
Omnisharp: Sdk Path
Specifies the path to a .NET SDK installation to use for project loading instead of the highest version installed. Applies when "useModernNet" is set to true. Example: /home/username/dotnet/sdks/6.0.300.
C:/Program Files/dotnet/sdk/6.0.405
And restarted vscode. And now it says:
[ERROR] Error: Command failed: dotnet.exe --version
'dotnet.exe' is not recognized as an internal or external command,
operable program or batch file.
What? W H A T? lol
What could be wrong? Why isn't it saying where it expected to find it and what to do to locate it? Is there a setting to specify the dotnet.exe path to this C# extension? Does it need always-on internet or something? Does it have DRM? Does it need Edge installed? Wtf?🙂
🙃😭 I just need intellisense; and I've wasted 2h, on only microsoft-owned products.
#Microsoft 0/5 stars
Still don't know why it happens, but here's how to solve it:
The problem was from this: I like to keep all my visual studio code extensions as .vsix files locally in folders so I can remember and get them easily & offline. Sensible enough choice, and I had the correct ms-dotnettools.csharp-1.25.2#win32-x64.vsix for my platform.
But in VSCode, when I install this particular extension via VSIX, even though it succeeds, it can't find .net. If you instead install the extension "normally", ie via vscode's own download, it seems vscode does some extra configuration steps while installing, and probably sets the .net paths correctly or something. Because now it works.
So TL;DR: don't install ms-dotnettools.csharp via vsix, it seems bugged. 😶
Would love to see an answer explaining what's wrong / how to actually do via vsix; but I don't have any more time to debug this rn.
I created a simple Windows UWP solution with windows visual studio 2019.
I did not make any changes to it but closed visual studio.
Then I wrote a simple cmake file for it.
However, it fails in "cmake --build" like this:
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.WinFx.targets(268,9):
error MC6000: Project file must include the .NET Framework assembly
'WindowsBase, PresentationCore, PresentationFramework' in the reference list.
[App1\out\App1.csproj]
When I add the requested .NET files with VS_DOTNET_REFERENCES property, there is a different error:
App1\MainPage.xaml(9,5): error MC3074: The tag 'ThemeResource' does not exist
in XML namespace 'http://schemas.microsoft.com/winfx/2006/xaml/presentation'.
Line 9 Position 5. [App1\out\App1.csproj]
I also tried adding all and combinations of these calls to CMakeLists.txt but they did not have any effect:
set_property (SOURCE "App.xaml" PROPERTY VS_XAML_TYPE "ApplicationDefinition")
target_compile_options (App1 PRIVATE "/langversion:default")
set_property (TARGET App1 PROPERTY DOTNET_TARGET_FRAMEWORK_VERSION "v4.7.2")
set_property (TARGET App1 PROPERTY WIN32_EXECUTABLE TRUE)
I cannot overcome these problems.
I generate and compile the solution like this:
cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 -S . -B out
cmake --build out
Cmake version is 3.14.19050301-MSVC_2.
The source files are here, including the original by visual studio created solution files and my written CMakeLIsts.txt file.
Expected result would be a cmake compiling solution which looks as much as possible like the native solution.
Probably there is just a simple error but I cannot find it.
SonarQube is giving me below error when i integrate the xamarin app with jenkins on windows sever
SonarQube Scanner for MSBuild 3.0
Default properties file was found at C:\SonarQube\bin\SonarQube.Analysis.xml
Loading analysis properties from C:\SonarQube\bin\SonarQube.Analysis.xml
Post-processing started.
13:49:43.952 SonarQube analysis could not be completed because the analysis configuration file could not be found: C:\Users\Administrator\.jenkins\workspace\Xamarin-ProjectTemplate\.sonarqube\conf\SonarQubeAnalysisConfig.xml.
13:49:43.952 Post-processing failed. Exit code: 1
I have followed the below guide https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+MSBuild
SonarQube.Scanner.MSBuild.exe begin /k:"org.sonarqube:sonarqube-scanner-msbuild" /n:"Project Name" /v:"1.0"
MSBuild.exe /t:Rebuild
SonarQube.Scanner.MSBuild.exe end
Please help me to resolve this issue
The errors reported at the end of a SonarQube report are sometimes less helpful than the errors when you begin.
Eg when I got this error, scrolling to the top of the log showed that I wasn't correctly setting the sonar.projectKey value, but this message the OP shared is still what showed up at the end.
I had the same problem. You need find correct MSBuild.exe.
I have several in c:\Windows\Microsoft.NET\Framework64\... and also in c:\Program Files (x86)
For my project in Visual Studio 2017 with .NETFramework,Version=v4.6.1 the correct MSBuild.exe is:
"c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\amd64\MSBuild.exe" /t:Rebuild
For the Enterpsie version is should be:
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild" /t:Rebuild
I got the same error and was able to fix it by excluding "/t:Rebuild" from second step. Also used the VS2017 MSBuild.exe
These are the 3 commands I ran in Windows Command Prompt (CMD):
1>> SonarScanner.MSBuild.exe begin /k:"MyProjectName"
2>> "C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/MSBuild/15.0/Bin/MSBuild.exe" "MySolution.sln"
3>> SonarScanner.MSBuild.exe end
Update I confront this error also , my solution was easy I just build the project in the visual studio then its succeeded.
I had this problem because I used a bad project key (it had a }) inside. I removed the }and the problem was gone.
I'm trying to develop a Notepad++ plugin using a nppPlugin.netV0.6 template.
Downloaded from http://sourceforge.net/projects/sourcecookifier/files/other%20plugins/NppPlugin.NET.v0.6.zip/download
I got a build error [SDK path is empty.]
The same template is working in other system (XP also).
Can anyone give me an resolution for this issue?
The build process calls program ildasm.exe. The directory for that program may not have been added to the PATH environment variable. When I installed Visual Studio 2012 Express installer the directory was not added so I added it to the PATH and the build succeeded.
I tracked the problem down by increasing the amount of logging output written by the build process. (Via Tools => Options => Projects and Solutions => Build and run => MS Build ... verbosity.)
Not sure whether your error is identical. Before adding the directory to the PATH the errors below were generated:
1>------ Rebuild All started: Project: NppManagedPluginDemo.VS2010, Configuration: Debug Any CPU ------
1> NppManagedPluginDemo.VS2010 -> C:\Adrian\VS\NppPlugin.NET.v0.5\Demo Plugin\NppManagedPluginDemo\bin\Debug\Demo.dll
1> ILDasm: calling 'ildasm.exe' with /quoteallnames /unicode /nobar /linenum "/out:C:\Users\Adrian_2\AppData\Local\Temp\tmpAB1F\Demo.il" "C:\Adrian\VS\NppPlugin.NET.v0.5\Demo Plugin\NppManagedPluginDemo\bin\Debug\Demo.dll"
1>C:\Adrian\VS\NppPlugin.NET.v0.5\Demo Plugin\NppManagedPluginDemo\DllExport\NppPlugin.DllExport.targets(8,5): error : The system cannot find the file specified
There are several versions of ildasm.exe in sub directories of c:\Program Files (x86)\Microsoft SDKs\Windows\ of my current computer.
I have a .net application built on .net framework 3.5, I am trying to build this application on Jenkins CI server. I've added MSBuild plugin and and have added path to the .exe file of 2.0, 3.5 and 4.0 versions of MSBuild. But my building processes are failing by showing the below error message.
Path To MSBuild.exe: msbuild.exe
Executing command: cmd.exe /C msbuild.exe Neo.sln && exit %%ERRORLEVEL%%
[Test project] $ cmd.exe /C msbuild.exe Neo.sln && exit %%ERRORLEVEL%%
'msbuild.exe' is not recognized as an internal or external command,
operable program or batch file.
Build step 'Build a Visual Studio project or solution using MSBuild.' marked uild as failure
Finished: FAILURE
Could anyone plz help me out..??
To make the MSBuild plugin work, you need to configure the plugin in the Jenkins management screen.
NOTE: in the newer Jenkins versions you find the MSBuild configuration in the Global Tool Configuration:
Note the "Name" field, where I've called this particular configuration v4.0.30319. You could call it anything you like, but ideally the name will somehow refer to the version.
You'll need to refer to this name later in the Jenkins PROJECT that's failing.
Note: The yellow warning implies that the Path to MSBuild field should be populated with a directory name rather than a file name. In practice you do need to enter the filename here too (ie. msbuild.exe) or the build step will fail.
In the Jenkins project that's failing, go to the MSBuild build step.
The first field in the build step is "MSBuild Version". If you created the build step before configuring any MSBuild versions, the value here will be (default).
After configuring one or more MSBuild versions, the drop down will be populated with the available configurations. Select the one you require.
You can see here that I've now selected the named configuration that matches the installation above.
Jenkins | Manage Jenkins | Configure System
scroll down to the MSBuild section and click MSBuild installations
define the full path to msbuild.exe, on my system I have 3.5 and v4.0.30319
Note - specify the path to 32-bit tools even on a 64-bit system, otherwise you might get an error message:
Building Windows Phone application using MSBuild 64 bit is not supported.
So in Jenkins - it could be for example:
Name: Version 3.5
Path: C:\Windows\Microsoft.NET\Framework\v3.5\MSBuild.exe
Name: Version 4.0
Path: C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSbuild.exe
I think you should set an absolute path for "msbuild.exe" in your Jenkins configuration,
for example:
C:\Windows\Microsoft.NET\Framework\v3.5\msbuild.exe
You can also add the path where the msbuild.exe is, to the PATH system environment variable of the node (or nodes) that is running that specific job.
You could try executing the
%comspec% /k ""c:\Program Files\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"" x86
command, which will temporarily update your environment path variables to reflect the VS2010 build environment. Execute this before you call MSBUILD and see what happens. I use this in my own build scripts with no issues.
Side note; it's very likely counterproductive to have multiple versions of MSBUILD on your PATH. Concentrate on getting one version working and go from there.