Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The type or namespace name 'Transactions' does not exist in the namespace 'System' [duplicate]

This is in an ASP.Net web application, with Visual Studio 2013. The solution is composed of several projects. I have code in a library project that has using System.Transactions, and it's worked well for months.

Today I added the same using System.Transactions in code in the web application project, and it fails with the error message below:

The type or namespace name 'Transactions' does not exist in the namespace 'System'

Here are a few things I've tried:

  • Added a reference to System.Transactions.
  • Verified that the referenced dll file is the same in both projects.
  • Changed the framework from 4 to 4.5 and back.
  • Verified that all projects are using the same framework version.
  • Cleaned and rebuilt the solution.
  • Quit Visual Studio, deleted all files in AppData>Local>Temp, rebuilt.
  • Restarted the PC.

So, the upshot is that using System.Transactions works fine in one project but not another, even though both projects are in the same solution.

Any suggestions?

EDIT: Here's an oddity that's probably not any additional help, but here goes:

  • When I build the project, there are no errors. That is, the using System.Transactions compiles just fine.
  • If I run application, it bombs and the error appears in browser window. The VS code window still shows no errors.
  • If I edit the using System.Transactions or add code like var x = System..., the errors immediately appear in the using System.Transactions.

** EDIT:** This question was marked as duplicate. It isn't -- the proposed duplicate solved the question by browsing to the reference. I had already tried that and it didn't help. In my case, I had to use the "copy local" option.

like image 936
Sandy Gettings Avatar asked May 14 '15 21:05

Sandy Gettings


Video Answer


2 Answers

Refer to this Answer By Mark Hall

There is a Microsoft Connect entry posted for this. There is a comment that suggests that you can browse for it. The path given is:

C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\System.Transactions.dll

Just Add reference by browsing to this path

if this did not work, Go to References -> System.Transactions and make sure on the properties for this reference that "Copy Local" is set to True.

like image 150
Hussein Khalil Avatar answered Sep 22 '22 19:09

Hussein Khalil


usually System.Transactions is not part of your references, try to add it in your references by:

right click on your references if you are using Web Application or in your Project if you are using Web Site. find the System.Transactions in the .NET references. You should find the System.Transactions in your references.

like image 37
RajeshVerma Avatar answered Sep 18 '22 19:09

RajeshVerma