Why won't my vb.net project recognize its framework? - vb.net

So I've been working on the same windows form application for a while now. Recently I added a form that uses crystal reports and a crystal reports viewer. Since the addition any attempt at deployment has been unsuccessful.
When I installed crystal reports, I needed to change the framework of my project from 4.0 client to 4.0. On building my solution I received the following error message:
WARNING: The version of the .NET Framework launch condition '.NET Framework 4' does not match the selected .NET Framework bootstrapper package. Update the .NET Framework launch condition to match the version of the .NET Framework selected in the Prerequisites Dialog Box.
Following the message I went to the launch conditions page for my solutions and changed the framework version, but after running another build, the error persists along with a new error:
An error occurred while validating. HRESULT = '8000000A'
I'm using VS2010 and I found through other posts that this was known error and was seemingly irreparable. Does anyone have any suggestions?

Right click on your setup project and choose View->Launch Conditions. Under Launch Conditions click on .Net Framework. Under the properties section, the Version can be clicked on to change it to ".Net Framework 4" from ".Net Framework 4 Client Profile".

Related

VB.NET application compiled to target 4.6.1 framework does't run successfully on Computer with only 4.8 .Net framewor

I intend to build simple Winform application just to allow user to automate their file creation and store the last filled form in a file to keep it for next run.
thus, I'm not interested in creating installer for this simple Winform application. I expected to only compile it to .exe and let it run on other computers.
I develop the application using VS2019 community with target .net 4.6.1
It won't run on computer with Windows 10 with only .net framework 4.8
We are not able to install framework 4.6.1 since it says an earlier version of .net framework is already installed.
Should I recompile my application with target .net framework 4.8?
Can't I compile my application to run on any computer which at least has 4.6.1 or newer? without installer.
(I don't really understand the .net framework backward compatibility truly mean)
my application uses:
library of user32.dll for SetForegroundWindow function
to create .ini file
Finally it works. Even compiled to target .NET 4.6.1 still work on .NET 4.8 computer actually.
The issue is because my application is targeting to another application using interope COM interface, while the license is not sufficient for the user to allow COM interface.
we notice it when we finally create a pure simple windows form, then step-by-step compiling while adding each feature.
Sorry Every Body for this silly case. And my special apologize to evry1falls for spending your time.
I'm thinking to change this Question or delete it. because it is not the issue at all
The Actual Issue is:
I created Windows Form Application starting from a blank Project. And I don't know that the .NET Unhandled Exception is not activated by default.
When created from Windows Form Project Template, the Unhandled Exception message shown.
I created another Question about it: Here

"Option Strict On disallows implicit conversions" inconsistent enforcement

configuration 1: building ESRI add-ins for ArcMap 10.4 using Visual Studio 2015 targeting the .NET 4.5.2 framework
configuration 2: building ESRI add-ins for ArcMap 10.3 using Visual Studio 2013 targeting the .NET 3.5 framework
configuration 3: building ESRI add-ins for ArcMap 10.4 using Visual Studio 2013 targeting the .NET 4.5.2 framework
I'm trying to understand why the Option Strict On enforcement in VB.NET projects does not raise error BC30512 in two projects and it does in another. Here is an an example line of code that triggers the error using configuration 1 but does not trigger the error with configuration 2 or 3.
Dim bufferedPolygon As ESRI.ArcGIS.Geometry.IGeometry = New ESRI.ArcGIS.Geometry.Polygon
Additionally, if I instantiate the managed class instead of the coclass, the error is not triggered in either configuration (see following line):
Dim bufferedPolygon As ESRI.ArcGIS.Geometry.IGeometry = New ESRI.ArcGIS.Geometry.PolygonClass
The different versions of ArcMap dictate which version of the framework is targeted. For additional background, the COM to .NET Type Conversion of the ArcObjects documentation is relevant:
Using ArcObjects (COM-based) in .NET (ArcObjects .NET 10.4 SDK)
Why is the error triggered in configuration 1 and not in configuration 2 or 3? And why isn't the error triggered in configuration 1 when instantiated with the managed class instead of the coclass?
Link to an issue submitted at the dotnet/roslyn github repository.
https://github.com/dotnet/roslyn/issues/13314
Thanks
Shea
At this time, it appears (as Hans Passant suggested in a comment on the original post) that this is indeed a bug with the Roslyn compiler in Visual Studio 2015. I opened an issue at the dotnet / roslyn GitHub repository, and it has been labeled a bug and assigned to a team member. The status of this could change as the issue is investigated.
The link to the issue and additional troubleshooting information is https://github.com/dotnet/roslyn/issues/13314

version of .net framework launch not match .net framework bootstrapper project

When I build the release project of the vb.net 2010 I just started using, I get two warnings:
the version of the .net framedwork launch condition does not match the selected .net framework bootstrapper package. Update the .net framewk launch condition to match the version of the .netfrk selected in the prerequisites dialog box.
The target version of the .net framework in the project does not match the .net framework launch condition version .net framework 4 client profile. Update the version of the .net framework launch condition to match the target version of the .net framework in the advanced compile options dialog box.
I changed the framework of the main project from client profile (which it was when I first created it) to frwk 4 because I read that crystal reports would not work with frwk 4 client profile. (is that true).
The bootstrap version Framework is for x64 and x86. I continued to look around the web and found that one can change the framework in the launch conditions of the setup project. These seem to be scattered around in numerous places which is a problem I don't recall ever having with other verions of .net. Anyway, That solved that problem, but there is still another issue associated with this.
I have changed anycpu to x86 for the main project and the secondary projects because I was having a problem with installing both msi's for crystal. Meanwhile, the other secondary projects (which were upgraded from 2008) I changed to x86 but in the configuration file, it says anycpu for these and as has been written here, cannot be changed to x86. I am not getting an error but have not yet tested whether the installation works.
I read an answer on your site to go into vbproj and change in notepad from x86 to x64 because they could not change from anycpu to x86 that way. But I don't want x64 so not sure what to do.
It seems that anyCPU would be a good selection but will that work with Crystal and do I need to attach other than the x86 msi if I do change it? Or can I leave it as is in this unclear situation.
This error is because of a mismatch. You can fix it by making either one of them match the other.
One is the "Launch Condition." The other is the "Prerequisite."
To change the Launch Condition:
right click your setup project in the Solution Explorer
click View - Launch Conditions
select the ".NET Framework" item under Launch Conditions
in the properties window, see the Version item. You can open the drop down menu to select the appropriate framework version.
To change the Prerequisite:
right click your setup project in the Solution Explorer
choose properties, a Properties Pages dialog appears
click the "Prerequisites..." button
check and uncheck framework versions as appropriate
Yet another poorly documented feature from our friends at Microsoft. With the Setup project selected there are an array of icons in the solution explorer toolbox; one of which is "Launch Condition Editor".
Select the setup project, select the "Launch Condition Editor", new window opens. Select "Launch Conditions", ".Net Framework" Look at properties, version. Select the present version, opens drop down menu, select desired framework.
Rebuild.
(Thanks to http://social.msdn.microsoft.com/Forums/windows/en-US/5167197a-12a5-473e-940a-569e92f08f37/error-the-version-of-the-net-framework-launch-condition-net-framework-4-does-not-match-the)
Okay so I ran into this issue as well. There are 3 places I found that need to match. Not 2 places. I am using VS2015 with the Add-in Setup Project available from Microsoft.
Place 1: Target Framework needs to be what you are targeting, variable X. To get to this go to the properties of your main project and select the target framework for your code.
Place 2: Right click your setup project and go to view > Launch conditions, click .Net Framework, and in the properties window select your target framework... variable X.
Place 3: Right click your setup project and go to properties > Prerequisites. This will show the pre-requisite from the program... In my case Variable X needed to match what was checked in this box.
This resulted in a successful build of the project without the warning.

Building C++ projects that targets framework 3.5 but produces assemblies targeting framework 4.0

Background
We have a C++ solution that has been moved from VS2005 to VS2010 where the project files were targeting the .net framework 3.5 but since moving over to VS2010, all of the project files were showing that they were targeting the.net framework 4.0. I have since changed the .vcxproj files manually so that they are targeting the .net framework 3.5, using the method described in the Community Content on this link
The Problem
When I build these project files, manually or via an automated build, the output assemblies are still targeting the .net framework 4.0. I can tell this by using various methods described here. I also know that this is the case as I build and run the installer for this application. Once the application has been installed (which then shows as a service), I try to start the service on the target machine. This service will not start on a machine without the .net framework 4.0 installed. If 4.0 is then installed, the service will start, so this is another test that I can run that shows me that the application has a dependency on .net framework 4.0 which it should not.
The Aim
Ideally, I need to build this application so that the outputs are targeting the .net framework 3.5 instead of 4.0 so that it will actually run as it is supposed to! I have tried to use the 3.5 version of MSBuild as described in one of the answers given for this question here but got the same error that is described underneath that post.
Can anyone help with this? It's proving to be a right pain and I've been banging my head against the wall for over a week trying to get this sorted!
Thanks again in advance
Make sure you follow all the instructions as provided in the first link you posted.
For example,
Make sure you have Visual Studio 2008 installed on the build server.
Make sure you also change each project's "Platform Toolset" to v90.
Verify the project's framework version: "In Solution Explorer, right-click your project and then click Properties. In the Property Pages window, in the left pane, expand Common Properties and then select Framework and References. Verify that the new Framework version appears at the top of the right pane."

Windows Installer from .Net 2.0 Custom Action to .Net 4.0 Custom Action - BadImageFormatException

I'm having a problem with an application that I recently upgraded from .Net 2.0 to .Net 4.0. During installation, the custom action starts to execute and throws an error.
=== Logging started: 9/30/2011 2:34:09 ===
Error 1001. Error 1001. Exception occurred while initializing the installation:
System.BadImageFormatException: Could not load file or assembly 'file:///C:\Program Files\MyPath\MyCustomAction.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded..
=== Logging stopped: 9/30/2011 2:34:30 ===
Note that should I uninstall the old version of the application first, then install the new version of the application, the installation succeeds without error.
The only thing I can guess is that the .Net 2.0 custom action is failing to be loaded by Windows Installer as it's not the same .Net 4.0 framework as used by the latest version of my application. Has anyone run into this?
You've got to set the condition for the runtime in the vdproj (it doesn't update with your custom action project):
http://msdn.microsoft.com/en-us/library/kz0ke5xt.aspx
In Solution Explorer, click the Setup project.
On the View menu, point to Editor, and then click Launch Conditions.
Click .NET Framework.
In the Properties window, change the Version property to the version of the .NET Framework that you want the Setup project to check for and install.