TFS 2017 Deploy ASP .NET Core - .net-core

We are on TFS 2017 initial release (on premise install). I am looking to see how I can build ASP .NET Core 2.0 apps using TFS 2017 Build / Release. Right now our standard builds uses Visual Studio builds and we have visual studio 2015 installed on our build server.
When I am attempting to build ASP .NET core 2 MVC app, using Visual Studio build, the build is failing with an error message :
Trunk\xxxxxx.csproj (1, 1)
Trunk\xxxxxx.csproj(1,1): Error MSB4041: The default XML namespace of the project must be the MSBuild XML namespace. If the project is authored in the MSBuild 2003 format, please add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the element. If the project has been authored in the old 1.0 or 1.2 format, please convert it to MSBuild 2003 format.
Can I ask what is the recommended approach to building / deploying .NET core 2.0 projects using TFS 2017?
Install VS 2017 on the build server? We already have VS 2015 installed on the build server. Can VS 2015 and VS2017 live side by side on the build server and will the VS build step pick up 2017?
Visual Studio Builld
Or should we be installing .NET core 2.0 SDK on the build server and then use command line utility as a part of the build step.
Or should we switiching to MSBUILD instead of VS studio build and installing just the MSBuild for VS 2017 on the builld server.

1.You could install VS2017 on the build server. VS2017 and VS2015 could live side by side on either a build server or a develop machine. You just need to select which version you will use in visual studio version picklist. However VS2017 option is not support on the build-in Visual Studio Build task on TFS2017. It's not related to VS2017 installed on the build server or not.
2.You need to install .NET CORE 2.0 SDK on the build server, otherwise will get a similar error as below:
error : The version of Microsoft.NET.Sdk used by this project is
insufficient to support references to libraries targeting .NET
Standard 1.5 or higher. Please install version 2.0 or higher of the
.NET Core SDK.
Highly recommend you to keep the build server environment as same as local develop machine, this will narrow down the build issue on TFS.
3.No you don't have to. Just follow the process in this tutorial-- Build your ASP.NET Core app
Suggest you update your TFS 2017 initial release to the latest version TFS2017 update2. This will include VS2017 in the picklist of vs version. And since .NetCore 2.0 released in May 2017 which is later then the initial TFS2017(November 2016), not sure if it's supported or have any other issues. However, one thing is certain: you could build .NET Core 2.0 apps in TFS2017update2 successfully. Moreover, there are many new features released with update2 version, there is no reason to stay on the initial TFS2017.

Related

ASP.Net Core WebApi Project creates an empty solution

I am trying to create a ASP.Net Core WebAPI application, i installed every sdk and runtime i was told to.
I then go into Visual Studio and create the Project from the ProjectCreator.
What I end up with is an empty solution and a project in the specified directory that i cannot open, with the error message the Project cannot be opened because it couldnt find a fitting sdk
(btw, creating it with .netCore3.1)
Heres a list of my installed sdks/runtimes:
.NET Core Runtime 2.1
.NET Core Runtime 3.1
.NET Core SDK 3.1.1
.NET Core SDK 3.1.4
.NET Runtime 5.0
.NET SDK 5.0.2
.NET SDK 5.0.3
ASP.NET Core 3.1.17
ASP.NET Core 5.0.8
This is what my solution explorer looks like tho the csproj is correctly placed
Whats seems to be the problem? Too many runtimes/sdk?
Are they overriding each other? Visual Studio cannot choose? I am baffled, this should work :/
[Edit1]
This is the guide I am following: https://learn.microsoft.com/de-de/aspnet/core/tutorials/first-web-api?view=aspnetcore-5.0&tabs=visual-studio
[Edit2]
I found a command that lets you see every sdk and runtime the dotnet/cli can access/see
(dotnet --info)
Looks like dotnet doesnt seem to find an sdk i installed
[Edit3]
I tried to manually install the .net core SDK 3.1 binaries into the C:\ProgramFiles\dotnet folder, but to no avail, dotnet --info still doesnt recognize the SDK
[Edit4]
I got it working, I will post the solution as an answer.
Heres what I did:
I uninstalled my Visual Studio IDE with the Visual Studio Installer
I uninstalled every .NET (Core) SDK and .NET (Core) Runtime
I did a fresh Visual Studio install with only the components i really need
After that I checked the dotnet --info command and there was it, 2 SDKs were installed. When I create the WebAPI Project now, the Solution Explorer has a project and I can finally see all files. This was weird. Thanks everyone tho!

The current .NET SDK does not support targeting .NET Core 3.1

