TFS 2013 won't build a .NET Framework 4.6 project - c#

I am trying to get TFS2013 to build a .NET Framework 4.6 C# project on our build servers. I have installed the build tools and the 4.6 .NET Framework out on the build machine. I can see from the build log that the build server is actually targeting the 4.6 .NET Framework.
Earlier I had issues getting the dll references but those were cleaned up by me installing the 4.6 framework. I even tried installing Visual Studio 2015 on the build server and still it won't build.
I have also tried passing the /p:VisualStudioVersion=14.0 parameter. I am kind of running out of ideas or things to try to get this build working.

I figured out what i needed to do.
To let TFS2013 run builds for 4.6 you need to do the following:
Install the 4.6 framework and the Build Tools for 2015.
OR
Install Visual Studio 2015 (which installs the framework and build tools).
Then you can either modify your build template and hard code the build tools for a template. Or the path I choose that was use the argument: /tv:14.0

Related

Visual Studio 2022 can't create exe with all dll's

I have project in .NET 4.8 and i want to publish as one exe file (with all dll) and app.config. When i use VS 2017 i just choose publish and to file. But now i have Publish wizard which create installer (which install i don't know where). When I go to project properties this same wizard.
Edit: this issue absent for .net 6 app
Publish Wizard which I get:
P.S. I hope my english wasn't too terrible
Publishing in a single-file app isn't supported by .NET Framework 4.8. This is for .NET core and higher version of launguage.

Using VS 2017 image, unable to build other projects in a solution which has one .NET Core 3 project

I have a solution with multiple projects, one of which targets .NET Core 3.
I need to build another project in the solution using both the VS 2019 image and the 2017 image. For the 2017 image, I don't need to build the .NET Core project; so I've disabled the build on that project using the VS Configuration Manager. However, the build still fails:
C:\Program Files\dotnet\sdk\2.2.108\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(137,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Core 3.0. Either target .NET Core 2.2 or lower, or use a version of the .NET SDK that supports .NET Core 3.0.
[C:\projects\antlr4parsetreevisualizer_visualizerTestCore_visualizerTestCore.csproj]
because of that one project.
How can I tell AppVeyor to ignore the project in this instance?
I tried explicitly setting the build: project: element, but to no avail.
appveyor.yml
We are going to add .NET Core 3.0 to Visual Studio 2017 image in the next update (https://github.com/appveyor/ci/issues/3158). In the meantime, you can use the following script to install .NET Core 3.0 during the build:
install:
- ps: Invoke-WebRequest -Uri 'https://dot.net/v1/dotnet-install.ps1' -UseBasicParsing -OutFile "$env:temp\dotnet-install.ps1"
- ps: '& $env:temp\dotnet-install.ps1 -Architecture x64 -Version "3.0.100" -InstallDir "$env:ProgramFiles\dotnet"'
Regarding project exclusion - I believe you can disable project building for specific configuration in Visual Studio IDE ("Configuration manager..."). However, for .NET Core projects I'd recommend going away from building a solution to building particular projects with dotnet build .... Additionally, if you need to publish .NET Core app publishing solution won't work with dotnet publish command.
Initially, I only had one .csproj file to build per configuration. Per build image, I passed the project to dotnet restore (in my case I also had to rework the matrix logic to depend on the appveyor_build_worker_image environment variable):
environment:
matrix:
- job_name: VS 2019 build
appveyor_build_worker_image: Visual Studio 2019
- job_name: VS 2017 build
appveyor_build_worker_image: Visual Studio 2017
# ...
for:
# ...
-
matrix:
only:
- appveyor_build_worker_image: Visual Studio 2017
configuration: ReleaseCI2017
build:
project: 2017\2017.csproj
before_build:
- cmd: dotnet restore 2017\2017.csproj
Once I did that, everything seems to work, even without downloading+installing .NET Core 3 in an install script.
appveyor.yml
Thread on AppVeyor support forum
But as it turned out, I needed to build two projects for each image. I've resolved this by using additional solution files to control which projects should be built under each image, instead of relying on the VS configuration manager.
I then pass each solution to the build: project element, and AppVeyor will only attempt to build the specific projects referenced by that solution.
appveyor.yml
AppVeyor log.

MSBuild fails for .NET Core SDK Version 2.2.202

After downloading and installing Visual Studio 2019 RC, I cannot run msbuild, and get the following error:
"Version 2.2.202 of the .NET Core SDK requires at least version 16.0.0 of MSBuild.
The current available version of MSBuild is 15.6.82.30579.
Change the .NET Core SDK specified in global.json to an older version that requires the MSBuild version currently available."
I cannot find MSBuild version 16. The only version I find is this one here:
"C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0"
.NET Core SDK versions 2.2.2XX and 2.1.6XX are intended to be used with Visual Studio 2019 and MSBuild 16.x.
.NET Core SDK versions for Visual Studio 2017 are 2.2.1XX and 2.1.5XX.
See this GitHub issue for more details.
Updating Visual Studio to the minimum supported version or above should fix this problem.
Some .NET Core versions also include fixes in MSBuild. They are distributed together with Visual Studio.
They put the minimum supported versions in the release notes of .NET Core.
For example: Announcing .NET Core 2.2 | .NET Blog
For people coming here because they have the in Azure DevOps Pipelines - here some pointers for that.
If you have a private agent pool configured (e.g. private build machine), you might want to update your machine to support a more recent MSBuild version. See other answers.
If you don't have configured a build agent and use a default agent pool provided by Azure DevOps itself (e.g. "Hosted" or VS2019), see if there is a newer Hosted one that supports your configuration. See screenshot below where to look.
I ran into this with our on-prem build server we use with GitHub Actions.
The solution was to run Visual Studio Installer and update Visual Studio Build Tools 2017 and 2019.
I realize this solution is very similiar to those above, but I wanted to speak to the situations where Visual Studio is not installed, but Build Tools are.
For anyone that is still coming across this issue. I found another way, to get around this without upgrading to VS 2019 or rolling back SDK 3.1. My experience is in TFS 2017 (on-prem). I'm the build engineer, not a developer.
I had an SDK 2.2 app that was failing after the install of 3.1.
Initially, it was causing the NuGet steps to fail. Research led to me asking the developers to add a global.json file having it point to 2.2. This fixed the NuGet errors.
Then MSBuild step was failing with similar to OPs message. Couldn't figure out why 3.1 was taking presedence over 2.2 when it was listed in global.json. So I started digging around in the SDK in stall folders (typically located in C:\Program Files\dotnet\sdk). I came across a file named minimumMSBuildVersion In the SDK\3.1.101 folder that file has version 16.3.0 of MSBuild listed. I then went to the SDK 2.2 folder and checked it there. It has version 15.3.0 which my build server has. I simply changed the version to this in the 3.1 folder and my build succeeded. I hope this helps anyone that may still be experiencing build issues when .Net Core SDK versions are updated on their TFS Build Servers.

Microsoft Visual Studio 2017 Installer Projects launch condition check not work for .net 4.7.1

I am using visual studio professional at version: This version announced as supported .net framework 4.7.1
I installed the Microsoft Visual Studio 2017 Installer Projects extension from the market.
Generate a visual studio setup project to generate MSI for a .net framework windows service console application, inside "Launch Condition" tag, set the .net framework version is target to 4.7.1.
The msi launch check works fine in any system below 4.7 like (4.6.1/4.6/4.5.2....) the launch check will prevent installer to be launched, but in OS system with windows 2012 R2 with .net 4.7 installed, the launch check should expected also as failed. But .net 4.7 pass the launch check and continually launch the installer.
Is anyone facing the same problem and is there a solution for this? I need to support launch check of .net 4.7.1 in my Microsoft Visual Studio 2017 installer project.
It is happening because Microsoft Visual Studio installer considers only first two digits of version.
To overcome from this situation you can create Launching condition to prevent installer to be launched if required version of .Net framework is 4.7.1 is not installed even 4.7 is installed on machine.
See Defining Launching Conditions section in https://help.sap.com/doc/saphelp_nwgwpam_1/1.0.4/en-US/c5/88c211fa174464800b9d457182e4be/content.htm?no_cache=true

Does visual studio require .net framework

I'm new to .net framework. Have few queries.
Does visual studio requires .net framework to be pre installed in the system.
Does visual studio comes with .net framework within it. So no need to install separately.
If .net framework comes within visual studio, is it different version for different vs versions.
I have seen that in application tab we have target framework, may I know from where all these different versions of .net framework visual studio has.
Application developed with one version say 4.5 , can this run on 4.0 and do we have to modify this version first to 4.0 and then run it.
When you're installing VS it's automatically install default version of .net framework for current Visual Studio , but you can additionally install any other versions if you need, it's like an additional nozzle to the vacuum cleaner :-)

Categories