MSBuild error MSB3155 on Jenkins - c#

I am trying to build and publish a .net application through MSBuild in a Jenkins CI Server, and I am getting the errors bellow
warning MSB3155: Item 'Microsoft.Sql.Server.Express.9.2' could not be located in
warning MSB3155: Item 'Microsoft.Net.Framework.2.0' could not be located in
Does anybody know how to fix this problem? How could I install those components into my Bootstrapper files? (there is nothing at C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bootstrapper)
I am using MSBuild 4.0 (because the solution was created in vs2010) and the target framework is 2.0.
Thanks

I solved this issue by installing a x64 version of the Microsoft Windows SDK...so the corretc path is C:\Program Files\Microsoft SDKs\Windows\v7.0A\Bootstrapper = Without the (x86) string.

Related

Why can't I compile any of my old or new project? [duplicate]

I just upgraded my visual studio 2019 to latest version 16.8.3 and suddenly I am not able to load any C# project and getting the following error for all .NET core projects:
The project file cannot be opened. Unable to locate the .NET SDK.
Check that it is installed and that the version specified in
global.json (if any) matches the installed version.
Try to edit envrionment Variables.
Right click on This PC -> Properties -> Advanced System Settings -> Advanced -> Environment Variables -> System Variables
Add [install path] C:\Program Files\dotnet\ to the variable path.
Restart visual studio.
If it does not solve this problem, you can refer to this answer.
I found that the path C:\Program Files\dotnet was already in my path but it was ordered below the C:\Program Files (x86)\dotnet entry. By simply moving C:\Program Files\dotnet above C:\Program Files (x86)\dotnet in the list and restarting Visual Studio cleared up the problem.
If there is a global.json file in your solution folder(where *.sln file reside), delete this.
In my case, I had .NET 6 preview but then uninstalled it. After uninstalling, some of my projects won't load. I have all the configurations mentioned above but still won't load the projects. I went to C:\Program Files\dotnet\sdk\ where I found that there still exist a .NET 6 folder which is empty. Deleting that empty .NET 6 folder fixes the issue and I was able to load my projects.
This works for me...
Check first if which .net Core SDK is available in the system.
Step 1: Open Command prompt (CMD) and type dotnet --info
The above image shows no SDK is installed or register
Step 2: Install SDK from https://dotnet.microsoft.com/download/dotnet-core
Done Visual studio works like charm... Verify if its properly installed and register
Above image you can see .net core SDK is registered properly on the system.
I had a similar situation upgrading from VS 2019 to VS 2022, trying to run a dotnet 5.0 solution from VS 2022 (that starts to use dotnet 6.0).
In the PATH env. variable I had both 'C:\Program Files\dotnet' and 'C:\Program Files (x86)\dotnet'. I removed the (x86) one and stopped having that error
Installing missed SDK that the project has built solved the problem
I had a similar issue when I tried to build a net5.0 solution that is not installed on my machine.
In my case, I had VS 2022, and net6.0 installed.
Installing net5.0 SDK solved the problem.
I had only C:\Program Files\dotnet in Path env
I just carefully followed the error message and tried to resolve the problem.
I got below error message:
F:\mypath\ServerlessFunc\ServerlessFunc\ServerlessFunc.csproj : error
: The project file cannot be opened. C:\Program
Files\dotnet\sdk\6.0.402\Sdks\Microsoft.NET.Sdk\Sdk not found. Check
that a recent enough .NET SDK is installed and/or increase the version
specified in global.json.
I then tried to navigate through
C:\Program Files\dotnet\sdk\6.0.402\Sdks\Microsoft.NET.Sdk\Sdk
path which was mentioned in the above error and found that the above path does not exist. This problem could be resolved if I install SDK of version of 6.0. Rather I started using VS-2022.

Microsoft Visual Studio 2019: The project file cannot be opened. Unable to locate the .NET SDK

