Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find assembly file #1

Closed
xeromorph opened this issue Dec 12, 2014 · 7 comments
Closed

Cannot find assembly file #1

xeromorph opened this issue Dec 12, 2014 · 7 comments
Assignees
Labels

Comments

@xeromorph
Copy link

It seems like I cannot get this to work. I install nuget package pcre.net, it looks just fine listed in references and all, but my code

string pattern = @"some regex";
var regex = new PcreRegex(pattern, PcreOptions.IgnorePatternWhitespace);

just throws this

FileNotFoundException
Failed to load file or assembly "PCRE.NET.Wrapper, Version=0.2.0.0, Culture=neutral, PublicKeyToken=8f58d558eeff25a3" or one of its dependecies. Cannot find specified file.

Looks like it's missing some dependencies, but none listed for your nuget package.

@ltrzesniewski
Copy link
Owner

Hi, thanks for the report @xeromorph. As this is clearly in the "works for me" territory, could you please provide some more info about your config: .NET version, project type, platform type, the trust level you use etc?

Let me explain what PCRE.NET.Wrapper is: it's a mixed-mode assembly included in the resources of the PCRE.NET assembly. When you first load PCRE.NET, it will create the dll file for PCRE.NET.Wrapper in a temporary directory, and then load it dynamically. There are two versions of this library: one for x86 and one for x64. The correct one will be chosen depending on whether the process is 32 or 64-bit.

This is done this way so that PCRE.NET can be provided as a single AnyCPU assembly while still working in both 32-bit and 64-bit modes.

I suppose you must have some form of privilege issue since this assembly can't be loaded. It looks like the assembly can't be written to disk, and I'd really like to understand why. That's why I need more info from you.

In the meantime, you can download the source and compile the lib yourself either in x86 or in x64. You'll get the two required assemblies in the output directory (src/PCRE.NET/bin/x86/Release for x86).

@xeromorph
Copy link
Author

my config is windows 7 x64, VS2012 Ultimate Update 4, project type is winforms, platform target "any cpu", but I've tried both x86 and x64 - same result. Trust level, if I understood correctly, is a tab "security" on project options, right? I have "enable clickonce security settings" checked and "this is a full trust appplication" selected.

I've tried running both VS and compiled project as administrator, still no luck.

@ltrzesniewski
Copy link
Owner

Thanks for the info @xeromorph, it's very valuable.

This is intriguing, especially since you're running the application in administrator mode. It should have worked as you have full trust. I'll take a look at this ClickOnce security thing, maybe this is the cause of the problem - I'm not familiar enough with ClickOnce to tell if that could be the cause. I'll try to reproduce the problem.

In case I'm not able to get it to work, I'll have to release platform-specific NuGet packages (one for x86 and one for x64). These wouldn't have to be packed and would contain the two assemblies. But I want to avoid this as much as possible to provide a better user experience. Looks like it's a fail if it doesn't work for you.

For now, I've added platform-specific assemblies to the v0.2.0 release so you can still use the library. You can download the zip here. Unfortunately, this will prevent your project from using the AnyCPU platform, you'll have to choose between x86 and x64. But at least that's a workaround until I resolve the issue.

@ltrzesniewski
Copy link
Owner

Progress Update: I managed to reproduce the problem in a freshly-installed virtual machine. This is not LibZ-related like I thought.

I rather think you need to install the Visual C++ 2013 Redistributable package to get rid of the error. I'll see if I can statically link to the runtime libs in the next version, which should lift this requirement.

Anyway, now I have a reliable way to test this stuff.

@xeromorph
Copy link
Author

Installing redist worked for me, very much thank you

@ltrzesniewski
Copy link
Owner

Great, thanks for the confirmation! I'll take a look at how to get rid of this dependency for the next version.

@ltrzesniewski
Copy link
Owner

I found out there's simply no way to get rid of this dependency, as the C++ compiler options /clr and /mt are incompatible - which basically means any mixed-mode C++/CLI code requires the redistributable to be installed.

Honestly, I don't understand why Microsoft doesn't include it in a Windows Update package or even along with the .NET framework... But I can't do anything to change this. The best I can do is to include a note in the readme stating that PCRE.NET requires the VC++ 2013 redistributable package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants