referenced-assemblies

6 views
Skip to first unread message

Chris Eldredge

unread,
Nov 16, 2011, 8:16:43 PM11/16/11
to OpenWrap Development Mailing List
We have several wraps we want to produce that have a public API
assembly (Foo) and a private implementation assembly (Foo.Core). We
want to use referenced-assemblies: Foo.dll to make sure other projects
don't directly access Foo.Core. However, when we try to do this,
Foo.Core does not get copied into the output directory, so it can't be
found at runtime.

Since the documentation (https://github.com/openrasta/openwrap/wiki/
Package-descriptor) seems to indicate that this is the intended use
case, how are we supposed to copy non-referenced assemblies into the
output directory?

# OpenWrap Shell 2.0.0.10
# Copyright c naughtyProd Limited 2009-2011
# Using C:\projects\Marthetron\wraps\_cache
\openwrap-1.0.2.86964541\bin-net35\OpenWrap.dll (1.0.0.0)

Konstantin

unread,
Nov 17, 2011, 6:57:08 AM11/17/11
to openwra...@googlegroups.com
Add somtheing like this to wrapdesc:
build: files; file=bin-net40-> src\Foo\bin\Release\foo.dll;

Sebastien Lambla

unread,
Nov 17, 2011, 7:04:46 AM11/17/11
to openwra...@googlegroups.com
Hmm. We cannot do that because that's not how msbuild works.

To take your example, the code has a Foo.dll. We inject that as a project reference when we build, which is the exact same equivalent as when you add a reference yourself to Foo.dll.

At that point, if you load up Foo.Core in Foo.dll, fusion already knows the path of Foo.dll and will happily load Foo.Core.dll from there. Serialization assemblies and other associated files to an assembly are also located by msbuild at build time without us having to much around with it.

If however you look at your output path (in the case where you added the reference yourself) then you will find Foo.dll but not Foo.Core.dll (because no one except Foo.dll knows about it).

This is not something we can do much about at that point, because that's the existing behavior of assembly references, and so openwrap, nuget and anything else that feeds references expects the right things to be done by msbiuld.

We *could* add everything that was found in /bin-* to your project at build time by adding them as Content with Copy=always, so they always end up being part of your project, but i'm not entirely sure what the implications of this are and if we wouldn't end up breaking more things than we fix so that requires a bit of thinking.


________________________________________
From: openwra...@googlegroups.com [openwra...@googlegroups.com] on behalf of Chris Eldredge [chris.e...@gmail.com]
Sent: 17 November 2011 01:16
To: OpenWrap Development Mailing List
Subject: [openwrap-devl] referenced-assemblies

Chris Eldredge

unread,
Nov 17, 2011, 10:40:43 AM11/17/11
to OpenWrap Development Mailing List
I see your point. Before trying openwrap we were putting Foo.dll and
Foo.Core.dll in the GAC, and only allowing Foo.dll to appear in the
Add References dialog. We want to stop using the GAC anyway, and even
without openwrap I can see that we would need an explicit reference to
Foo.Core.dll in order for msbuild to copy it.

I wish msbuild/csproj had a way to declare runtime references that
would get copied like normal references but not get passed into csc
when the project compiles. I guess that would be a pretty esoteric
feature though, but it helps enforce policies and prevent mistakes.
Another example where this would be useful is if you want your
projects to only write log statements via Common.Logging but use
log4net as the provider.

Time to start tinkering with msbuild.

On Nov 17, 7:04 am, Sebastien Lambla <s...@serialseb.com> wrote:
> Hmm. We cannot do that because that's not how msbuild works.
>
> To take your example, the code has a Foo.dll. We inject that as a project reference when we build, which is the exact same equivalent as when you add a reference yourself to Foo.dll.
>
> At that point, if you load up Foo.Core in Foo.dll, fusion already knows the path of Foo.dll and will happily load Foo.Core.dll from there. Serialization assemblies and other associated files to an assembly are also located by msbuild at build time without us having to much around with it.
>
> If however you look at your output path (in the case where you added the reference yourself) then you will find Foo.dll but not Foo.Core.dll (because no one except Foo.dll knows about it).
>
> This is not something we can do much about at that point, because that's the existing behavior of assembly references, and so openwrap, nuget and anything else that feeds references expects the right things to be done by msbiuld.
>
> We *could* add everything that was found in /bin-* to your project at build time by adding them as Content with Copy=always, so they always end up being part of your project, but i'm not entirely sure what the implications of this are and if we wouldn't end up breaking more things than we fix so that requires a bit of thinking.
>
> ________________________________________
> From: openwra...@googlegroups.com [openwra...@googlegroups.com] on behalf of Chris Eldredge [chris.eldre...@gmail.com]

Sebastien Lambla

unread,
Nov 21, 2011, 7:38:22 AM11/21/11
to openwra...@googlegroups.com
If I'm not mistaken they have added that functionality in msbiuld4 by anotating the reference with something.

In the meantime we could certainly investigate the copying of selected things in bin- and make that an option, as we're already doing content injection (for the assemblyinfo.cs generation) that would not be a problem.
________________________________________

Sent: 17 November 2011 15:40


To: OpenWrap Development Mailing List

Subject: [openwrap-devl] Re: referenced-assemblies

Reply all
Reply to author
Forward
0 new messages