I just upgraded my visual studio 2019 to latest version 16.8.3 and suddenly I am not able to load any C# project and getting the following error for all .NET core projects:
The project file cannot be opened. Unable to locate the .NET SDK.
Check that it is installed and that the version specified in
global.json (if any) matches the installed version.
Try to edit envrionment Variables.
Right click on This PC -> Properties -> Advanced System Settings -> Advanced -> Environment Variables -> System Variables
Add [install path] C:\Program Files\dotnet\ to the variable path.
Restart visual studio.
If it does not solve this problem, you can refer to this answer.
I found that the path C:\Program Files\dotnet was already in my path but it was ordered below the C:\Program Files (x86)\dotnet entry. By simply moving C:\Program Files\dotnet above C:\Program Files (x86)\dotnet in the list and restarting Visual Studio cleared up the problem.
If there is a global.json file in your solution folder(where *.sln file reside), delete this.
In my case, I had .NET 6 preview but then uninstalled it. After uninstalling, some of my projects won't load. I have all the configurations mentioned above but still won't load the projects. I went to C:\Program Files\dotnet\sdk\ where I found that there still exist a .NET 6 folder which is empty. Deleting that empty .NET 6 folder fixes the issue and I was able to load my projects.
This works for me...
Check first if which .net Core SDK is available in the system.
Step 1: Open Command prompt (CMD) and type dotnet --info
The above image shows no SDK is installed or register
Step 2: Install SDK from https://dotnet.microsoft.com/download/dotnet-core
Done Visual studio works like charm... Verify if its properly installed and register
Above image you can see .net core SDK is registered properly on the system.
I had a similar situation upgrading from VS 2019 to VS 2022, trying to run a dotnet 5.0 solution from VS 2022 (that starts to use dotnet 6.0).
In the PATH env. variable I had both 'C:\Program Files\dotnet' and 'C:\Program Files (x86)\dotnet'. I removed the (x86) one and stopped having that error
Installing missed SDK that the project has built solved the problem
I had a similar issue when I tried to build a net5.0 solution that is not installed on my machine.
In my case, I had VS 2022, and net6.0 installed.
Installing net5.0 SDK solved the problem.
I had only C:\Program Files\dotnet in Path env
I just carefully followed the error message and tried to resolve the problem.
I got below error message:
F:\mypath\ServerlessFunc\ServerlessFunc\ServerlessFunc.csproj : error
: The project file cannot be opened. C:\Program
Files\dotnet\sdk\6.0.402\Sdks\Microsoft.NET.Sdk\Sdk not found. Check
that a recent enough .NET SDK is installed and/or increase the version
specified in global.json.
I then tried to navigate through
C:\Program Files\dotnet\sdk\6.0.402\Sdks\Microsoft.NET.Sdk\Sdk
path which was mentioned in the above error and found that the above path does not exist. This problem could be resolved if I install SDK of version of 6.0. Rather I started using VS-2022.

Azure Pipeline deploy to Web App Service failing with Missing required property 'OutputPath'

I am running into an issue with deploying to Azure Web App resource I've got set up. I can't find much about this error online so posting here...
I have a .NET solution with a main project and several class library projects which i make references to in my main project.
For some reason, the deployment is failing because it doesn't pick up those dll projects in the solution. My code is on a bitbucket repo and I've set it to deploy to my web app resource whenever I make a commit to a certain branch.
But it is failing with this error:
Command: "D:\home\site\deployments\tools\deploy.cmd"
Handling .NET Web Application deployment.
MSBuild auto-detection: using msbuild version '14.0' from 'D:\Program Files (x86)\MSBuild\14.0\bin\amd64'.
All packages listed in packages.config are already installed.
Invalid restore input. Missing required property 'OutputPath' for project type 'PackageReference'. Input files: D:\home\site\repository\XXXCode\XXXXX.Entities\XXXXX.Entities.csproj.
Failed exitCode=1, command=nuget restore "D:\home\site\repository\XXXCode\XXXCode.sln"
An error has occurred during web site deployment.
Invalid restore input. Missing required property 'OutputPath' for project type 'PackageReference'. Input files: D:\home\site\repository\XXXCode\XXXXX.Entities\XXXXX.Entities.csproj.\r\nD:\Program Files (x86)\SiteExtensions\Kudu\82.10503.3890\bin\Scripts\starter.cmd "D:\home\site\deployments\tools\deploy.cmd"
Am i missing a step here?
I'm new to this so I probably forgot a step somewhere.
Any help greatly appreciated, thanks!
MSBuild auto-detection: using msbuild version '14.0' from 'D:\Program
Files (x86)\MSBuild\14.0\bin\amd64'.
According to this error message, apparently the version you are using is MSBuild 14.0(VS 2015 tools).
And also, from this message:
Missing required property 'OutputPath' for project type
'PackageReference'.
As far as I understood, the PackageReference just works with MSBuild version 15 and higher, instead of 14.0. Since it came with VS 2017, and at the same time MSBuild 15.0.
So, for solve this error, I recommend you try with the newer version: MSbuild 15.0.
You can also refer to this ticket: Missing required property 'OutputPath' for project type 'PackageReference'
Edit:
First, please ensure that your script can be executed successfully in VS2017 locally.
And then, if you build with Visual Studio build task, change the Visual Studio Version as:
Or, if its MSBuild task you are using, just need to change the MSBuild Version:
On the other hand, if you are using Specify Location instead of Version in MSbuild task, specify the location path of MSBuild.exe which under MSBuild 15.0. For me, I am using VS2019, so the location of MSbuild 16.0 is:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe
Update:
Since you are using VS2017, you can specified the location of MSbuild 15.0 with your MSbuild 15.0 file path as:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\amd64

