Which Microsoft.AspNet.WebApi DLLs to use - c#

If I create a blank project in VS 2013, I can add DLLs like System.Web.Http or System.Net.Http.Formatting from my local machine. These shipped with (or were automatically updated by) Visual Studio. But the version seems to be 4.0.0.0 even though I have all updates applied. Alternatively, I can get these DLLs from NuGet where the version is 5.2.0.0.
Other than "what the heck is going on?" - I guess my question is, why are my local files out of date if I have all updates applied?

Asp.NET is no deployed by Nuget packages. By default VS have included MVC 4, but MVC 5 is available. That is way your local files were upgraded.

Related

Error CS1703 Multiple assemblies with equivalent identity have been imported while building the Enterprise Bot Framework project

I got the below error while building the Enterprise Bot Template Project in VS2017. Not sure what i 'm doing wrong here.
Severity Code Description Project File Line Suppression State
Error CS1703 Multiple assemblies with equivalent identity have been imported: 'C:\Users\XXX.nuget\packages\microsoft.netcore.app\2.1.0\ref\netcoreapp2.1\System.Runtime.Serialization.Json.dll' and 'C:\Users\XXX.nuget\packages\system.runtime.serialization.json\4.3.0\ref\netstandard1.0\System.Runtime.Serialization.Json.dll'. Remove one of the duplicate references. SovereignBot C:\Users\XXX\Documents\Visual Studio 2017\Projects\SovereignBot\SovereignBot\CSC 1 Active
Any ideas how to fix?
I'm not able to replicate this issue with a fresh install of the Enterprise VSIX template. This leads me to believe the issue is either in your code or on your machine.
After researching, it appears there could be a couple of problems and solutions:
Your Local/Development and Build servers use different versions of Visual Studio
Update Visual Studio for both environments
If you're still experiencing issues, try installing the Microsoft.CodeDom.Providers.DotNetcompilerPlatform NuGet package.
NuGet or .NET Core is out of date
Update NuGet
Update the appropriate .NET Core SDK. Currently, Bot Framework is supported well on .NET Core 2.2. Keep in mind that if you have 2.2 installed, you may need to update to the latest sub-version (v2.2.104, as of now). Keep in mind you may also need to upgrade your NuGet packages within the project in order to be compatible to the .NET Core SDK.
Ensure your bot is using the correct .NET Core Target Framework by right-clicking the Project > Properties > Application:
Your Visual Studio version doesn't handle dependency version collisions on its own
Update your Visual Studio
You have a duplicate reference to the same package (but possibly different versions) in your .csproj file
This is more likely if you're using code brought in from another project.
Delete or comment out the duplicate by right-clicking on your Project in Visual Studio, and clicking Edit .csproj:
You have a package installed via both NuGet and locally
(I don't believe this is the issue for you, since both of your packages appear to be in the NuGet directory)
Go to the file path of one of the dependencies and delete it.

How to install WebPages v1.0

I have a web app that uses DLLs from this folder:
C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0
Lately, my HD crashed and I had to reinstall everything, but I've installed the latest version of Visual Studio.
I have tried installing every MVC version that exists (I now have version 1 to 3 installed and MVC 4 runtime) and still I get no v1.0 folder (only a v2.0).
My guess is that this came with an older version of Visual Studio or that MS has changed something on their MVC 1,2,3 installers and they don't include this package of DLLs.
Does anyone know how can I install all the files that v1.0 folder usually holds?
I have tried installing separate DLLs from it using nuget, but things got worse with mixed DLL versions.
OK. Here is what I have done:
I first installed AspNetMVC3ToolsUpdateVS11Setup.exe from here:
https://www.microsoft.com/en-us/download/details.aspx?id=1491.
This will add the v1.0 folder. This seems to be an old version, but that's the best I could find...
And then an installer called AspNetMVC3.msi, which I think came from here:
https://www.microsoft.com/en-us/download/details.aspx?id=44533
After that, it seemed working OK. :)

the type from assembly is built with an older version of blend sdk and is not supported in a windows presentation foundation 4 project

