Web.config fail to transform on TFS 2012 - asp.net-mvc

I currently work on a MVC 4.0 project that was upgraded to MVC 5.0 using the official guide.
I use Visual Studio 2012 locally and a publish profile was created for the project.
Locally I call msbuild via the Visual Studio developer command prompt using: msbuild /m /p:Configuration=Dev;DeployOnBuild=true;PublishProfile=Dev my-solution.sln
All projects in the solutions do have a Dev configuration and there is a web.dev.config.
The command line on the server is the same.
So far the difference is that on the server only the visual studio shell is installed (not the full) and we cannot install the full instance of VS2012 on the server.
Also, seeing on the install of TFS on the server, I discovered that only v9.0 target files were installed (Visual Studio 2008). Copying Visual Studio 2012 target files do not fix this problem.
I see 2 solutions so far but searching for a third.
Install full Visual Studio 2012 instance
Update csproj to include a target transformConfigFiles (basically copy and paste the content of the "Microsoft.Web.Publishing.targets" section) or import the file via a declaration inside of the .csproj
Would there be a third solution available?

It is pretty common to install full Visual Studio on your build server. As of VS 2012 you couldn't even run Unit Tests in your build without VS installed.
I'd suggest installing VS and seeing if that fixes the issue.

Related

"System cannot find the file specified" when adding a new Azure IoT Edge module in Visual Studio