MSBUILD used in from wrong location in VS2017 after uninstalling VS2015? XmlSerializers builds with incorrect versions

I uninstalled VS2017 and VS2015 and only re-installed VS2017. Now, on some asp.net 3.5 assemblies that were previously building/working fine in VS2017 are no longer building correctly.
Even though the project references system.xml v2.0, when it is build, the *.XmlSerializers assembly pulls in the v4.0 version of the assembly. Causing our sites running on the asp.net 2.0 application pool to no longer function.
Here is my assembly Application settings:
Here is my project reference:
And here is Ildasm.exe showing the wrong system.xml pulled in:
The only bindings I have in the web.config are the following:
I'm trying to determine if it is build MSBuild is ran from the C:\Windows\Microsoft.NET\Framework\v4.0.30319 path or what.
UPDATE: I ran a build with detailed output on my desktop (the one that no longer functions properly) and my laptop (which still works). There were obviously lots of differences, but the ones that jumped out as possible issues are:
Laptop (still working)
SDK35ToolsPath = C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\
MSBuildVersion = 15.7.180
TargetFrameworkSDKToolsDirectory = C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\
VSSDK140Install = C:\Program Files (x86)\Microsoft Visual Studio 14.0\VSSDK\ missing from desktop
Microsoft (R) Visual C# Compiler version 2.8.3.63029 (e9a3a6c0) (TaskId:28)
Desktop (not working)
SDK35ToolsPath =
MSBuildVersion = 15.9.21
TargetFrameworkSDKToolsDirectory = C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\
Microsoft (R) Visual C# Compiler version 2.10.0.0 (b9fb1610) (TaskId:28)
Wonder if I should reinstall VS2015 again as well even though I'll never use the UI?
Copied from the comment.
VS2017/2019 no longer installs .NET Framework 3.5 SDK by default. That's why you saw SDK35ToolsPath is blank in MSBuild logging.
Go to VS2017/2019 installer and select .NET Framework 3.5 development tools to install. Then it should compile without problems.

Compilation of .NET 4.6 C# project without Visual Studio

I try to compile a .NET 4.6 C# project on my build machine using only MSBuild. I did not install the Visual Studio 2015 on the machine, but just the following:
.NET Framework 4.6 Runtime
.NET Framework Targeting Pack
Microsoft Build Tools 2015
I run following in the cmd: "C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" MySolution.sln
The error I get is:
"error MSB4019: The imported project
"C:\Microsoft.Cpp.Defaults.props" was not found. Confirm that the path
in the declaration is correct, and that the file exists on
disk."
I have already checked that the "Microsoft.Cpp.Defaults.props" file exists in "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0", but not in the "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140". Actually even the folder "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140" does not exist.
What more should I do/install to compile this?
I had same problem. I fixed it by adding below argument when run ms build.
/p:VisualStudioVersion=12.0
Not 14.0.
I refered this answer.
External VS2013 build error "error MSB4019: The imported project <path> was not found"

Categories

Resources