TFS 2010 build error - imported project "project_path" was not found - msbuild

Have been trying to build a solution which contains a number of projects and keep getting a recurring error.
I have managed to get the build to partially succeed but always get the error shown below:
C:\Builds\1\MBS.Payments.Forms.Mvc\MBS Payment Forms MVC\Sources\MBS.Payments.Forms.Mvc\MBS.Forms.Payments.Web\MBS.Forms.Payments.Web.csproj (979): The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.
I have navigated to the file in which the error is being generated where this code is highlighted:
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
Currently I have both Visual Studio 2010 Premium and a evaluation version of Visual Studio 2012 Ultimate installed, I am currently working on this application in Visual Studio 2010.
below is the code block in which the erroneous code is found:
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
Please could anyone advise on why this error is being generated and how it could be resolved.

Check the two locations:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications
and
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\WebApplications
Do either of these have the .targets file present? Personally I find it in both, but I'm guessing you don't (at least according to the error it's not in the v11.0 folder).
Your condition checks for VisualStudioVersion and VSToolsPath properties to see if they are missing, then sets them. One or both of these must be set already or it would be pointing to the v10.0 folder.
According to http://blogs.msdn.com/b/webdev/archive/2012/08/22/visual-studio-project-compatability-and-visualstudioversion.aspx, this is probably caused by opening the project in VS2012.
To fix, I'd either get a v11 copy of the .targets (there are some changes between the two from what I can see, maybe it wasn't correctly installed when you did the setup?) or revert to using the v10 version.

If using Visual Studio 2013 or newer and TFS 2010, you can edit your Build Definition to include a new MSBuild argument.
/p:VisualStudioVersion=10.0

As CryoFusion87 pointed out, the solution that worked for me was to remove the whole <PropertyGroup></PropertyGroup> tag and its content.
This tag is added to support opening projects from VS 2010 and VS 2012. See more in here: http://sedodream.com/2012/08/19/VisualStudioProjectCompatabilityAndVisualStudioVersion.aspx
I am now using VS 2013 and this is not needed.

the <PropertyGroup></PropertyGroup> tag gets added to the project file when you open it in Visual Studio 2012, I was able to open the project file in a text editor, remove the PropertyGroup and it built successfully

Related

Why does Visual Studio 2022 display an error message when editing dependencies "String value ' ' cannot be translated to any value from System.Guid."?

I have a project which I am using as a simple testbed for a graphical application. I am attempting to add a shared project file (.shproj), but whenever I try to edit the project's dependencies, I get a dialog which says:
---------------------------
Microsoft Visual Studio
---------------------------
String value '
' cannot be translated to any value from type System.Guid.
---------------------------
OK
---------------------------
This happens if I right-click on my project and select either **Add Project Reference..." or "Add Shared Project Reference..."
Unfortunately I do not have this project as part of source control so I can't go back in time to see what may have caused this problem. I have attempted to undo the operations which may have gotten me into this state (such as adding the .shproj to my solution) but the dialog still appears when I attempt to edit the dependencies.
I haven't been able to find anything online about this error, and I suspect it's happening because something is malformed in either my .csproj or the .sln, but I'm not sure where to look or what to try to solve this.
I am running Visual Studio 2022 (17.4.2).
I have tried opening the project in Visual Studio 2019 and I can edit the dependencies there. I can also add and remove nuget packages. Note that if I modify the dependencies in Visual Studio 2019, the project will correctly load and build in 2022 so I do have a workaround. However, it would be nice to know why the project dependencies cannot be edited in 2022.
It turns out that empty Project tags caused problems in the .csproj file.
My .csproj file referenced other .csproj files and these references included empty Project tags.
Here is a snippet before the fix:
<ProjectReference Include="../../../GitHub/FlatRedBall/Engines/FlatRedBallXNA/FlatRedBallDesktopGLNet6/FlatRedBallDesktopGLNet6.csproj">
<Name>FlatRedBallDesktopGLNet6</Name>
<Project>
</Project>
</ProjectReference>
Removing the Project tags solves this problem, as shown in the following code:
<ProjectReference Include="../../../GitHub/FlatRedBall/Engines/FlatRedBallXNA/FlatRedBallDesktopGLNet6/FlatRedBallDesktopGLNet6.csproj">
<Name>FlatRedBallDesktopGLNet6</Name>
</ProjectReference>

MSBuild Error after upgrading TeamFoundation dlls to 2017

So, we were using 2013 TFS dlls in our projects (namely TeamFoundation.Client, TeamFoundation.VersionControl.Client, and TeamFoundation.Common). I recently upgraded the project to use 2017 versions of the above mentioned dlls (We have VS2017). I am getting them from the below folder.
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer
After upgrading, when I build my solution, I get the following error:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\Microsoft.NET.Build.Extensions\Microsoft.NET.Build.Extensions.NETFramework.targets(56,5): warning : Resolved file has a bad image, no metadata, or is otherwise inaccessible. The system cannot find the path specified. (Exception from HRESULT: 0x80070003)
I am not familiar with MSBuild so not sure how to proceed.
The error takes me to the following line in the MSBuild code:
GetDependsOnNETStandard Condition="'$(_RunGetDependsOnNETStandard)' == 'true'"
References="#(_CandidateNETStandardReferences)">
<Output TaskParameter="DependsOnNETStandard" PropertyName="DependsOnNETStandard" />
</GetDependsOnNETStandard>
There is an outstanding issue with Visual Studio 2017 and DependsOnNETStandard that should hopefully be resolved in 15.8
I just encountered the same problem today when upgrading a project that was originally created VS 2015 and upgraded to VS 2017.
It looks like the upgrade of the projects misses a few elements in the XML that it needs.
If you edit the csproj files of the effected projects and add
<DependsOnNETStandard>false</DependsOnNETStandard>
to the top PropertyGroup like so:
<PropertyGroup>
...
<DependsOnNETStandard>false</DependsOnNETStandard>
</PropertyGroup>
It should resolve the issue. It did for me.
Details of the issue and discussion around it can be found at:
https://github.com/dotnet/sdk/issues/1544
According to your error log info, seems you are trying to build locally through Visual Studio or MsBuild command not TFS build.
Suggest you to use the latest version of dlls, Microsoft.TeamFoundationServer.Client and also upgrade your Visual Studio 2017 to latest version. For The system cannot find the path specified. issue try to
Clean All Projects.
Unload All Projects
Reload All Projects.
ReBuild Solution
Another way is :
Close the solution
Delete bin folder
Delete all obj folders
Open solution and build
If all of above still not work, suggest you add a more detail log and sample code for troubleshooting.

Can Orchard 1.8.x be installed on a build server that does not have Visual Studio Installed?

