VS2010 complaining about Microsoft.VisualBasic dependency - vb.net

I've got a .NET solution that I've just upgraded from VS2008 to VS2010. It contains three web projects and two straight VB projects. The web projects all depend on (and have a reference to) one of the VB projects called BusinessLogic.
All projects are targeted at .NET 2.0, but VS2010 is raising the following build warning:
The following assembly has dependencies on a version of the .NET
Framework that is higher than the target and might not load correctly
during runtime causing a failure: BusinessLogic,
Version=1.0.4419.22315, Culture=neutral, PublicKeyToken=null. The
dependencies are: Microsoft.VisualBasic, Version=8.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. You should either
ensure that the dependent assembly is correct for the target
framework, or ensure that the target framework you are addressing is
that of the dependent assembly.
As far as I understand 8.0.0.0 is the correct version of VB for .NET 2.0, so why is this a warning? Is this something to worry about?

You have to go to menu Project|Properties and check the "References" Tab.
Check if the References you use are .NET 2.0 or higher.

Related

DotNet Core add dependecy in VS 2017

I have 2 simple projects one is in DotNet Core(lets say CoreProject) and the other one is in .net 4.5.2 (let's say OldCode). I was able to reference the projects but when I call the OldCode from the CoreProject I encounter the following error:
System.IO.FileNotFoundException occurred
HResult=0x80070002
Message=Could not load file or assembly 'System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
The system cannot find the file specified.
I have tried to add System.Configuration to the project but I don't know exactly to which file I should add it. I do not have project.json. Only config files that I have are: launchSettings.json and appsettings.json. I add System.Configuration with nuGet because it's an older version.
Where I should put the reference so when I run the command dotnet restore to add the dependency to System.Configuration?
At the moment, the .NET family looks something like this:
(Image is from .NET Core, .NET Framework, Xamarin – The “WHAT and WHEN to use it”)
When you create a project targeting one of the frameworks at the top (e.g. .NET Core), you can't use that project against other frameworks (e.g. .NET Framework). System.Configuration is an asset that specifically targets .NET Framework, and it doesn't exist in .NET Core.
On the other hand, you can write code that is compatible with all the frameworks (within limits - see compatibility chart to see how the versions map) by targeting .NET Standard, if your dependencies in turn target .NET Standard. This doesn't apply to System.Configuration, because that's .NET Framework-specific and does not target .NET Standard.
As an alternative, you can use the .NET Core Configuration Model (which, despite the name I'm using, actually targets .NET Standard and thus can be used in any framework). Or else you can use my very own .NET Settings Framework which is an abstraction that works with both the mature System.Configurationmodel (.NET Framework only) and the .NET Core configuration model (.NET Standard).

Script# and WF Xaml files in the same project, can't compile

We have a VS 2010 MVC3 project, targetting .NET 4.0 (machine has .NET 4.5), the project contains a WF Xaml file and related classes. We needed to access jQueryValidation on the serverside, so we added the script# jQueryValidation NuGet package (v 0.7.5.0), we get the following compile error without even using script# yet:
Error 1 XC1020: Build error occurred in the XAML MSBuild task: 'Could not load type 'System.Runtime.CompilerServices.ScriptAssemblyAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.....
The Xaml file contains references to the standard mscorlib, we've attempted to strong reference the Gac library in Xaml, via version #...however its to no vail. The project will only compile once we remove the Script# libraries. Then in an effort to narrow down the problem, we installed the nuget package for script# 0.7.5.1, not the jQueryValidation package, and we are able to compile. Installing the jqueryvalidation package afterwards will result in the same error as before, could this be related to the package being based on 0.7.5.0?
Any hints? we would really like to use script# jqueryvalidation and WF Xaml in the same project.
Thanks in advance.
Script# assemblies are meant to be used by script# projects only, i.e. those projects that contain c# code to be compiled into javascript. Your MVC project itself is not a script# project. Likely what you should be doing is creating a separate script# project, to generate script that gets deployed into/via your MVC project.
Specifically script# comes with its own mscorlib with script# specific types not present in the desktop mscorlib assembly.

error connecting F# to SQL

I'm trying to connect F# to SQL but when i build I keep getting this error
Warning 3 The primary reference "FSharp.Data.TypeProviders" could not
be resolved because it has an indirect dependency on the .NET
Framework assembly "FSharp.Core, Version=4.3.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" which has a higher version "4.3.0.0"
than the version "4.0.0.0" in the current target
framework. C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets 1360 9 ConsoleApplication33
Where can I find this version FSharp.Core 4.3.0.0? or is there any other solution?
Are you targeting .NET Framework 4.5? If you target .NET Framework 4.5 and create a new project, Visual Studio automatically makes a reference to FSharp.Core 4.3.0.0 which belongs to F# 3.0.
Somehow, you mistakenly added a reference to FSharp.Core version in F# 2.0 and .NET Framework 4.0. Therefore, first check Target Framework in Project Properties and then add FSharp.Core 4.3.0.0 using Reference dialog (notice there are various FSharp.Core versions).

Problems with builds on TFS 2010 and resolving dependencies

I have a project that works great on my machine (and production servers).
It's a VS2010 project running C#3.5.
When letting my build server build the solution it can't resolve a couple of my third party dll's.
Error message:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(1360,9):
warning MSB3268: The primary reference
"Third.Party.Assembly,
Version=50.11.2.0, Culture=neutral,
PublicKeyToken=0561a7c6dbd6f0ea,
processorArchitecture=MSIL" could not
be resolved because it has an indirect
dependency on the framework assembly
"Microsoft.VisualBasic.Compatibility,
Version=8.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" which
could not be resolved in the currently
targeted framework.
".NETFramework,Version=v3.5". To
resolve this problem, either remove
the reference "Third.Party.Assembly,
Version=50.11.2.0, Culture=neutral,
PublicKeyToken=0561a7c6dbd6f0ea,
processorArchitecture=MSIL" or
retarget your application to a
framework version which contains
"Microsoft.VisualBasic.Compatibility,
Version=8.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a".
[d:\Builds\3\mySolution.sln]
Everything compiles and runs great on my machine, but the build server seem to struggle.
I think the Third.Party.Assembly is written in VB.net.
Since the assembly is third party I can't remove the reference to "Microsoft.VisualBasic.Compatibility" and since I don't get any warnings on my computer could it really be that I'm running v3.5?
Any suggestions?
/Jimmy
If you put your project on the build server manually will it run? Based on the error message, I would make sure you have the latest .net framework installed on the build server machine and give it another try. If that does not work try installing VS2010 on the build server just to get the builds running until you find out just exactly what assemblies you are missing.
So, I was having this issue also on a VS2005 project that we upconverted... The issue is that MS has never had a 64-bit version of the VisualStudio.Compatability DLL. Our issue was that we were targeting 'Any' CPU and building on a new W2008R2 server so it was using the 64-bit version of the .NET 4.0 Multi-targeting pack.
In the build properties under the 'Process' tab under the '3. Advanced' there is a 'MSBuild Platform'. Change that value to "X86" and it might work... assuming of course you aren't depending on any 64-bit libs...

nservicebus compiler error "reference required to assembly nServicebus" in vb.net programs

I downloaded the nServicebus binaries as of May 17th and have two different vb.net projects (one in .net 3.5, the other in .net 4.0) that both have the error "Reference to Assembly nServicebus, Version 2.0.0.1145, culture=neutral, PublicKeyToken=9fc386479f8a226c containing the type NServicebus.IStartable. Add one to your project.
I have in the references already nServicebus.dll, nservicebus.Core.dll, and log4net.dll
This was resolved when I went to Build 1152