I've followed these steps exactly and am getting the error below:
Select File > New > Project...
In the new project window, search for IoT Edge and choose the Azure IoT Edge (Windows amd64) project. Click Next.
In the configure your new project window, rename the project and solution to something descriptive like CSharpTutorialApp. Click Create to create the project.
In the Add Module window, configure your project with the following values:
Select Add to create the module.
I get this error regardless of the combination of solution folders, module names, and any other parameters that I enter during this workflow:
The system cannot find the file specified. (Exception from HRESULT: 0x80070002)
The net result is that no changes are made to the solution -- no IoT Edge module project is created, no other files are altered.
I've tried running Visual Studio 2019 (16.4.3) as administrator, uninstalling and reinstalling the Azure IoT Edge Tools extension, all without success.
What can I do to troubleshoot this further?
Update 1: I've double-checked all documented prerequisites and still have this issue.
Visual Studio 2019 16.4.3, all prerequisite Visual Studio workloads installed
.NET Core workload installed the latest -- 3.1 LTS SDK -- only. Is there a hidden dependency on a specific older .NET Core 2.x SDK somewhere? Or is the documentation for VS Code on the subject out of date? (I'm using VS but was looking everywhere to see if I had missed anything)
Git for Windows installed (via Visual Studio Installer)
Docker Windows Desktop installed & switched to Windows containers
Azure IoT Edge Tools for VS 2019 installed (and uninstalled & reinstalled)
no UNC/FQ paths in the item or project template locations:
C:\Users\larsk\OneDrive\Documents\Visual Studio 2019\Templates\ProjectTemplates
C:\Users\larsk\OneDrive\Documents\Visual Studio 2019\Templates\ItemTemplates
multiple reboots
this is on a machine that just recently got the latest (1909) version of Win10 Pro reinstalled on it.
Update 2: Updating to Visual Studio 2019 16.4.4 did not help either.
The solution turned out to be running a Repair operation through the Visual Studio Installer.

Where in the Visual Studio installer do I find the BuildTools component?

In which Workload of the Visual Studio 2017 Community 15.9 installation would I find the VS2017 BuildTools component?
I am looking at the workloads in the installer options and there seems not to be any workload that has such a thing.
I even searched in the component in the Individual Components tab also but couldn't find anything matching the exact string.
The reason I am looking for it is that when I try to build the source code for ASP.NET MVC v5.2.6, I get the error message as follows.
> build
Could not find MSBuild.exe. Please install the VS2017
BuildTools component or a workload that includes it.
*** BUILD FAILED **
I had written to the ASP.NET MVC team earlier about this message before I had installed Visual Studio 2017. I had had just Visual Studio 2019 then and they asked that I install Visual Studio 2017.
I already have MS Build at various locations. I had multiple versions of MSBuild even before having installed VS 2017.
Build Tools for Visual Studio 2017 is still available as an online installer. You can get the current version here: https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=BuildTools&rel=15.

F#, Visual Studio 2017 and dotnet new

To create a .NET class library from the command line, you can run the script
dotnet new classlib
Do that in a clean folder, and it will create a csproj file that can then be opened in Visual Studio 2017.
However, run the script
dotnet new classlib -lang f#
in a clean folder, and the fsproj file that is subsequently create cannot be opened in Visual Studio 2017. The error message reads
The imported project "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Sdks\FSharp.NET.Sdk\Sdk\Sdk.props" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.
I have searched for clarification of this issue, and it appears that there is work ongoing to fix it, but I wondered in the interim if there are any add-ins I can install to get this working immediately.
The latest preview releases of Visual Studio and .NET Core support loading .fsproj projects, apparently.
See this comment on the GitHub issue:
Closing this now, as these projects load with 15.3. The current way to use them:
Download VS 2017 Update 3 Preview 3 (or a further preview if it's released and you're reading this)
Download the latest CLI/SDK from here: https://github.com/dotnet/cli/tree/release/2.0.0#installers-and-binaries
(Yes, the .NET SDK is independent of VS. You will also need this to get .NET Core 2.0 support in VS 2017 Update 3 Previews).

Error: The imported project "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Default.props" was not found

I have migrated a VS2008 solution to VS2013. My solution contains VC++ projets.
I have set the tools platform to v120_xp for each project
My solution compile on my computer and compile on my builds server in VS2013
My builds server is a Windows2008 R2 with VS2008, VS2010 and VS2013 and a build controler of TeamFoundationServer 2010.
When i launch the build with the build controller, the build fails with :
The imported project "C:\Program Files
(x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Default.props" was
not found. Confirm that the path in the declaration is
correct, and that the file exists on disk.
In the V110 directory this file doesn't exist but it exist in the V120 directory.
I have checked the registry :
HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersion\12.0
the VCTargetPath are corrects
Have you an idea to help me?
I have edited the registry key
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\MSBuild\ToolsVersions\12.0\11.0
and
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\12.0\11.0
to use the V120 directory
Now my server build the solution, but i don't understand why MSBuild use the key
ToolsVersions\12.0\11.0 and not the key ToolsVersions\12.0\12.0
Parhaps it's due to the v120_xp platform toolset
The true answer is that MSBuild subtracts 1 from the .sln Visual Studio Version. Since you do not have VS 2012 install or you have not installed it, the v11.0 folder is not found. It is all explained by Sayed Ibrahim Hashimi:
http://sedodream.com/PermaLink%2cguid%2ca5894bad-f2a1-441a-a5b2-74f16c6cf8aa.aspx
I came across the same problem in 2015 though, with Windows 10 and Visual Studio 2015 RC (fresh install)
To correct the issue I tried several solutions based on my research ie installing "VS Windows SDK" which didn't do anything different to resolve my problem, I then on another recommendation installed GitHub in order to download MSBuild which is now excluded from VS, I ultimately downloaded and installed "VS Tools for Windows 10" this didn't give me the same error in the end, without having to change registry keys
Installing VS 2012 on your build server should create the necessary targets files for you.
I was able to get past this by changing $(VCTargetsPath) to $(VCTargetsPath12) in the project file.
This feels like a temporary workaround rather than a permanent solution, since once we move to the next version of Visual Studio we'll have to find all the references to $(VCTargetsPath12) and replace with the new target path.

What is required for doing Unit Tests on a Build Server?

I am doing unit tests (no additional frameworks other then what comes out of the box with VS 2013).
It all works locally. What do I need to do to get it working on the build server? The build server is a TFS 2013. There are no visual studio installed other then an 2010 version. I have already moved all the 4.5 .net stuff and .targets files from my visual studio to the build server to be able to compile 4.5 dlls and azure projects.
First I had problem with the build template was using AgileRunner or something thats coming with VS2013. I changed that to MSTest. Is this the correct change? Is there any installers for MSTest only without visual studio that I can install on the build server?
My boss prefers if I can avoid installing Vs2013 on the build server.
Just install Visual Studio on the build server; It is a very common practice. The requirement is mentioned in the installation guidelines. You can have visual Studio 2010 and 2013 installed side-by-side if that is desired. There are so many parts of .NET that depend on it.
Install Visual Studio and other software to enable compilation and other capabilities
You must install on the build agent the version of Visual Studio that your team uses on its dev machines. See Installing Visual Studio. You must also install any other software and components that are installed on your dev machines and that are required to build your app.
http://msdn.microsoft.com/en-us/library/bb399135.aspx#software
You're even allowed to use an existing license for the build server, so there are no additional costs involved if you own an MSDN subscription:
Using Visual Studio on the Build Server
If you have one or more
licensed users of Visual Studio Ultimate with MSDN, Visual Studio
Premium with MSDN, or Visual Studio Professional with MSDN, then you
may also install the Visual Studio software as part of Team Foundation
Server 2013 Build Services. This way, you do not need to purchase a
Visual Studio license to cover the running of Visual Studio on the
build server for each person whose actions initiate a build.
http://www.microsoft.com/en-us/download/details.aspx?id=13350
Is there a specific reason for you boss to not want Visual Studio to be installed?
With regards to the Agile Test Runner, it is the improved test runner that shipped with Visual Studio 2012, it's the replacement of the old MsTest runner, and will replace the old MsTest runner for the last few features for which the old runner is still needed. Though the MsTest runner will still work, certain features will not be as easy to use and confugure (like Code Coverage gathering). The Agile test runner is also required for other test framwork extensibility options, including XUnit .NET, NUnit, but also Javascript Unit Test support (using Chutzpah).
Other features that will require Visual Studio to be installed include:
Code Analysis
Code coverage
MsDeploy / WebDeploy
SQL Server Data Tools
and others.
As an alternative to get just the test runners, you could attempt to install the TFS Test Controller and Agent to the server (you don't need to configure them), the Test Agent will install a number of testing related features without actually installing the Visual Studio Shell.
By not installing Visual Studio on your build server, you are violating the license agreement with Microsoft. Although Microsoft themselves might build without installing Visual Studio on their build servers internally, this scenario is definitely not supported officially.
Building without installing Visual Studio is asking for undefined behavior and jeopardizing the integrity of your builds. I would suggest to stay clear from these attempts until Microsoft officially supports this scenario.
Microsoft strongly recommended not to build without installing Visual Studio when we asked as Gold Partner 2 years back as it was not supported in any way officially and there is no license model covering the scenario.

Resources