I created a WPF project in VS 2013. After upgrading to VS 2015, this error showed in the designer on types derived from the Blend SDK:
the type from assembly is built with an older version of blend sdk and
is not supported in a windows presentation foundation 4 project
Run Command Prompt as Administrator
Change Directory to Blend SDK: cd C:\Program Files (x86)\Microsoft SDKs\Expression\Blend\.NETFramework\v4.5\Libraries\
Register DLL: gacutil -i System.Windows.Interactivity.dll
Restart Visual Studio
Reference: https://connect.microsoft.com/VisualStudio/feedback/details/755407/xaml-designer-will-not-display-when-using-blend-sdk-behaviors
You can resolve this issue by manually changing the version numbers in .sln and .csproj files.
In .csproj and .csproj.user
change ToolsVersion to your current Visual Studio version. VS 2013 is version 12, VS 2015 is version 14.
In .sln change VisualStudioVersion to the current version, you can find it in the About window.
Also change Microsoft Visual Studio Solution File, Format Version to your current version (eg 14.00, 12.00)
Note: This only works for built-in assemblies. If external dependencies (like Prism) cause this error, you'd have to recompile them using the new Blend SDK. You could also try to update the dependency, maybe the newest version is already compiled using the latest Blend SDK.
None of the other answers here worked for me. What finally solved it was deleting the .NET v4.0 version of the file in the SDK folder:
C:\Program Files (x86)\Microsoft SDKs\Expression\Blend\.NETFramework\v4.0\Libraries\
I am referencing the v4.5 file via NuGet, but it seems that the designer was finding the file in the above folder. The v4.0 file was not registered in the GAC.
The popular answer is valid, but since things are always changing in the developer world, I thought I would note that there's a (IMO) better solution now.
In December 2018, Microsoft released an official, open source, supported NuGet package for XAML behaviors for WPF. (There's a separate one for UWP.) It's very easy to migrate to this package. You need to uninstall your current NuGet package, remove a couple of references, install this package, and change a using statement (or FQN).
https://www.nuget.org/packages/Microsoft.Xaml.Behaviors.Wpf/
https://devblogs.microsoft.com/dotnet/open-sourcing-xaml-behaviors-for-wpf/
I read about it in this SO answer, so credit goes to that OP:
How to add System.Windows.Interactivity to project?
Was having a similar problem using Visual Studio 2017 but none of the answers above fully resolved it for me. Found a Microsoft developer community page that had a workaround that did the trick. Comment by Bran Hagger recommended deleting the .vs folder from the solution's directory. This additional step cleared out the cache and caused Visual Studio to rebuild it.
Just the Microsoft Visual Studio Solution File, Format Version change to 14.00 worked for me.
This also could be that you are mixing different versions of System.Windows.Interactivity.dll, especially if you are getting the SDK from nuget where several different packages provide it, e.g.:
https://www.nuget.org/packages/Expression.Blend.Sdk/
https://www.nuget.org/packages/System.Windows.Interactivity.WPF/
In this case, you'll have to synchronize these libraries among projects.
Deleting the .vs file in the solution folder solved the issue. The issue happened for me after I updated My Visual Studio 2017 and Opened the project that was built before with an older version of Visual studio 2017.

Error in Visual Studio 2013 when including JetBrains ReSharper via NuGet

When I include JetBrains-ReSharper my project using NuGet Package Manager, and then I try to rebuild the project, it shows an error.
Error 14 The type 'System.Threading.LazyInitializer' exists in both 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\mscorlib.dll' and 'Project\packages\JetBrains.ReSharper.SDK.8.2.1158\bin\System.Threading.dll' Project\Filters\InitializeSimpleMembershipAttribute.cs
Can anybody can help me to solve the problem ?
Sadly, because ReSharper is a .net 3.5 application, and due to the way the SDK is set up, it includes references to the .net 3.5 compatible System.Threading.Tasks.dll back port Microsoft initially released with RX. The unfortunate part is that this file is referenced even if your plugin is a .net 4 project, and so you get conflicts with the real System.Threading.Tasks.
You can change your project to be .net 3.5, but then (again, due to the way the SDK is set up) you'll get other warnings about .net 4 assemblies that are referenced, but shouldn't be. Essentially, you just have to ignore those warnings. We're working on fixing all of this for 9.0.
However, as #derigel mentions in the comments - adding the ReSharper SDK to an MVC project is a little weird, and frankly, won't work. The ReSharper SDK is for building ReSharper plugin extensions. If you want to install ReSharper, download it from here: http://www.jetbrains.com/resharper/download/

Downgraded my target .Net framework and now compiler cannot see referenced dlls, but intellisense can

I have an Umbraco/MVC project I have been working on using the current ( 6.1.6 ) version of Umbraco and building with the .Net Framework version 4.5.
I created the project as an empty MVC project then installed Umbraco through NuGet.
When it came to deployment time, my project didn't work on the live server because it turns out that only has the 4.0 version of the .net framework on it. I changed the "Build" property on my Visual Studio 2012 project so that it would target the older framework and as if by magic it now won't build at all.
I realised there was a versioning problem with the Umbraco dlls, so I downloaded the binaries again and installed them in the /bin folder on the production server. That now works correctly, but my local version still won't build with the 4.0 target, even though I am now referencing the current dll versions.
The thing that does my head in is that I can see the files.
The compiler says:
The type or namespace name 'editorControls' does not exist in the namespace 'umbraco' (are you missing an assembly reference?) C:\Users\Glenatron\Documents\Visual Studio 2012\Projects\MyProject\MyProject\usercontrols\customUpload.ascx.cs
The line using umbraco.editorControls.userControlGrapper has a wavy blue line under editorControls but if I start typing out the line again, intellisense has no problem identifying it.
I don't think this is really about Umbraco, I assume it is something to do with my environment in general.
I have emptied the bin folder and replaced my local reference dlls with ones downloaded from the Umbraco site. I have also removed and re-added all my references, to no avail. There are no versioned references in my csproj file.
I realise this is a relatively common problem - can anyone shed any light on what I need to do?

Categories