I have downloaded and install Visual Studio 2019 and have dotnet core 3.1 installed.
As I am starting to play around with VS, I have just created a simple project using VS built-in Web App Template and try to run without debugging.
It gives the error of "The current .NET SDK does not support targeting .NET Core 3.1. Either target .NET Core 3.0 or lower, or use a version of the .NET SDK that supports .NET Core 3.1."
May I know how it can be resolved?
Thanks.
Regards,
Andrew
If you already have the correct .NET Core 3.1 SDK installed it could be caused by a file called global.json. This file allows to configure which SDK is used:
The global.json file allows you to define which .NET Core SDK version
is used when you run .NET Core CLI commands. Selecting the .NET Core
SDK is independent from specifying the runtime your project targets.
The .NET Core SDK version indicates which versions of the .NET Core
CLI is used.
Delete the file or change the defined SDK to 3.1:
{
"sdk": {
"version": "3.1.100",
"rollForward": "latestPatch",
"allowPrerelease": false
}
}
If you already have VS 2019 version more then v16.4, then magicandre1981 answer will be helpful.
But, I would suggest you to check your VS version as well. as I have invested lots of hours and checked my version much later.
Minimum compatibility visual studio version for .net Core 3.1 is Visual Studio 2019 (v16.4). I updated it and it worked.
Release update:
https://dotnet.microsoft.com/download/dotnet-core/3.1
For me, it was an environment variable. Not sure what set it (maybe some lame chocolatey package or something.)
I had environment variable MSBuildSDKsPath set as C:\Program Files\dotnet\sdk\2.0.3\Sdks
Removing that environment variable fixed the issue for me. (Actually, I renamed the environment variable to OLD_MSBuildSDKsPath, just in case ;) )
I was having vs 17 vs 19 both
I was trying to open code developed in visual studio 2019 into 2017.
Opening that project in VS 19 solved the issue for me
I am using VS 2022 and have a parallel installation of VS 2019 on my PC.
And I noticed that .NET 3.1 SDK (LTS) had to be installed (both 32 and 64 bit packages) to support an existing EF code first project (running with EF 3.x). Without it, the migration did not work and I got an error message like the one mentioned in the question.
Note that they can be installed in parallel with other versions (I have .NET 5 and .NET 6 on my PC installed as well).
You can find the required packages here: https://aka.ms/dotnet-download

Build error: COMReference .NET CORE 3.0: AxImp not found

I am trying to compile a .NET CORE 3.0 application that has a COM reference. Unfortunately when trying to build that application that has the reference, I am getting a build error:
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2726,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\NETFXSDK\4.7.2\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 understand that something is probably wrong with the setup or configuration (?), but cannot figure out what exactly. I have Visual Studio 2019 installed (the latest one at the moment of writing, 16.3.9). The application is set to target .NET CORE 3.0, that should support <ComReference ...> element.
How do I build an application that has a COM REFERENCE with .NET CORE 3.0 using Visual Studio 2019? I am building from VS2019 IDE. As of my understanding, it should not even look for the "AxImp", it should probably look for the "TlbImp". Also, why is it looking for Visual Studio 2010?? Windows SDK is installed. Does it need some specific version? Which one?
I tried to remove and then add the reference again using project references, nothing changed. Am I missing something?
After installing .NET SDK 4.7.2 the problem is gone. I had 4.8 version before (installed by default with VS 2019)

How do I get Visual Studio 2017 Evaluation to recognize .NET Framework 4.6.2 installed?

1) I did a clean install of Visual Studio 2017 Professional Evaluation copy on a brand new Dell laptop.
2) I tried to import and open a project solution which had been running on another computer with Visual Studio 2015 Professional full copy. Both computers run on Windows 10 Professional and fully updated.
3) Received error from Visual Studio upon solution import which said I could not load the project unless I changed the target of the.NET framework from 4.6.2 to .NET 4.6.1. because the 4.6.2 was not found on my machine.
4) Verified that 4.6.2 was in the registry
5) Tried to download a fresh install of 4.6.2 but it would not install because it also found 4.6.2 on the machine.
6) I also tried to load the project as 4.6.1 and then go in via the properties to change the target to 4.6.2 but had the same results.
Any suggestions as to how I can either get Visual Studio 2017 to recognize the 4.6.2 or uninstall 4.6.2 and reinstall?
The Runtime version and Target versions are different things. You need to run Visual Studio 2017 setup and select .net 4.6.2 SDK/Targeting pack under Individual Components:
They are not selected by default in VS2017. You have to do this for .net 4.7 as well, this is also not installed by default.
You need to download and install the .NetFramework 4.6.2 Developer pack.(https://www.microsoft.com/en-us/download/details.aspx?id=53321)
Check here. In effect, you need install .NET Framework 4.6.2 Developer Pack
https://superuser.com/questions/1254177/visual-studio-doesnt-recognize-net-framework-4-6-2-is-installed

How to Open .NET Core CLI Project in Visual Studio 2017

For one of my classes this semester, I am required to use .NET Core 1.1 and version 1.0.0-preview2-003177 of the CLI tools. How can I open such a project in Visual Studio 2017? I have found solutions that work for 1.0.0-preview4-004233, but I am not allowed to upgrade my project to the newer version due to my professor's requirements.

Resources