The type or namespace name 'Transactions' does not exist in the namespace 'System' (are you missing an assembly reference?) - C# ASP.NET

StackOverflow https://stackoverflow.com/questions/16217459

Question

We have a C# ASP.NET Web Application that uses the System.Transactions namespace.

using System.Transactions;

This works fine when developing locally - we just had to add the reference first by going to Website --> Add Reference...

The problem is that after deploying to the web host (copying over FTP), the host doesn't know this reference.

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0234: The type or namespace name 'Transactions' does not exist in the namespace 'System' (are you missing an assembly reference?)

Working in Visual Web Developer Express 2010, we don't have the References folder built in. I saw this solution: https://stackoverflow.com/a/13035466/2178080 that suggests (but doesn't recommend) copying a dll to the application folder.

I'm a bit new to deploying with ASP and not sure how to include the System.Transactions library so the host can find the reference. Has anyone run into this issue?

Edit: We went with the route of copying the dll to the site along with the application. The steps to do this:

  1. Copy the System.Transactions.dll from the local system.
  2. Paste into the Bin folder.
  3. The objects referenced in this assembly must now use the fully qualified name.

As this solution is listed as not recommended, I am still open to other solutions.

Edit2: Grant and Chris helped me understand that I was working with a Web Site and not a Web Application. Grant helped with the specifics of the Web Site problem.

Was it helpful?

Solution

Your problem is due to the published site is not bringing the System.Transactions.dll along with it, this points to "Copy Local" being set to False and thus the DLL not copying to the bin folder.

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

OTHER TIPS

Check the target framework in IIS, make sure it's set to the same version of .Net that you are compiling your code in. If you are using IIS 7+, which have Application Pools, make sure the pool the application is running on is the same version of .Net.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top