I'm trying to set up a Jenkins CI server to deploy a .NET 4.5 app but I cant for the life of me find the msbuild exe on my windows 8 machine running visual studio 2012. Any ideas?
Make sure that you have installed the corresponding .Net framework.
You can find the build.exe by following this sample path
C:\Windows\Microsoft.NET\Framework\v4.5\MSBuild.exe
The correct way to locate MSBuild is to use the registry.
Here's a powershell implementation of finding a specific version of the .exe
$regKey = "HKLM:\SOFTWARE\Microsoft\MSBuild\ToolsVersions\${Version}"
$itemProperty = Get-ItemProperty $RegKey -ErrorAction SilentlyContinue
if ($itemProperty -ne $null -and $itemProperty.MSBuildToolsPath -ne $null)
{
$msBuildPath = Join-Path $itemProperty.MSBuildToolsPath -ChildPath "MsBuild.exe"
}
I do not like neither of the other answers. Because in C:\Windows\Microsoft.NET\Framework\ or registry you cannot find new msbuild version that was installed with visual studio or separately as build tools. The best way is to use vswhere
find msbuild
Related
I'm working in a virtual environment in VS Code and I can't understand why I'm getting this error:
[2022-07-19T10:00:31.580Z] A host error has occurred during startup operation '609dfded-e9f5-4fc4-b3a3-554bde11a415'.
[2022-07-19T10:00:31.582Z] Microsoft.Azure.WebJobs.Extensions.Http: Could not load file or assembly 'System.Net.Http.Formatting, Version=5.2.8.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
Value cannot be null. (Parameter 'provider')
What should I check?
Rolled back nuget package Microsoft.NET.Sdk.Functions from 4.1.3 to 4.1.1 on the Azure functions Api project.
Rebuild solution.
I had this issues as well, and my solution was to re-download and re-install the Azure Function Core Tools. I think installing twice fixed the issue for me.
This fixed it for me, hope it helps someone else
Close Visual Studio
Delete folder C:\Users***\AppData\Local\AzureFunctionsTools
Restart Visual Studio.
Launch Application, folder gets recreated.
Taken from
Unable to upgrade Azure Functions Core Tools, Exception "Cannot create instance of type 'NuGet.Versioning.VersionRange'"
We encountered a similar problem after updating Microsoft.Azure.WebJobs.Extensions.Http to 3.2.0
Developers using Rider had no problems but no Visual Studio users could run our project.
This post explained it for us: https://weblogs.asp.net/sfeldman/updating-azure-functions-tools.
Just by creating a new azure functions project, the latest version for AzureFunctionsTools was downloaded to \AppData\Local\AzureFunctionsTools.
Then we could run the project without errors.
My solution to this issue was to go into Windows Defender and exclude:
C:\Program Files\Microsoft\Azure Functions Core Tools\func.exe
I then reinstalled Azure Functions Core Tools v4 and everything worked as intended.
Ps. After excluding make sure to give time for your system to update. I restarted and all worked as intended. Hope this helps someone.
I had this exact issue until Yesterday when I tried updating Azure Function Core Tools (https://learn.microsoft.com/en-us/azure/azure-functions/functions-run-local?tabs=v4%2Cwindows%2Ccsharp%2Cportal%2Cbash) That resolved the problem, and I now am able to run my function's project using the CLI
For me, relaunching Azure Functions Core Tools installer and choose repair fixed the issue. I had been encountering this issue in the last two days and it's really annoying.
I believe the cause is that the Azure Functions Core Tools (henceforth AFCT) that Visual Studio (or VS Code) uses does not have the proper version of Microsoft.Azure.WebJobs.Extensions.Http.dll. Installing AFCT doesn't affect anything directly, because VS uses its own version stored elsewhere. My strategy was to install the latest AFCT version and point VS to that new version.
These instructions are for x64 Windows.
Install latest Azure Functions Core Tools
Using the below PowerShell code, move VS's old version of AFCT, then point VS to the newly installed version
Move old AFCT, point VS at new version
# Find Afct in Program Files
$PfMicrosoftPath = Join-Path -Path $env:ProgramFiles -ChildPath 'Microsoft'
$AfctPath = Join-Path -Path $PfMicrosoftPath -ChildPath 'Azure Functions Core Tools'
# Find the latest Aft in your Local AppData
$VsAftPath = Join-Path -Path $env:LOCALAPPDATA -ChildPath 'AzureFunctionsTools'
$VsAftReleasePath = Join-Path -Path $VsAftPath -ChildPath 'Releases'
$VsLatestAfctPath = Get-ChildItem -Path $VsAftReleasePath | Sort-Object -Property Name -Descending | Select-Object -First 1 -ExpandProperty FullName
$VsAfctCliPath = Join-Path -Path $VsLatestAfctPath -ChildPath 'cli_x64'
$VsAfctBackupPath = Join-Path -Path $VsLatestAfctPath -ChildPath 'cli_x64_backup'
# Move the existing AFCT and create a symlink
Move-Item -Path $VsAfctCliPath -Destination $VsAfctBackupPath -Confirm:$true
New-Item -Type Junction -Path $VsAfctClipath -Target $AfctPath`
The accepted answer didn't totally fix the issue for me, but I did find that the package Microsoft.NET.Sdk.Functions(4.1.3) does cause the issue, but I found another one does as well, so it will depend on what other packages you have in your app.
So, start with downgrading that package to (4.1.1), if that doesn't fix the issue, downgrade all packages and upgrade them one by one and try running the app after each upgrade.
In my case the other package that was causing the issue along with the above package was Microsoft.Extensions.Http.Polly(7.0.0), the highest that worked for me was (6.0.11)
In my case i just executed this command in my vs code project where the tool i would use was the v4 :npm install -g azure-functions-core-tools#4 --unsafe-perm true
You can check your machine and use the latest version of azure-functions-coretools.
For those are using Rider, go to settings > tools > Azure > Functions > Upgrade your tools to latest one (the version 4.0.4785 fixed my issue).
I had used VS CODE before. But now I would like to try JetBrains Rider. Currently, I have only NetCore 3.0. But before I had 2.2. I had removed old NetCore and installed new one. I am trying to create new project. But Rider don't see NetCore 3.0.
I did not see ability to change NetCore SDK. My operation system is Linux Mint 18. I have only one NetCore version. And it's 3.0.
Why it's happening?
It is pretty common problem. I have solved it by specifying path to .Net Sdk manually. This is the screen of settings:
Specify path to .NET binary file. It is usually has the following path /home/<your_user>/dotnet/dotnet
Specify path to MSBuild file. For example my path is the next : /home/aleksej/dotnet/sdk/3.0.100-preview6-012264/MSBuild.dll
Save
Profit!
P.S. My operation system is Linux Mint 19.1. And version of .Net Core is not important in this case.
Update
I forgot about one important moment. If you need to change .NET version for your solution, you have to place special global.json file in the root of your solution. If you are changing .NET version for a project - put global.json on the project root path.
Example of global.json for changing .NET version:
{
"sdk": {
"version": "2.2.300"
}
}
If you want to find the location of your sdk then write the following command: dotnet --list-sdks. It has to show you 3.1.403 [/usr/share/dotnet/sdk] or similar to it. If it's not then consider it installed using the following guide Install .NET Core on Linux . Then select the dotnet file in .NET CORE CLI executable path, with it's respective MSBuild.dll .
PD: Remember to save the changes globally!!!.
what solved for me was remove the .idea folder and start again.
I have to use the Jetbrain MSE build
I have to do some set of things to work, due to the windows security I have some issue
On windows 11 do this
launch powershell as an admin
Set-ExecutionPolicy Unrestricted
Get-AppXPackage -AllUsers | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
Set-ExecutionPolicy restricted
IGNORE THE ERRORS
on windows 10 do this
launch powershell as an admin}
run get-AppxPackage Microsoft.SecHealthUI -AllUsers | Reset-AppxPackage
if it doesn't work do this
run Add-AppxPackage -Register -DisableDevelopmentMode "C:\Windows\SystemApps\Microsoft.Windows.SecHealthUI_cw5n1h2txyewy\AppXManifest.xml"
run get-AppxPackage Microsoft.SecHealthUI -AllUsers | Reset-AppxPackage
Then follow the instruction from here
https://rider-support.jetbrains.com/hc/en-us/articles/360006365380
Am following Microsoft's "Getting Started" tutorial to deploy a Node.js Express app as a Cloud Service.
After carefully installing all the tools on two machines, one Win 7 and one Win 8, I get down to the point of generating "Hello World" and the tutorial suggests running the intuitively named: New-AzureServiceProject helloworld in Windows PowerShell.
Here is what happens:
PS C:\node> New-AzureServiceProject helloworld
New-AzureServiceProject : Could not find a part of the path 'C:\Program Files (x86)\Microsoft
SDKs\Azure\PowerShell\ResourceManager\AzureResourceManager\AzureRM.Profile\Resources\Scaffolding\General\scaffold.xml'.
At line:1 char:1
+ New-AzureServiceProject expressapp
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [New-AzureServiceProject], DirectoryNotFoundException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.CloudService.Development.Scaffolding.NewAzureServiceProjectCommand
Taking a look at my system after installing Powershell and the Azure SDK as instructed, I DO have a directory:
C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ResourceManager\AzureResourceManager\AzureRM.Profile
However, that directory does NOT have a subdirectory "Resources" and hence it never finds the scaffold.xml file....
I tried creating the subdirectory Resources\Scaffolding\General inside of AzureRM.profile. That changed the error to simply "could not find scaffold.xml"
I tried setting the write positions on "General" to be wide open. No change.
The above error is on the Win 8 machine. On my Win 7 machine after digging more carefully into the install and going multiple layers deep into prereqs not mentioned in the tutorial, AzureRM.Profile ends up installed in C:\Program Files\C:\Program Files\WindowsPowerShell\Modules rather than in C:\Program Files (x86)\Microsoft
SDKs\Azure\PowerShell\ResourceManager\AzureResourceManager but the behavior is identical.
I have looked all over the web and have not been able to find any information on the missing scaffold.xml that might point to a solution. Is this a template that New-AzureServiceProject needs to create the app? Or is this something that is supposed to be generated by New-AzureServiceProject?
Any suggestions would be appreciated...
Thanks!
I solved this problem by copying folder
C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ServiceManagement\Azure\Services\Resources
to
C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ResourceManager\AzureResourceManager\AzureRM.Profile
Need to copy the Resources folder from:
C:\Program Files\WindowsPowerShell\Modules\Azure\3.1.0\Compute
to
C:\Program Files\WindowsPowerShell\Modules\AzureRM.profile\2.3.0\Resources\Scaffolding\General
According your error message from PowerShell, it seems that you miss installed powershell AzureRM.* modules.
Please try to run the following commands from the Windows PowerShell console running as Administrator:
PS C:\> Install-Module AzureRM
PS C:\> Install-AzureRM
Then run New-AzureServiceProject helloworld again.
Meanwhile, if you want to get started with the node.js application on Azure Web Apps, you can refer to Azure Website Cmdlets.
Apologies for the terrible experience. This looks like a bug in one particular version of Azure PowerShell. To diagnose, we would need to know which version - if you used the msi installer, or WebPI, you will find thins in the 'Uninstall a Program' control panel, the entry is 'Microsoft Azure PowerShell'.
One piece of confusion in some of the comments - the hosted service cmdlets are part of the older RDFE (Service Management) commands in Azure. The cmdlets that support these are in the 'Azure' module, and not in any of the 'AzureRM' modules.
To install the latest version, I highly encourage you to use Web Platform Installer, or the msi installer that you can retrieve from our GitHub repo. PowerShell Gallery is a great solution as well, if you are very comfortable with PowerShell module management.
I will bring this tutorial to the attention of the documentation team. Meanwhile, if you can identify the azure powershell version and the sdk version you are using, I can see if there is a fix for the problem.
Copy content from
C:\Program Files\WindowsPowerShell\Modules\Azure\4.3.1\Services\Resources\Scaffolding\General
To
C:\Program Files\WindowsPowerShell\Modules\AzureRM.profile\3.3.1\Resources\Scaffolding\General
for creating certificate run this command
pvk2pfx.exe -pvk C:\myCerts\ELServer.pvk -spc C:\myCerts\ELServer.cer -pfx C:\myCerts\ELServer.pfx
following error occurred in command prompt
'pvk2pfx.exe' is not recognized as an internal or external command,
operable program or batch file.
I got exactly this error. The first thing I did was try to search for the .exe using Powershell:
Get-ChildItem -Path C:\ -Filter pvk2pfx.exe -Recurse -ErrorAction SilentlyContinue -Force
I could not find it but I could find makecert.exe with this command.
Turned out I did not have the package Desktop development with C++ installed for Visual Studio 2017. After I added this everything worked. Remember to run the command through Developer Command Prompt for VS 2017.
If you do not use Visual Studio 2017 you can download Windows Driver Kit (WDK) from here instead:
https://developer.microsoft.com/en-us/windows/hardware/windows-driver-kit
I ran the command in VS2012 command prompt which is available in
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Visual Studio 2012\Visual Studio Tools\ in the name of
VS2012 x86 Native Tools Command Prompt
You can also use VS2017 command prompt which is available in C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Visual Studio 2017\Visual Studio Tools\VC in the name of
x86 Native Tools Command Prompt for VS 2017
You can do windows + s key and then type command and open the X86 based command prompt to run the command.
it's not in your PATH environment variable. add it to PATH or just navigate to the directory where that exe is.
Today my powershell updated to version 3.0. This version is build against and uses .NET runtime 4.0. The Sharepoint 2010 cmdlets require .NET 3.5 and don't work under 4.0. Anyone has an idea how to get scripts work?
I receive this error:
Remove-SPSite : Microsoft SharePoint is not supported with version 4.0.30319.296 of the Microsoft .Net Runtime.
try to launch powershell with : powershell.exe -version 2.0
I had some trouble with this today too but this worked out for me.
C:\Windows\System32\WindowsPowerShell\v1.0\PowerShell.exe -version 2.0 -NoExit " & ' C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\CONFIG\POWERSHELL\Registration\\sharepoint.ps1 ' "
At first I think i had a trailing space which made it not work but you can always check it out with $psversiontable and make sure that CLRVersion is 2.0.50727.5466
powershell.exe -v 2 also should work fine
Edit:
it's better to uninstall windows update which caused this issue KB2506143
check this article
Do not install the Windows Management Framework 3.0 (KB2506143) on SharePoint 2010 Servers
Type "PowerShell -v 2" (without quotes). on the top of the script
then you for second run comment it using #, if the script hangout
This loads PowerShell version 2, and you should be able to use it for SharePoint. Just type 'Exit' to get back to PowerShell v3