简体   繁体   English

VS 2010 Visual C# - 在同一解决方案中引用其他项目

[英]VS 2010 Visual C# - reference other project in same solution

I'm having a problem with a VS2010 solution. 我遇到了VS2010解决方案的问题。 I have two projects in the solution, one is the main program, while the other is a program used for editing data/setting up files for the second. 我在解决方案中有两个项目,一个是主程序,另一个是用于编辑数据/为第二个设置文件的程序。 In order to make my second project work, I need to be able to access the classes/enums/etc. 为了使我的第二个项目工作,我需要能够访问类/枚举/等。 inside the first. 在第一个里面。

I know with VS2010 you can add a project as a reference inside another project. 我知道VS2010你可以在另一个项目中添加一个项目作为参考。 I tried doing that, and it seemed to work. 我试过这样做,似乎有效。 I can add the namespaces, and use the enums, but as soon as I try and compile the 2nd project, it's as though it looses the references, and it returns errors for all the classes/enums i used from the main project. 我可以添加命名空间,并使用枚举,但是一旦我尝试编译第二个项目,就好像它丢失了引用,并且它返回了我在主项目中使用的所有类/枚举的错误。 If I delete the reference, and readd it, I can again use all the stuff in the first project, but again compiling destroys the references. 如果我删除引用并读取它,我可以再次使用第一个项目中的所有内容,但再次编译会破坏引用。

I've tried rebuilding the first project, tried changing the output type, etc. but to no avail. 我已经尝试重建第一个项目,尝试更改输出类型等,但无济于事。 Does anyone have an idea what might be wrong? 有谁知道什么可能是错的?

For reference, this is on Windows 7 64, using Visual Studio 2010 Ultimate, and both are C# 4.0 projects. 作为参考,这是在Windows 7 64上,使用Visual Studio 2010 Ultimate,两者都是C#4.0项目。 I'm using System.Data.SQLite/System.Data.SQLite.Linq, but removing them didnt make it work. 我正在使用System.Data.SQLite / System.Data.SQLite.Linq,但删除它们并没有使它工作。

Thanks in advance 提前致谢

Make sure they both are referencing the same .Net 4 Profile , one may be using the client profile 确保它们都引用相同的.Net 4配置文件 ,其中一个可能正在使用客户端配置文件
http://msdn.microsoft.com/en-us/library/cc656912.aspx http://msdn.microsoft.com/en-us/library/cc656912.aspx .net项目简介

They should both be .NET 4 or both be .NET 4 Client Profile 它们应该是.NET 4或两者都是.NET 4 Client Profile

确保在编译(调试)时,您的solution platform设置为“任何CPU”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在ubuntu上编译VS2010 c#解决方案(项目) - Compile VS2010 c# solution (project) on ubuntu 如何在Visual Studio 2010中引用C#类库项目? - How to reference a C# Class Library project in Visual Studio 2010? 在 Visual Studio 2010/C# 中引用其他项目中定义的类型 - Referring a type defined in other project in Visual Studio 2010/C# C# UWP - 无法在同一解决方案中添加对项目的引用 - C# UWP - Can't add reference to project in same solution c#从同一解决方案中的其他项目运行表格 - c# run form from other project in same solution 使用Visual C#2010 Express在C#项目中添加引用'SHDocVw' - Add reference 'SHDocVw' in C# project using Visual C# 2010 Express 如何在VS2010 Visual Studio 2010中将适当的Nuget程序包设置为C#项目 - How to set appropiate Nuget package to a C# Project in VS2010 Visual Studio 2010 Visual Studio 2010中的参考项目与参考DLL - Reference Project vs Reference DLL in Visual Studio 2010 如何使用 c# 在 Visual Studio 2010 中以编程方式将现有项目添加到当前解决方案 - How to add an existing project to a current solution programmatically in visual studio 2010 using c# VS2010(C#)Environment.SpecialFolder.ProgramFiles是解决方案项目中的位置? - VS2010 (C#) Environment.SpecialFolder.ProgramFiles is where in the Solution Project?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM