I'm trying to get Saxon 9.7 HE up and running in C#, and failing miserably.
As per instructions, I am downloading and running https://sourceforge.net/projects/saxon/files/Saxon-HE/9.7/SaxonHE9-7-0-14N-setup.exe/download
This installs a bunch of files into C:\Program Files\Saxonica\SaxonHE9.7N.
In the bin folder inside this one, the following files are present:
No matter which DLLs I add as references to my project, the "using Saxon.Api;" reference fails to resolve.
Am I using the correct DLLs here? Is it some sort of .Net version mismatch? My class library project is set to .Net 3.5 currently.
Thanks for any help
The minimum supported version of .NET for Saxon is indeed 4.0.
The bug is in the documentation which will be updated shortly: See bug issue: https://saxonica.plan.io/issues/3085
Thanks for reporting the issue.
Some guess work here. But the dependency on .net 4 is most likley from the compiling of the C# wrapper over the saxon java library that was converted using IKVM. IKVM says it only requires .net 2.0, so I think the only place that dependancy can come from is the saxon9he-api.
You should be able to build this yourself, its quite thin.
https://dev.saxonica.com/repos/archive/opensource/latest9.7/hen/csource/api/Saxon.Api/
Otherwise if its a show stopper ask Michael Kay (the author), he's pretty active on stack overflow.
Updated
I was curious so I checked, the .Net 4 dependency seems to come from the saxon9he-api (which i'm fairly certain could be re-compiled under 3.5 with no/minimal changes), the same for the Query and Transform exe's.
Related
I am tasked with upgrading a somewhat complex C# project from .NET 4.8 to .NET 5. The Windows upgrade assistant went more or less smoothly, and with some cleanup, it looks good, Except for one dependency, which is sadly absolutely not replaceable (within the scope of the job).
So my solution to this would be: Move all the code that interfaces with this dependency to a sub-project which builds for .NET 5 as well as .NET 4.8 (at least in the csproj file), and use that as depencency. Does this actually work?
Visual Studio says that's ok, but I have found absolutely nothing on the topic (and while I believe it could work, it's probably just me wanting that it does).
[Regarding the problem that the result will be an absolute mess: the functionality of this dependency will be obsolete within a year, at which point the sub-project will be removed anyway, sadly the ugrade cannot just wait until then]
can I build a project in .net4.8 and include it in a project building for net5
Maybe? The basic rule is that .Net 5 cannot use .Net 4.x libraries. There may be some exceptions to this rule, but I cannot find a reference to confirm this. And I'm fairly sure it can result in runtime failures if the library tries to use methods not available in .Net 5.
The recommended way would be to port the library to .Net standard 2.0, that way you can use it in both .Net 4.8 and .Net 5 projects without issue. This should be fairly straight forward to port unless you are using UI or other libraries not available in .net standard.
It might be possible to use multi-targeting, i.e. write in your project file that the project should be compiled for both .Net 5 and .Net 4.8. You could use pragmas, (i.e. #if NET48) to include or exclude code sections from either framework. I have not used this feature so I cannot provide much details.
I am doing maintenance work on a VS2010 C# project built against .net v3.5.
I recently changed the project Target Framework properties to the latest version listed (v4) - due to an expectation of using a version of .net that is actually included in Win10 by default - and rebuilt without any apparent issues.
Unfortunately the embedded dependency in the generated .exe is still for .net v2.0.50727 (which is what is reported for v3.5 AFAIK) and the target machine (a clean install of Win10) is asking to install .net 3.5.
Using MS VS2010 v10.0.40219.1 SP1Rel.
Unfortunately upgrading the build tools isn't an option (building the program with VS2015 works just fine).
I have gone googling but don't seem to have found any similar reports.
Based on some of the comments already posted, I seem to have not made myself entirely clear - hopefully the following will help.
1) the intention/requirement is to be able to install this app on a clean install of Win10 without needing any further downloads. (installing .net 3.5 is easy to do, just not what is wanted)
2) the ultimate build environment for this is automated, visualized and not in my control and therefore upgrading the tool chain is a major pain that I'd like to avoid if possible.
3) AFAIK there are no third party libraries involved. All of the listed references (dll's) are v4.0.30319.
4) this is a XAML-based development, one part of three projects in the solution - the other entries are the installer and a C# custom installation library. As far as I can tell everything is set for .net v4.
Unfortunately the embedded dependency in the generated .exe is still for .net v2.0.50727 (which is what is reported for v3.5 AFAIK) and the target machine (a clean install of Win10) is asking to install .net 3.5
So there is some dependency in your project that targets that version of .NET. It could just be that you need to Build > Clean Solution and with a Build > Rebuild Solution the problem is solved.
Otherwise, assuming some library does require some .NET 3.x library, the installation request is entirely correct. Windows 10 does not have an option for installing .NET 2.0 and another for installing .NET 3.5. If you search for Turn Windows features on or off you will see this:
Any dependency on a .NET 2.x-3.x library will trigger the activation/installation of the first feature in the dialog.
As far as I can see, you have 2 options:
Move everything to a framework supported by Microsoft, most preferably .NET 4.7.2 given support and security.
Deal with the installation process and understand that Microsoft does not install these versions of .NET in purpose. You can, however, add these installers as a prerequisite and even bundle them with your installation, but that won't help much.
Thanks to all who have tried to help me!
The issue has been resolved.
There appear to have been two causes for this issue and my confusion:
it turns out that the blank install of Win10 that the testing was being performed on was not entirely clean - the pre-installed network drivers/utilities from intel also had a .Net v3.5 dependency...
one of the embedded resources in the project was effectively a uncompressed tar-ball containing a number of files; including an executable that had the dependency on .net v3.5 - this was a binary blob stored in svn so the content was had not been updated for several years (ie well before my involvement) ...
With both of these issues addressed it would appear that my problem is solved, so once again thank you for your feedback, suggestions and patience,
PeterT :->
I'm trying to use web services on unity.
I used svcutil to generate a proxy class, however the proxy class was using "System.Threading.Tasks".
I noticed that System.Threading.Tasks wasn't aviable on .Net 3.5.
So I went to player setting and I changed to .Net 4.x
But now I have an other issue, and I cannot find a way to fix it, I need to use System.Web.dll and System.Web.Services.dll to make my web service work, however, the dll that are include in Program Files\Unity\Editor\Data\Mono\lib\mono\2.0 are all targets for .Net 3.5.
So that mean I cannot use them on .Net 4.x
I've been looking for quiet long and was unable to find any answer.
I can add the code to the proxy class here if it's require, but I don't think it would be useful. Should I download those dll somewhere?
Anyone ever seen thoses issues somewhere?
You are using the wrong dll version.
Once you change Api Compatibility Level to Net 4.x, you have to copy the System.Web.dll and System.Web.Services.dll files from <UnityInstallationDirectory>\Editor\Data\MonoBleedingEdge\lib\mono\4.5 to your <Project>\Assets path.
That's it. Restart Visual Studio and Unity.
There is another method of linking missing libraries as described in this unity documentation.
Create a file called csc.rsp and put these 2 lines in it:
-r:System.Web.dll
-r:System.Web.Services.dll
And yes, you better set compatibility level to .NET 4.x
You also might want to restart Unity or VS in some cases.
I had a Problem to use DotNet 4.0 DLL in a DotNet 2.0 Application, googling the Issue showed a single suitable solution: COM
Anyway i'm trying to do that now but i keep getting the following Error when i add the reference in my application (the reference is tlb):
The ActiveX type library 'MyLib.tlb' was exported from a .NET assembly
and cannot be added as a reference. please reference the Assembly directly.
Am i missing anything? its stated on a lot of websites that this option should work:
Example1, Example2
On the other hand its stated on an old link of microsoft that this option is not possible "By Design"
Any Ideas? Hints?
Home i'm not confusing things.
Thank you.
Because it would lead to loading the .NET4 runtime in a process where the .NET2 runtime is already loaded - this is not possible by design!
Support for mixing .NET versions in one process was introduced in .NET 4 .
IF you really need to make this work:
make a native out-of-process COM server which uses that .NET4 DLL
then use that server from your .NET2 process (NOT the .NET4 DLL directly !)
REMARK - after seeing your comment about EF4:
I strongly recommend to convert your .NET2 application to .NET 4 - anything else will be a real maintainance nightmare!
I just want to use HttpUtility.UrlEncode(myString). The project is .NET 3.5. But I can't find the corresponding dll. In .NET 4.0 it seems to be in System.web. But I'm not sure where it's located for 3.5
Can someone show me where I can download the corresponding dlls?
(And also, I would really prefer it if I don't need to download an installation package, since that ususally results in GAC-ing the stuff. I hate when stuff gets GAC-ed, it just increases the risk of not catching missing references after deploying in an environment where the installation package hasn't been run.)
(Why is it always like this with .net? ...So hard to find the proper dll. With java I don't remember it being that tricky to find the right jar file. But with .net it's often a mystery which update, framework installation etc things are located in)
edit:
Ok, this is embarrassing, I thought the assembly was missing from my framework... but turns out it was in the "add reference" list all along, it just wasn't sorted on the name column of the component. ...thanks.
Still System.Web according to http://msdn.microsoft.com/en-us/library/system.web.httputility(v=vs.90).aspx
Namespace: System.Web
Assembly: System.Web (in System.Web.dll)
Supported in: 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0
You don't need to worry about downloading or installing anything in the GAC, as it's already part of the framework. If you have the relevant .NET framework installed, it'll be there.
I thought of marking this post down as the answer could have been found by simply Googling the class and method. It's not difficult at all to find it. You search MSDN for the class name and it will tell which assembly and which namespace support the class. In fact it's right here:
http://msdn.microsoft.com/en-us/library/1e55w41w.aspx.
Give me .NET over Java any day. VS works out of the box first time. Java doesn't. Having to spend days, possibly weeks getting the development environment set up, and then scrounging what components I can to produce something that takes twice as long to develop, is not my idea of a pleasant experience.