开发者

How to reference a project from a web application in two different Solution

开发者 https://www.devze.com 2023-01-21 22:32 出处:网络
I have a Web application project that references other projects within the same solution. I wanted the web application to reference the same project but from a static folder in a different solution.

I have a Web application project that references other projects within the same solution. I wanted the web application to reference the same project but from a static folder in a different solution.

something like this:


Solution A ---> ---->Web App ------>Reference to proj


Solution B-----> ------->Web App ------->Reference proj1.dll (static)

I would ap开发者_开发知识库preciate any help and suggestions.

Thank you.----


I fixed the problem by using Conditions in the vbproj.

something like this: &lt ItemGroup Condition=" '$(Configuration)|$(Platform)' != 'Developers|AnyCPU' "> &lt ProjectReference Include="..\xxxx"> &lt/ProjectReference > ........

&lt /ItemGroup> &lt ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Others|AnyCPU' "> &lt Reference Include="Foo, Version=1.0.0.0, Culture=neutral, ProcessorArchitecture=MSIL"/> .......... &lt /ItemGroup>

~ Hope it helps someone else.


Either add that project to Solution B too (add existing project) or right click References, select Add Reference and browse for the compiled DLL. It doesn't have to live in the solution folder structure.


Basically the SLN file is just meta data defining the location of references, projects, and other meta data about the solution. A project can easily be added to multiple solutions.

  1. Right click on the Solution in the visual studio solution explore.
  2. On the menu go to Add > Existing Project...
  3. Select the project you want to add to the solution.

Now the project belongs to both solutions. Changes to the project in either solutions will effect the project in the other solution since they are the exact same project files.

0

精彩评论

暂无评论...
验证码 换一张
取 消