I also asked this question on the Orchard forum but no joy there yet. So here it is again...
https://orchard.codeplex.com/discussions/569444 Please read for a few more details.
IF the .NET 4/4.5 SDK came with a developer command prompt (like previous SDKs) then I would not be asking this question.
But since Orchard is build with .NET 4.5 I am getting build errors using the old SDK. It seems that my only option is to install Visual Studio Express on the build server.
I am doing that as we speak so at this point the question is purely academic but I am still curious.
EDIT
STILL NO JOY. Even after installing VS 2013 Express Web the vcvarsall.bat that usually configure the build environment is still not present. So this is no longer a curiosity question. The Express edition also cannot create my build environment. Help.
Seth
Here is my answer...copied and pasted from the forum.
This is a late answer. Bottom line is that I did eventually get our build server to build orchard projects. I am not sure if this is a complete answer or not as I should have answered as soon as I had it done. But I pretty sure this will work.
One other thing to note...It is quite possible that not all of these steps are required. I tried a lot of different things and it might be in the end some of the steps were not needed. It might also reflect a problem on our build server...especially the fact that I had to manually add registry entries.
But here it is without details.
Install the .NET Framework SDK for Windows 7.1.
http://www.microsoft.com/en-us/download/details.aspx?id=8279
Install the .NET 4.5 Full
http://www.microsoft.com/en-us/download/details.aspx?id=30653
Install Visual Studio 2013 Express for Web
http://www.visualstudio.com/en-us/products/visual-studio-express-vs.aspx
Install the Visual Studio 2013 Build Tools
http://www.visualstudio.com/en-us/products/visual-studio-express-vs.aspx
Finally, even after that...it didn't work until I added the following registry keys. I would attach the .reg file but I don't see how.
Save the lines between the lines into a fixBuild.reg file. Then double click...
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VC7]
"FrameworkDir32"="C:\Windows\Microsoft.NET\Framework\"
"FrameworkDir64"="C:\Windows\Microsoft.NET\Framework64"
"11.0"="C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\"
"FrameworkVer32"="v4.0.30319"
"FrameworkVer64"="v4.0.30319"
"12.0"="C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\"
Finally, to actually do the build, I created a batch file that does the build.
Save the lines between the lines into a doBuild.cmd file. Be sure to place this in the root of the source download...then double click to build...
call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\VsDevCmd.bat"
msbuild /t:FastBuild Orchard.proj
The first line gets your environment ready. The second build the project using the FastBuild target in the Orchard.proj file. You can read that file if you want to try other build targets.
******* EDIT
There is one thing I forgot to mention. And that is that one thing you have to do to get this to work is that you have to edit some CSPROJ files because the command line build fails with errors like these...
\Orchard\src\Orchard.Web\Modules\CKEditor\CKEditor.csproj(337,6): error : "None" element name for include "Placement.info" should be "Content".
\Orchard\src\Orchard.Web\Modules\Orchard.Tokens\Tests\Orchard.Tokens.Tests.csproj(82,6): error : "None" element name for include "app.config" sh
\Orchard\src\Orchard.Web\Modules\TinyMceDeluxe\TinyMceDeluxe.csproj(377,6): error : "None" element name for include "app.config" should be "Cont
\Orchard\src\Orchard.Web\Modules\Upgrade\Upgrade.csproj(156,6): error : "None" element name for include "app.config" should be "Content". [C:\Us
\Orchard\src\Orchard.Web\Themes\Themes.csproj(280,6): error : "None" element name for include "Upward\Views\Content-Story.Detail.cshtml" should
The fix is to do exactly what the error indicates. Open the csproj files and search/replace "
Also, some of the projects reference app.config files that do not exist in source. You also have to remove those references. I usually just delete the content node entirely or the group entirely.
Seth

TransformXml could not be loaded

I have a old solution which worked fine with VS 2012 and now I migrate it to VS 2013.
When I try to build a configuration which involve web.config replacement i got this error:
Error 1 The "TransformXml" task could not be loaded from the assembly C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web\Microsoft.Web.Publishing.Tasks.dll. Could not load file or assembly 'file:///C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web\Microsoft.Web.Publishing.Tasks.dll' or one of its dependencies. The system cannot find the file specified. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.
What it mean is that there no build tools in my v11.0 which is right. Because I use Visual Studio 2013. (the build tool are in a folder called v12.0) One option is to just copy my build tool to the right place but im searching for a real solution.
I found in my .csproj file these config:
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
But im not really understand why it then v11.0 could be. I have tried multiple things to change these like set VisualStudioVersion explicit but it changed nothing.
So my question: where the heck come these path from and where can I configure it?
Since vs2012 MS tries to keep sln file untouched if there is no reason to upgrade it (to allow opening sln in the old VS).
If you’ve upgrade from vs2012 to vs2013 there can be chance you are opening solution in vs2012 (it happen to me in many updated solutions).
Try to check beginning of the sln file
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
or:
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
If you wish to change it by VS, open sln in vs2013 and then select solution root node in solution explorer and the File > Save .sln (Ctrl+S)

Web.config is being renamed by msbuild

I am using VS 2013 to build a webservice. When it is built, the Web.config file is being renamed "{projectname}.dll.config".
There is a step, _CopyAppConfigFile where it gets renamed, showing in the Output window. I can work around this, by setting the web.config to be copied always, this results in two files, web.config and x.dll.config, which I can live with, but I'd like to avoid it completely if anyone knows how.
EDIT: Looks like this is a result of a MSBuild file, located at:
C:\Program Files\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets
I can recreate this in a default install of Visual Studio 2013 in a C# ASP.NET MVC project. I noticed it because I am starting to transition to Visual Studio 2013, but our build server is still on Visual Studio 2012; our setup project was failing after one of my commits because the superfluous config file that I had harvested on my machine was not being generated on the build server.
This appears to be a discrepancy between the way things worked in the previous version of MSBuild 4.0 / Visual Studio 2012 and the new version MSBuild 12.0 / Visual Studio 2013.
In Visual Studio 2013, the $(ProjectConfigFileName) property is initialized to Web.config [1], which is copied to $(AppConfig) [2], which causes _CopyAppConfigFile to run [3], resulting in an unnecessary config file being named and copied over to the bin directory.
In Visual Studio 2012, the process is similar, except that its version of Microsoft.WebApplication.targets is missing this part that's in the 2013 version:
<!-- Instruct ResolveAssemblyReferences in MS.Common.targets to generate suggested binding redirects. -->
<PropertyGroup>
<AutoUnifyAssemblyReferences>false</AutoUnifyAssemblyReferences>
<AppConfig Condition="'$(AppConfig)' == '' And Exists('$(ProjectConfigFileName)')">$(ProjectConfigFileName)</AppConfig>
</PropertyGroup>
The key is that AppConfig line. Since that AppConfig reference is missing in the 2012 version, then _CopyAppConfigFile doesn't run under Visual Studio 2012, resulting in the intended behavior (i.e., the file is not copied).
In Visual Studio 2013, it looks like they added this line so that the build process could offer to fix up binding redirects for you by double-clicking on them in the Errors list in Visual Studio. When Microsoft added this, it seems no one noticed that it resulted in an extra config file being generated and copied to the output folder. So it seems to me as if it is a bug (but a mostly harmless one, since the config file is superfluous) in the new build process in Visual Studio 2013. Since it was conflicting with the Visual Studio 2012 build process on my build server, I added an extra post-build step to blow away the extraneous file:
<Target Name="AfterBuild">
<Delete ContinueOnError="true" Files="$(TargetPath).config" />
</Target>
And then you can feel better knowing that it's not a problem with your particular project or system setup, it's just the way Visual Studio 2013 does things now.
File locations referenced above:
[1] C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.Publishing.targets
[2] C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\WebApplications\Microsoft.WebApplication.targets
[3] C:\Program Files (x86)\MSBuild\12.0\Bin\Microsoft.Common.CurrentVersion.targets
I think you have the wrong project type. Did you create it as a web project? Is this in your csproj file?
{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}
From
http://www.mztools.com/articles/2008/mz2008017.aspx
349c5851-65df-11da-9384-00065b846f21 = Web Application
fae04ec0-301f-11d3-bf4b-00c04f79efbc = C# Project
Hth,
Ojf