SSIS Script Component - Changing target .net version keeps reverting - c#

Hoping you guys can help :)
Using VS2015 with currently latest version of SSDT.
Have a script component and am trying to change the Target framework to 4.5.1 (from the default 4.5 - not sure where the default is gotten from)
Have followed the instructions here - slightly modified for VS2015
The problem is that every time I set it and save, it reverts back to 4.5.
Have also tried to set it backwards to 4.0 - same story.
Have tried saving and closing down project and Vsta editor in all combinations to no avail and suspect that this might be an environmental issue.
Any ideas?
TIA
Edit: I've since tried the exact same thing on another machine and it works perfectly, so it does indeed seem to be an environmental issues.

First thing to do, when you are creating a project, make sure to choose Target framework to 4.5.1. Kindly refer to this Cannot change Target Framework on Several Projects From v4.0 to V4.5 or 4.5.1
.
Since you mentioned about environment issue, you need to verify that .net framework 4.5.1 and above were installed in your environment. Hope this will help.

Related

New to Visual Studio, program won't build

I am relatively new to Visual Studio, C#, and using Github. I am trying to get the example for AncestralTrees working (Found here: https://github.com/fire-eggs/Ancestral-Tree). I cloned the repo and try to build, but I get a set of errors that do not make sense.
First is that AppSettings.cs and MruStripMenu.cs could not be found. Are these default config files I have to provide, or am I missing something?
And second is that .NET framework v4.5 wasn't found. For this I am a bit confused, because I thought it was backwards compatible, and I have v6.0.301 installed. To try and fix this error, I went to the website provided and downloaded it, but it wouldn't install as I already have a newer version. Again, am I missing something?
Any help would be greatly appreciated!
For the compatibility issue, .Net Core (6.0) and .Net Framework (4.5) are different animals, with .Net Core as more of a successor to Framework. They are very similar, but there are some breaking changes between Framework and Core, and if a project was intended for .Net Framework 4.5 you will want to have it installed on your system and set as the build target for the project in Visual Studio. You could probably also build for 4.7 or 4.8.
For the files, if they are part of the repo I would expect them to be there. I'd check your file system and see if the files are there, and then check the repo on github and see if they are included in the repo. If not, you may need an additional repo or you may need to manually add a NuGet package.
I did notice this at the bottom of the github page:
This program is both a demo of my GEDCOM library: YAGP, and a hopefully useful program in itself.
Where the "YAGP" text is a dead link. So I would expect to also need this project, which either no longer exists or is not public. This is probably the correct address:
https://github.com/fire-eggs/YAGP
(I submitted a change with the fixed link.)

Why does downgrading my framework version and then upgrading again allow this .dll to load properly?

I am trying to automate some data collection using an Oscilloscope. I have a USB scope with plenty of examples. The examples worked just fine, but when I tried to create my own project things stopped working. I have mirrored their setup with respect to the .dll location and which is referenced in the project. Whenever the program tried to access any part of their .dll I continue to get
An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)".
There is however, nothing wrong with the .dlls. They are copied and pasted straight from the examples.
After changing a single variable many times over I found out how to fix the issue, at least in the short term. I found that I was targeting a different framework than they were. They target 2.0 and I was targeting the current 4.6.1. The page linked above says it should work with .NET 2.0 and newer. So I downgraded my project to 2.0 and now I do not get an exception when interacting with the .dll. Then if I upgraded to 4.6.1 it would continue to work.
My question is why, if possible to explain without their source code, does downgrading and upgrading again fix the issue?
Also, does this "fix" pose any long term issues that I need to be aware of?

VS2010 C# not including correct .net framework version in target

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 :->

Missing namespaces when downgrading to asp.net 4.0

I just had to downgrade my ASP.Net 4.5 application to an ASP.Net 4.0 application, because our servers don't support 4.5. The way I downgraded it was pretty simple:
Project -> Properties -> Application -> Target Framework
When it finished doing stuff, I restarted the solution, tried to start debugging, but it stopped right after I started debugging, giving me first some errors (which say they can't find some namespaces) for a fraction of a second and after the errors disappeared it gives me 127 warnings that all look like this:
Now I know what the problem is here, but I don't know how to solve this issue.. Does anyone know how to fix these warnings?
Thanks in advance
INFO
I'm using Visual Studio 2015 Community
Remove your current references to the Dlls in question and them add them again, it should load the correct versions of the Dlls. Because you had references to the 4.5 versions and then changed the project target the references are invalid now because they are build against a higher version framework. Changing the projects framework version target does NOT update the references in most cases
It is actually not that easy when it comes with ASP.NET. You have to go through all web.config(s) and downgrade referenced libraries. If its new project, just create new ASP.NET on .NET 4 and compare its web.config(s) with yours.

Error Upgrading To .NET 4.5

I'm trying to upgrade from VS2010 .NET 4 to VS2012 .NET 4.5 and I'm getting the following error in each Project that I've set to .NET 4.5 when they try to build.
The expression "[Microsoft.Build.Utilities.ToolLocationHelper]::GetPathToStandardLibraries(.NETFramework, ?, '', '')" cannot be evaluated. Version string portion was too short or too long.
I can't find any references to this in my code and the msdn reference for the function doesn't provide any hints (http://msdn.microsoft.com/en-us/library/hh135279.aspx).
Anyone seen this before or know the solution?
Edit
The solution listed here doesn't seem to work. http://social.msdn.microsoft.com/Forums/da-DK/vseditor/thread/8ca4a9b0-742d-487d-ab8c-6c3a80cffd40
Somehow after multiple tries, including restarting the machine and visual studio, this started working for no apparent reason.
Unload your project and remove the below tag from your .csproj file:
<TargetFrameworkVersion></TargetFrameworkVersion>
and reload your project again, it works for me.
I had the same problem when upgrading from 4.6.1 to 4.7.2 framework.
I had a big solution with many projects.
This error turned out when building the last project (win application), which had the correct <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>.
The cause of the problem were the other projects, used by the win app project.
They had incorrect framework versions.

Categories