.net 4.6 on windows 7 - failed to run - windows-7-x64

I've built an application in VS2015 with intention to run on .NET 4.6 only. So I went to the app.config file and edited it to be:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.6" sku=".NETFramework,Version=v4.6"/>
</startup>
</configuration>
Then on my target machine (win 7, 64bit) I have installed the .NET 4.6 (Web installation). Even after rebooting that machine and trying to run my application I get the error saying that my application requires one of the following versions of .NET Framework - v4.6. Why is that? It seems like the 4.6 is not recognized by Windows 7? Thanks in advance.
E

The supportedRuntime version (first version Id) is invalid. It should be "4.0" instead of "4.6".
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
</startup>

Related

Mixed mode deployment

I have a Visual Studio solution with mixed mode. Some projects are .Net Framework 4.0 while others are .Net Framework 2.
This was solved by adding an app.config with:
<?xml version="1.0"?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0"sku=".NETFramework,Version=v4.0,Profile=Client"/></startup>
</configuration>
However, when I deploy this into an installation, it doesn't work. It gives out the message:
Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.
I have tried to add the app.config to the installation ( so the file ends up in Program Files/..., and also renamed it app.exe.config. (I thought an app.exe.config would be created in the build, but it wasn't).
The installation also contains a file "myApp".exe.config which contains the same as the app.config. This doesn't help either.

NUnit - "Test load failed System.ApplicationException: Unable to find test in assembly"

I am using NUnit 2.6.3 and .NET framework 4.5.
I have a file, Test.NUnit, in my test project which contains:
<NUnitProject>
<Settings activeconfig="Debug"
appbase="E:\Test" />
<Config name="Debug" binpathtype="Auto">
<assembly path="bin\Debug\Test.dll" />
</Config>
<Config name="Release" binpathtype="Auto" />
</NUnitProject>
When I try to run this file I get an error message
Test load failed System.ApplicationException: Unable to find test in assembly
The problem is similar to this question. However, I can't get the answer to work.
I have a Test.dll.config file in my project which is located in E:\Test.
It contains:
<startup useLegacyV2RuntimeActivationPolicy="true">
<!--<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />>-->
<supportedRuntime version="v4.0.30319" />
</startup>
I have tried both versions of the supportedRuntime to show that I am using .NET framework 4.5.
I had a similar issue. Check your firewall blocking nunit-agent.exe trying to connect 127.0.0.1.
NUnit uses it for running tests and doesn't show the correct error if it can't connect to 127.0.0.1.

Java Webstart with Tibco Native Libs

I am trying to deploy an application that uses the native implementation of Tibrv through the TibrvJ library using Java Webstart.
I have packaged up all of the Windows dlls from inside c:\tibco\tibrv\bin into a Jar file and have added these to the nativelib element in the JNLP file.
I was hoping that webstart would take the dll files from thetibco-7.5.1-nativelibs.jar file and allow them to be loaded via System.loadLibrary which is called from Tibrv.open(). However it doesn't seem to want to work properly.
My JNLP file looks like this:
<?xml version="1.0" encoding="utf-8"?><!DOCTYPE jnlp PUBLIC "-//Sun Microsystems, Inc//DTD JNLP Descriptor 6.0//EN" "http://java.sun.com/dtd/JNLP-6.0.dtd">
<jnlp spec="6.0+"
codebase="http://somewhere:8080/my-gui/application"
href="launch.jnlp">
<information>
<title>My GUI</title>
<vendor>Technology</vendor>
<description>Dashboard</description>
<description kind="short">Dashboard</description>
<icon href="icon/Stocks-128x128.png" />
<offline-allowed />
<shortcut online="true">
<desktop />
<menu submenu="Dashboard" />
</shortcut>
</information>
<security>
<all-permissions />
</security>
<update check="always" policy="prompt-update" />
<resources>
<j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se"
java-vm-args="-Xmx120M -ea />
<property name="log4j.configuration" value="live/log4j.xml" />
<property name="swing.aatext" value="true" />
<jar href="tibrvj-7.5.1.jar" />
<jar href="dashboard-gui.jar" main="true" />
</resources>
<resources>
<nativelib href="nativelib/tibco-7.5.1-nativelibs.jar" />
</resources>
<application-desc main-class="com.somewhere.Main">
<argument>classpath:/live/client.xml</argument>
<argument>/live/live.properties</argument>
</application-desc>
</jnlp>
The application launches but as soon as a call is made to open tib then it falls apart with an error along the lines of:
[Root exception is TibrvException[error=22,message=Version mismatch: libtibrv version 7.4 does not match version of tibrvj shared library 7.5]]
TibrvException[error=901,message=Library not found: tibrvj]]
The users have a variety of Tib installations already on their PCs from Tib 7.2 through to 7.5. The Webstart Application only works correctly on a machine with 7.5 installed which matches the Jar file inside the package. So it doesn't appear to do anything with the nativelib jar.
I would like to avoid having to deploy 3 versions of the web start application for the different versions of Tib that the users have installed.
Has anyone else managed to get this combination of TibrvJ and Webstart working?
I've managed to get it working. The trouble is that the call to System.loadLibrary when using Webstart doesn't load in the dependencies of the specified library even if they have been packaged up into a nativelib jar.
See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6191612 for more info.
To get around this problem it is necessary to explicity load all of the dependencies in the correct order. It is also necessary to put each dll library into its own jar file.
So to use native TibrvJ you need to make the following calls before any calls to Tibrv.Open.
System.loadLibrary("msvcr71");
System.loadLibrary("tibrv");
System.loadLibrary("tibrvcm");
System.loadLibrary("tibrvft");
System.loadLibrary("tibrvcmq");
System.loadLibrary("tibrvj");
Happy Days!
I think you have encountered a problem with Webstart.
Some years ago, I had a Webstart application using Java 3D that didn't work on Macs. Eventually I found that all Macs some with an old version of Java 3D installed, and that already installed version was used over the newer version that I had included in the in my JNLP file. Your problem sounds almost exactly like this, so it could very well be the same problem.

Running WatiN tests with ReSharper testrunner

I'm getting started with WatiN to test my web interface. The problem I'm having is the following:
When I start the tests from within TestDriven.net, I have no problem. If I use the ReSharper test runner, I get this predictable AppartmentState exception.
I tried using the different options described here: http://watin.sourceforge.net/apartmentstateinfo.html#testdriven. Nothing helps.
Any suggestions?
I've use Resharper test runner in most of my watin test projects. To get it to work use the same method as for nunit:
http://watin.sourceforge.net/apartmentstateinfo.html#nunit
App.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="NUnit">
<section name="TestRunner" type="System.Configuration.NameValueSectionHandler"/>
</sectionGroup>
</configSections>
<NUnit>
<TestRunner>
<!-- Valid values are STA,MTA. Others ignored. -->
<add key="ApartmentState" value="STA" />
</TestRunner>
</NUnit>
</configuration>
With NUnit 2.5, RequiresSTA attribute should be the tool of choice.
Using Resharper 5.1 with VisualStudio 2010 Ultimate I found that I needed to change my Resharper options to disable "Shadow-copy assemblies being tested" (found in Resharper --> Options --> Tools --> Unit Testing).
Additionally, I also found that the correct naming for the config file is the one which includes the dll extension (so: assemblyname.dll.config).

Getting a version 2.0 is not a compatible version when running NUnit

I am trying to run the sample tests for NUnit, and I am getting an error. I have the supportedRuntime versions set to v1.0.3705 up to v2.0.50727. I have the requiredRuntime version set to v2.0.50727. Is this the wrong setting?
The following is the error that shows:
Metadata file 'c:\Program Files\NUnit 2.4.8\bin\nunit.framework.dll' could not be opened -- 'Version 2.0 is not a compatible version.'
I got the same problem with the CSharp examples in 2.4.8 "right out of the box" with VS2005. Here's my solution.
In nunit.exe.config, the following block is commented-out by default. Put it back in.
<startup>
<supportedRuntime version="v2.0.50727" />
<supportedRuntime version="v2.0.50215" />
<supportedRuntime version="v2.0.40607" />
<supportedRuntime version="v1.1.4322" />
<supportedRuntime version="v1.0.3705" />
<requiredRuntime version="v1.0.3705" />
</startup>
It sounds like you did that but changed the requiredRuntime from the default of v1.0.3705 to v2.0.50727
After that, I opened the CSharp project in VS2005 and converted it. The nunit.framework references all had the icon that shows they are wrong. So I deleted the nunit.framework reference from all 4 projects:
cs-failures
cs-money
cs-money-port
cs-syntax
Then I added new references to C:\Program Files\NUnit 2.4.8\bin\nunit.framework.dll to replace them.
After that the project builds fine.