I tried to build a solution with a script which uses msbuild.
In VS 2017 it worked perfectly fine, but unfortunately after moving project to computer with VS 2019 I am unable to build it this way.
In few projects of solution I am seeing the same error.
Error MSB4062
: The "CheckPathAttributes" task could not be loaded from the assembly C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v16.0\Web\Microsoft.Web.Publishing.Tasks.dll. Could not load file or assembly 'Microsoft.Build.Utilities.Core, Ve
rsion=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' 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.
On your solution's folder, search for hidden .vs folder and delete the folder. Then open your VS 2019, open the solution, and do clean and rebuild.
Also looking at your error, it also may be caused by the fact that your script needs dependency to MSBUILD 15.0 but you are using VS 2019 and this means MSBUILD v16.0. I suggest you have to update your script as well.
Let me know if it works/solves your problem or not.
Related
I have a Visual Studio extension that we use internally that I'm in the process of updating for Visual Studio 2022. The extension worked fine in previous versions of Visual Studio, but I've had to follow several steps to get it building and running for VS 2022. I've gotten to the point where it will build and run, but I'm getting an error at run time when I'm trying to create a TFS ticket in the extension (which is the main point of the extension).
On this line:
projectCollection = new TfsTeamProjectCollection(url, cred);
I get:
System.IO.FileNotFoundException
HResult=0x80070002
Message=Could not load file or assembly 'Microsoft.TeamFoundation.Common, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
Source=Microsoft.TeamFoundation.Client
Searching around a bit, it seems that there is a version of that assembly at C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer, but apparently you aren't allowed to add that to your project. Because when you try, Visual Studio will complain that:
A reference to 'Microsoft.TeamFoundation.Common' could not be added. This component is already automatically referenced by the build system.
Further searching reveals that that assembly is also included with the Microsoft.TeamFoundationServer.Client Nuget package (that I did have referenced in the original version of this extension but it was since removed somewhere along the line), but installing that did not fix the problem either (not with the version that used to work in previous versions of VS, or with the latest version available on NuGet)
I suspect that the problem is that there is a version of this assembly that is loaded by Visual Studio itself and is conflicting with the version that the extension is built again. But trying to add a bindingRedirect to app.config hasn't worked for me either (although maybe I don't have the version I'm redirecting to correct?).
Does anybody know the correct way to resolve this conflict?
I am new to C# so it may be possible that I am not asking the right questions. Please bear with me.
I have a solution and within that solution is a project that is executing an SSIS package remotely. After some research I discovered that in order to do so I needed to create some references to DLLs that were "outside" of the GAC (General Assembly Catalog ?). The following assemblies were referenced:
C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Management.IntegrationServices\11.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Management.IntegrationServices.dll
C:\Program Files (x86)\Microsoft SQL Server\110\SDK\Assemblies\Microsoft.SqlServer.Management.Sdk.Sfc.dll
C:\Program Files (x86)\Microsoft SQL Server\110\SDK\Assemblies\Microsoft.SqlServer.Smo.dll
When I clean and build the solution from within Visual Studio 2015, everything builds fine. However when I call MSBuild on the solution from my deployment script, I get many errors saying that the references do not exist. For example, here is one of those errors:
"C:\TestModule\SSISTests\SSISTests.csproj" (default target) (10) -> (CoreCompile target) -> SSISTests.cs(78,17): error CS0012: The type 'Microsoft.SqlServer.Management.Common.ISfcConnection' is defined in an assembly that is not
referenced. You must add a reference to assembly 'Microsoft.SqlServer.ConnectionInfo, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91'. [C:\TestModule\SSISTests\SSISTests.csproj]
Is there an option I am not passing to MSBuild that would solve this problem? This is not a dependency issue (I don't think) because no other projects are needed by this project - just these SQL Server assemblies.
Open your csproj file and check to see if that DLL is correctly referenced. Also, see if you can run MSBuild against just the csproj and not the sln. Might be a pathing issue.
I am building a .net 4.5.2 application using Atlassian Bamboo. The build has been operating fine with dependencies on Telerik.Windows.Controls.Data for several weeks.
On a recent feature branch I have added a dependency on Telerik.Windows.Controls.GridView.dll version 2015.3.1104.45. Now the build is failing.
warning MSB3245: Could not resolve this reference. Could not locate
the assembly "Telerik.Windows.Controls.GridView,
Version=2015.3.1104.45, Culture=neutral,
PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL". Check to
make sure the assembly exists on disk. If this reference is required
by your code, you may get compilation errors. 24-Dec-2015 08:11:23
error MC3074: The tag 'RadGridView' does not exist in XML namespace
'http://schemas.telerik.com/2008/xaml/presentation'. Line 55 Position
18.
As is traditional when builds fail, I followed these triage steps:
Checkout the offending commit and test build on my workstation
If it "works on my machineā¢", log in to the build server and test build using the working directory that failed
I build both steps in the visual studio 2015 IDE. In this instance - both builds succeed. Frustrating! So I take to the command line and build the solution using the command line executed by Bamboo:
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.com" "SolutionNameRedacted.sln" /rebuild Release
This also succeeds!
I noticed the following line in the bamboo log:
24-Dec-2015 08:10:23
C:\Atlassian\Data\Bamboo\xml-data\build-dir\CS-CC13-JOB1>call
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
amd64 24-Dec-2015 08:10:23 '"C:\Program Files (x86)\Microsoft Visual
Studio 14.0\VC\vcvarsall.bat"' is not recognized as an internal or
external command,
This batch file is used to specify the compiler toolset. Is it a problem that it is not found? I always assumed compiler preferences were expressed by the project files. I have checked the Microsoft Visual Studio 14.0 directory and vcvarsall.bat does not exist anywhere.
The only significant change to the csproj file since it last built is the addition of this line:
<Reference Include="Telerik.Windows.Controls.GridView, Version=2015.3.1104.45, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL" />
I am at a bit of a loss as it is causing delivery to slip massively.
My current theory is that it is a user account issue and bamboo does not have access the to Telerik assembly it needs. My next steps are too:
References the assembly using clr-namespace in the xaml file that is breaking
Test the build on a user account with elevated permissions (sadly i don't have that kind of access)
As it turns out, Telerik do not install their binaries to the GAC. Visual Studio require a <hintpath> entry in the csproj file to help discovery. This path should be to you install directory.
Does this sound like a faff? It is abd I'm not terribly impressed. Thankfully the Telerik VS Extension will add the reference and hintpath for you. My recommendation is to always use this wizard.
The downside - all of your developers need the Telerik library installed in the same folder. I'm pretty sure you can manually register binaries with the GAC to skirt this.
In Visual Studio 2012 I have Slow Cheetah version 2.5.10 installed. When building an app that uses Slow Cheetah, the build fails with the following error:
Error 1 The "SlowCheetah.Xdt.TransformXml" task could not be loaded
from the assembly
C:\Users\MyActiveDirectoryAccount\AppData\Local\Microsoft\MSBuild\SlowCheetah\v2.5.10\SlowCheetah.Xdt.dll.
Could not load file or assembly
'file:///C:\Users\MyActiveDirectoryAccount\AppData\Local\Microsoft\MSBuild\SlowCheetah\v2.5.10\SlowCheetah.Xdt.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. C:\Users\MyActiveDirectoryAccount\AppData\Local\Microsoft\MSBuild\SlowCheetah\v1\SlowCheetah.Transforms.targets
When navigating to this directory, I can see the Slow Cheetah files, but the SlowCheetah.Xdt.dll file is missing.
C:\Users\MyActiveDirectoryAccount\AppData\Local\Microsoft\MSBuild\SlowCheetah\v2.5.10\
To triage this, I've:
Rebooted
Un-installed and re-installed Slow Cheetah
Clean and rebuild
None of the above fixed the problem. Any guidance would be appreciated. Thanks!
The answer is in one of the Q & A's (by zendu)
Copy the files from
%APPDATA%..\Local\Microsoft\MSBuild\SlowCheetah\v1.
to
%APPDATA%..\Local\Microsoft\MSBuild\SlowCheetah\v2.5.10.
List of files:
Install-Manifest.xml
Microsoft.Web.XmlTransform.dll
SlowCheetah.Tasks.dll
SlowCheetah.Transforms.targets
SlowCheetah.Xdt.dll
Source
Also see this related question
The "SlowCheetah.Xdt.TransformXml" task could not be loaded from the assembly
I had the same problem with Visual Studio 2010. I just install the SlowCheetah nuget package (install-package SlowCheetah) and after that the build succeed. The nuget package set up correctly the slowcheetah task in your solution.
SlowCheetah nuget Package
I have this problem:
Error 23 The "AssemblyInfo" task could not be loaded from the assembly AssemblyInfoTask, Version=1.0.51130.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35. Could not load file or assembly 'AssemblyInfoTask, Version=1.0.51130.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, and that the assembly and all its dependencies are available. CustomActions
Any sugestions?
Update #1 The Problem was ocured after copying project from SVN in my PC. Project is written in VS 2005. And I have installed VS 2005.
Update #2 Having installed SP1 for VS2005, It is still not working.
Update #3 I have changed lines in project file like this**
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- <Import Project="$(SolutionDir)eService.VersionNumber.targets" />
-->
and it starts to work. So, as I see, the problem was in the eService.VersionNumber.targets file. All is working in another PC and the files exist.
Try go to solution explorer in Visual Studio, then open the references folder.
There you should find AssemblyInfoTask with a warning sign next to it.
Click the AssemblyInfoTask reference and check the properties window. There you can find the path where Visual Studio looks for the assembly.
Either make sure the AssemblyInfoTask assembly is where Visual Studio is looking, or remove the reference and add it again with a new correct path.
If this is an project reference you need to make sure that project is in your solution and that the build order is correct.