Confirm that the <UsingTask> declaration is correct - build

We have downloaded a project from TFS and after restoring Nuget packages we are getting below error:
Error 5 The "ValidatePackageReferences" task could not be loaded from the assembly projectPath\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.Tasks.dll. Could not load file or assembly 'file:///projectPath\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.Tasks.dll' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> 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. projectName
We have not used Task anywhere. It seems it is being used internally. Any pointer how to get rid of this error?
Mostly it looks like its because of wrong version of NuGet package. But not sure whats root cause.
We are using VS 2013 Update 5 version.

First search "Microsoft.Bcl.Build.Tasks.dll." nuget on google. Then a link will be opened with named "https://www.nuget.org/packages/Microsoft.Bcl.Build/". Then copy the package name shown on the site like this
Install-Package Microsoft.Bcl.Build -Version 1.0.21
Then Open the Visual studio , Goto Tools>Nuget Package Manager>Package manager console. Now paste the copied install package,Install it. Then restart the VS.Issue will be solved.

Related

Dependency injection error pops up whenever I try to install a certain Discord Package

I'm really new to programming, but I felt like trying out some bot-development for my discord server, like one that will occasionally say hello to people when they join, however when I tried to install one of the Discord packages I got this error
Unable to resolve dependency 'Microsoft.Extensions.DependencyInjection'. Source(s) used: 'discord.net', 'Microsoft Visual Studio Offline Packages'.
Unable to resolve dependency
'Microsoft.Extensions.DependencyInjection'. Source(s) used:
'discord.net', 'Microsoft Visual Studio Offline Packages'.
This error message always occurs when you want to install the package whose dependency package is not found. For example, I created a custom package(MyCustomPKG) that depends on Microsoft.Extensions.DependencyInjection.
And now I'll get the same issue if nuget can't find the Microsoft.Extensions.DependencyInjection in all available package sources.
To resolve that issue:
Add nuget.org(https://api.nuget.org/v3/index.json) as package sources and make sure the checkbox is enabled.
In addition: If you're not using VS IDE, instead you're using Nuget.exe+Nuget.config file, add this line(<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />) to Nuget.config.

VSTS feed "refresh" mechanism in Visual Studio

I have set up a VSTS nuget feed. And I have pushed some packages two days ago. I was able to add those packages to my project. But I needed to push an other version for one of them. Made new nupgk version, pushed it and I can see it in VSTS, I can download it from there, Visual Studio 2017 is also listing it correctly but when I try to install it, I am getting an error:
Package 'whatever 1.0.1' is not found in the following primary source(s): 'https://whatever.pkgs.visualstudio.com/_packaging/feedname/nuget/v3/index.json'. Please verify all your online package sources are available (OR) package id, version are specified correctly. 0
What I have tried:
- waiting around 10 minutes
- restarted Visual Studio several times
- pasting the above url into a browser and refreshing it manually several times
One or more of these helped. But I would like to know if there is any canonic solution for that.
I used the answer widget to have some formatting. Still, this might not be "the" answer, as I don't know the mechanism beyond. But it looks to be a workaround.
Steps:
Create a solution with a library project (let's call it L01)
Add another library project to the solution (let's call it D01)
Make a nuget package from L01 (version 0.0.1)
Push the package to your VSTS feed
Manage packages for project D01 and browse your feed
Package L01 v0.0.1 will be listed
Add it to project D01, it will work
Edit L01 nuspec file and change version to 0.0.2
Build and push the new package
Go back to project D01 and refresh the package list. The update will be shown.
Try to update. It will fail with the error message from my question.
Now go to folder %localappdata%\NuGet\v3-cache (or equivalent)
Locate the folder corresponding to your feed and open it
Locate list_l01.lib_index.dat (where l01 is the package name) and delete it
Go back to project D01 and try to install the update. It will succeed.
Would be good if others could confirm. I have reproduced this several times.
Seems you are trying to download the package or packages that where just freshly pushed to VSTS nuget feed.
Since Visual Studio 2017 is listing it correctly, then the issue should not related to the feed on VSTS server.
If this occurs very recently(download the new refresh package) and your package is very large, this maybe a network delay. Suggest you use a fiddler trace when this issue happens again. This makes "some" sense, what you see is probably an incorrect propagation of pushed packages showing up in the search results but not yet available to download.
And some other also encounter the same issue and error as you.
FYI, I've been seeing this exact issue in the past month or so.
Switching between sources, uninstalling and reinstalling are some work
arounds, but not 100%. Pushing my own packages up to VSTS and then
it takes like 15 minutes to finally get it to install.
More details please take a look at this similar issue Package update not found when updating via Visual Studio Solution

NuGet package version is ignored when building

I am using VS 2017. I have this line in my packages.config file.
<package id="System.IdentityModel.Tokens.Jwt" version="4.0.4.403061554" targetFramework="net461" />
I got this error my trying to start my .net application.
System.TypeLoadException: Could not load type 'System.IdentityModel.Tokens.NamedKeySecurityKeyIdentifierClause' from assembly 'System.IdentityModel.Tokens.Jwt, Version=5.2.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
Because System.IdentityModel.Tokens.NamedKeySecurityKeyIdentifierClause really does not exist in version 5.2.1.0. But it seem NuGet simply ignores the version specification, and always loads the latest version.
I have tried to clean NuGet caches, clean and rebuild entire solution, and restart computer...
Is there anything else I can do?
Update
One strange thing I observed in VS 2017. Notice the differences of the icons for System.Data and System.IdentityModel.Tokens.Jwt. When I try to check the properties of the latter, VS says the package is not installed, which it clearly did. The build went successful, but the application just wont load the right version.
There are a couple of steps you can perform to check that the right version is loaded:
Rebuild your solution to make sure all NuGet packages are restored and that the started application is up to date (You already did that).
Check the tag HintPath for the reference in the project file that references the package. Just open the file in a text editor and look for an XML tag starting with <Reference Include="System.IdentityModel.Tokens.Jwt. Make sure that no version-specific reference is set or that the version matches the version in the packages.config file.
Check in the properties of the according reference in Visual Studio that it is resolved correctly. That means, there must be no yellow exclamation-mark icon on the reference in the solution explorer and in the properties of the reference, the Path entry must point to the installed package. Hence, the path should point to the packages directory inside your solution directory and therein into a directory System.IdentityModel.Tokens.Jwt.4.0.4.403061554.
In most cases (from my experience), there is some mismatch between the reference in the packages.config file and in the project file. If that does not help, make sure that no other module is loaded by your application that has a reference to System.IdentityModel.Tokens.Jwt in version 5.2.1.0.
So far, it is still unclear why VS cannot handle the changes of the NuGet packages, and why it thinks my project is using both .Net Framework and .Net Standard at the same time. I bet it is a but in VS, and hope MS can fix it soon.
Before that, installing Rider and use it to fix the packages, then went back to VS, and everything went back to normal.

Visual Studio 2013 - Qt5 - Gstreamer: "libgstreamer-0.10-0.dll is missing from you computer" even though I correctly installed Gstreamer

A similiar question was already asked on stackoverflow, yet nobody answered, so I'm asking again.
I followed all steps in http://docs.gstreamer.com/display/GstSDK/Installing+on+Windows
Therefore, I believe that I correctly installed Gstreamer SDK + Devel on my computer. I followed the steps to set the enviromental variable: GSTREAMER_SDK_ROOT_X86_64
On Visual Studio I created a new Qt5 project, I set up the property sheet for gstreamer, yet when I run my application (still a basic Qt app with gst_init called) an error occurs saying:
The program can't start because libstreamer-0.10-0.dll is missing from your computer.
Some say that the dll must be in Windows/System32 or SysWOW64 yet there is no such file there. That dll is by default found in gstreamer_root_sdk_folder/bin.
When you run your app out of your develop environment (directly by clicking .exe generated file) you have to emplace your dlls in the same folder where your app.exe file is, unless you compile it with static libraries.
You have to look for libstreamer-0.10-0.dll in the Gstreamer SDK install folder (gstreamer_root_sdk_folder/bin as you pointed out), then copy and paste it in the same folder where your app.exe file is. Try to run again.
Maybe you will have to add some missing dlls after solve this. You can do it by following the same process for all the missing ones.

How to build a VS2010 C++ Project on a BuildServer

I've a .NET Solution with a managed C++ assemlby Targeting .NET 3.5 created with VS2010. The command:
%windir%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe MyProject.sln
compiles the solution on my dev machine.
On my BuildServer I get this error:
Build FAILED.
"F:\CruiseControl.NET\Projects\MyProject\MyProject.sln"
(default target) (1) ->
"F:\CruiseControl.NET\Projects\MyProject\MyProject\MyProject.csproj"
(default target) (2) ->
"F:\CruiseControl.NET\Projects\MyProject\MyProjectMAPIHelper\MyProjectMAPIHelper.vcxproj"
(default target) (3) ->
F:\CruiseControl.NET\Projects\MyProject\MyProjectMAPIHelper\MyProjectMAPIHelper.vcxproj(23,3):
error MSB4019: The imported project
"C:\Program
Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.Cpp.Default.props"
was not found. Confirm that the path
in the <Import> declaration is
correct, and that the file exists on
disk.
0 Warning(s)
1 Error(s)
On my dev machine the claimed file
"C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.Cpp.Default.props"
exists. On my build server not.
When I try to copy this files (and all others in the same directory) other errors occurred. So this is the wrong way.
EDIT: other errors means: When I copy the file "Microsoft.Cpp.Default.props" on the build server, MSBuild is claiming other files. That shows me, that just doing a copy of missing files is not what the build environment is expecting. I am looking for an MSI/whatever package that I could install on my build server and any C++ Project will build. Installing the SDK did not the trick. Or I did something wrong during SDK installation. Or it is not possible to compile Managed C++ VS2010 Solutions just with the SDK.
I believe that "other errors" has nothing to do with my problem. My Problem is: "How do I setup my build environment correctly". /EDIT
What I've done till now:
I have installed the latest Win7 SDK (Link)
I am targeting .net 3.5
I've tried playing with the Platform Toolset Property - but it was just playing
In my solution there is a managed C++ Assembly (my Problem)
I am using MSBuild 4.0 because the new VS2010 project files cannot be compiled with MSBuild 3.5
I am using CC.NET. compilation fails in CC.NET and on the command line. So it should not be a CC.NET issue.
Are there any tips and tricks how to configure my project properly to compile on my dev machine with VS2010 and on my build server? Is there anything more to install (except VS2010)?
Thanks, Arthur
For now, installing VS 2010 is your only safe option. The Windows SDK will be updated to enable your scenario, but I don't have a specific release date. Until then, you'll need to install VS 2010 with the C++ tools in order to build your 2010 solution with C++ projects. Make sure you let the C++ team know about how dissatisfaction with this situation via their team blog and/or MSDN Forum.
Even after installing VS 2010, you may need to invoke the appropriate vcvars*.bat file to setup your environment variables correctly.
Why don't you want to install VS2010 on your build server? If it's licencing, it's licenced per developer head not per install so I'm reasonably sure you are allowed to without buying another copy - or, at worst, you can install the express version which ought to at least install the config bits you're missing so you can use the platform SDK compiler.
If you're still having problems with msbuild you can then use devenv.com /build which exactly replicate the VS build env.
You may try those links:
http://social.msdn.microsoft.com/Forums/en-US/tfsbuild/thread/9055ca52-586b-459f-9dd1-a9d052d076b9/
or
http://msdn.microsoft.com/en-us/library/ee662426.aspx