Including unmanaged dll's in an assembly

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an unmanaged dll that I need to include as part of a managed assembly
(it provides functionality that I use via p/invoke).

I came across a blog entry called "Versioning/Deploying unmanaged files" at
http://blogs.msdn.com/suzcook/archive/2004/10/28/249280.aspx , which allows
me to do just this.

However, the above requires compiling from the command line (using csc's
"/linkresource" switch). I'd _much_ prefer getting it to work from within
Visual Studio. I can manually modify "Microsoft.CSharp.targets" to include a
"LinkResource=$(MyProp)" attribute on the main Csc task element, but that
would require me to modify any machine that builds my assembly (I think?).

I was hoping it would be possible to create a self contained project file
that "just works". Does anyone know of a way?

Thanks for any insight,
John
msdnnewsgroups at johnburnett dot com
 
John,

Don't change the Microsoft.CSharp.targets file. Rather, why not just
change the CSC task entry to include the file you want into it? You should
be able to modify the project file (and not the machine's C# target file) to
do this.
 
Thanks for the reply Nicholas, but I'm not sure I follow. What CSC task
entry are you referring to? The only one I know of is in
Microsoft.CSharp.targets, where I could insert an attribute like
"LinkResources="$(MyResourceItemGroup)"" around line 146 (in v2.0). Of
course, I really dont WANT to do that :). How could I pass this into the CSC
task by just editing my project file?

Thanks again,
John

Nicholas Paldino said:
John,

Don't change the Microsoft.CSharp.targets file. Rather, why not just
change the CSC task entry to include the file you want into it? You should
be able to modify the project file (and not the machine's C# target file) to
do this.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

John Burnett said:
I have an unmanaged dll that I need to include as part of a managed
assembly
(it provides functionality that I use via p/invoke).

I came across a blog entry called "Versioning/Deploying unmanaged files"
at
http://blogs.msdn.com/suzcook/archive/2004/10/28/249280.aspx , which
allows
me to do just this.

However, the above requires compiling from the command line (using csc's
"/linkresource" switch). I'd _much_ prefer getting it to work from within
Visual Studio. I can manually modify "Microsoft.CSharp.targets" to
include a
"LinkResource=$(MyProp)" attribute on the main Csc task element, but that
would require me to modify any machine that builds my assembly (I think?).

I was hoping it would be possible to create a self contained project file
that "just works". Does anyone know of a way?

Thanks for any insight,
John
msdnnewsgroups at johnburnett dot com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top