Is there a way to transfer a Visual Studio project to the MonoDevelop environment?
at FAQ - MonoDevelop it is said that:
MonoDevelop can open, manipulate and save MSBuild-based projects directly in mopst cases. In fact, since MonoDevelop 2.0 the default project format has been VS2008-style MSBuild projects, but VS2005 and VS1010 formats are also handled.
But when I try to open my (ASP.NET Web Application) .vbproj in MonoDevelop, I get:
Load operation failed. Project does not support framework
'.NETFramework,Version=v4.0'.
Should I alter project settings, allowing different .NETFramework version or do I have to use some 3rd party softwares to translate my projects config files?
EDIT:(Resolved)
If your project is not that big yet, create a new project in your Microsoft Visual Studio(MVS) with .NET Framework 3.5 and then it will be possible to open it with MonoDevelop, else edit your projects Debug/Release config files and delete everything that has "4.0" information about this project, plus .vbproj file in are previous doesn't work and do the same, search for 4.0 information. (Applicable for framework 4.0)
OR
Change your project settings as it is described here:
http://msdn.microsoft.com/en-us/library/bb398202.aspx
What version of MonoDevelop are you using? MonoDevelop 2.8 can open .NET 4.0 projects (I believe 2.6 can as well). In fact, in 2.8 .NET 4.0 is the default for all new projects.
MonoDevelop's VB.NET addin still doesn't support .NET 4.0. It would work for C# projects.
Using a text editor, change your *.vbproj file to add the following line:
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
to the first PropertyGroup, e.g.
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
...
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
</PropertyGroup>
.net framework 4.0 not yet completly implemented in mono
but includes most of the features
try to download latest version of mono and retry:)
I had the same problem in version 3.0 of MonoDevelop.
VBNET development have changed the runtime. NET
Tools> Options> Runtimes. NET
I have marked as default MONO 2.x
Related
I have an ASP.NET Core 2.1 Preview 2 project that has a few .NET Standard 2.0 libraries.
I'm using Visual Studio 2017 15.7 Preview 6.
I have to use Preview version of VS because ASP.NET Core 2.1 is in preview as well and requires the preview version of VS.
Everytime I try to debug, I'm getting errors that read:
Metadata file 'C:\Users\sam\OneDrive\Documents\Visual Studio
2017\Projects\MyProject\MyProject.MyClassLibraryProject\bin\Debug\netstandard2.0\MyProject.MyClassLibraryProject.dll'
could not be found
All of the projects are in the same folder for the solution.
I just rebuilt my Windows 10 PC and installed everything fresh. I was having some issues building this project in VS before but not this particular error. The problem before was that I could build and debug the solution but I couldn't publish it to Azure for x64. I'd made the Visual Studio team aware of the issue but they couldn't come up with any answers so I decided to clean up the PC and start fresh. Now, I'm having this new issue!
I also want to mention that up until a few minutes ago, I could actually build and debug the solution but I had to do a Build Solution. If I did a Rebuild Solution, I'd get errors indicating missing references to my class library projects. This worked for a while but I then realized that even in debug mode, I couldn't hit my break points. So I decided to do a Clean Solution and ever since I'm now getting this new error and I just can't build or debug my solution.
In the csproj file for the ASP.NET Core 2.1 project, I see these entries. Do I need them?
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
Any idea how to fix this error?
You may try the latest Visual Studio 2017 15.7 Final with .NET Core 2.1 RC1. It solves my issue on version VS2017 15.7 Preview 4 with .NET Core 2.1 Preview 2.
One of the quirks of VS. Using VS 2017, I had the same issue where all the references were showing like they were unavailable. Running "Restore Nuget Packages" didn't help.
Out of curiosity, I picked one of the projects having the problem, checked Properties of the project, and changed the Target framework from .Net Standard 2.0 down to 1.6. Saved, then changed it back to 2.0, and all the warnings across the Solution updated themselves, and the missing SDK and NuGet references were "found". Built immediately.
My Xamarin.Forms project targets PCL profile 259. I recently read a lot of moving to .NET Standard, but it looks very painful to do.
Currently I develop in Visual Studio 2015 Update 3. But will give VS 2017 a try soon.
My solution consists of:
Common PCL library
Android specific project
iOS specific project
My Questions:
How can I convert from Profile 259 to latest .NET Standard?
Is there some official converson guide from Xamarin / Microsoft Team already available?
My Xamarin.Forms Android and iOS Apps are built in VSTS. Does VSTS support .NET Standard or would I end up in build errors?
Thanks in advance for any good solution.
To change a PCL to .NET Standard you just need to go to the Properties of your PCL and select Target .NET Standard Platform
Then create a project.json file, if it didn't already create one for you and insert the following.
{
"supports": {},
"dependencies": {
"NETStandard.Library": "1.6.0",
"Xamarin.Forms": "2.3.4.192-pre2"
},
"frameworks": {
"netstandard1.3": {
"imports": "portable-net45+win8+wpa81"
}
}
}
You need the imports to allow non .NET Standard libraries to be added.
In VS 2017 it gets different. While the above will continue to work, you can have a full .NET Standard library as a csproj (no longer an xproj), and have it happily work with Xamarin.
However, there is no automatic conversion (that I know of), so what I normally do, is edit the csproj and completely replace it with the following. Just delete everything in that file and put the following.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard1.3</TargetFramework>
<AssemblyName>MyLibraryName</AssemblyName>
<PackageId>MyLibraryName</PackageId>
<NetStandardImplicitPackageVersion>1.6.0</NetStandardImplicitPackageVersion>
<PackageTargetFallback>$(PackageTargetFallback);portable-win+net45+wp8+win81+wpa8</PackageTargetFallback>
</PropertyGroup>
</Project>
You will then have to add your references and NuGet packages manually, again. With the PackageTargetFallback, this line is similar to the imports in project.json.
In regards to VSTS, I know that the first method with VS2015 works just fine, as I have done it myself. The VS2017 method should work with VSTS, however I haven't personally tried that just yet.
I read this article a while ago:
https://blog.xamarin.com/net-standard-library-support-for-xamarin/
So, I converted all of our libraries from portable libraries to .NET Standard (1.4). I did this because the article says "This PCL now needs to be upgraded to target the .NET Standard Library, which can be found in the projects properties.".
However, I can't figure out how to build a Xamarin Forms project that targets .NET Standard. I cloned the Xamarin Forms samples, and opened up the MasterDetailPage project. I went in to the project properties and switched from portable to .NET Standard as per the instructions. Immediately, I get an error telling me that I need to opt in to NuGet 3.0 support. I'm fine with this, but how do I do it?
I found that if I remove the Xamarin Forms NuGet package, I am able to switch over to .NET Standard. However, once I have done this, I can't add the Xamarin Forms NuGet package back. It just keeps failing. Contrary to what the article says, I cannot add references to .NET Standard libraries. When I try to add a reference to existing .NET Standard libraries in my Solution, Visual Studio just gives me an error saying that the library is not compatible. Which version of .NET Standard should I be targeting for Xamarin Forms?
How do I get a .NET Standard library compiling with Xamarin Forms support?
If you wanna do it with the new Visual Studio 2017 release with csproj instead of project.json you can either use dotnet migrate CLI command or add/edit this code to your csproj file:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<PackageTargetFallback>$(PackageTargetFallback);portable-win+net45+wp8+win81+wpa8</PackageTargetFallback>
</PropertyGroup>
</Project>
It turns out that you can get a .NET Standard project to reference the Xamarin Forms NuGet package, and therefore be able to leverage .NET Standard libraries in Xamarin Forms.
This article more or less explains how to do it. The trick is to import the portable framework in the project.json.
https://xamarinhelp.com/dot-net-standard-pcl-xamarin-forms/
If you can't get it working, here is a Git sample that does work.
https://github.com/adamped/XamarinForms.NetStandard.git
I was eventually able to target .NET Standard 1.4 without issues.
Today I installed the .NET Framework 4.5 on my machine expecting to be able to use it from Visual Studio 2010, since it's just a minor update that should't pose problems for Visual Studio 2010. Unfortunately I am not, even manually removing certain 4.0 and adding the corresponding 4.5 assemblies resulted in the original 4.0 assemblies still being referenced in the project.
Is it possible to target version 4.5 from Visual Studio 2010 and if yes, how? I'd really like to use the ribbons...
Each version of Visual Studio prior to Visual Studio 2010 is tied to a specific .NET framework. (VS2008 is .NET 3.5, VS2005 is .NET 2.0, VS2003 is .NET1.1) Visual Studio 2010 and beyond allow for targeting of prior framework versions but cannot be used for future releases. You must use Visual Studio 2012 in order to utilize .NET 4.5.
There are pretty limited scenarios that I can think of where this would be useful, but let's assume you can't get funds to purchase VS2012 or something to that effect. If that's the case and you have Windows 7+ and VS 2010 you may be able to use the following hack I put together which seems to work (but I haven't fully deployed an application using this method yet).
Backup your project file!!!
Download and install the Windows 8 SDK which includes the .NET 4.5 SDK.
Open your project in VS2010.
Create a text file in your project named Compile_4_5_CSharp.targets with the following contents. (Or just download it here - Make sure to remove the ".txt" extension from the file name):
<Project DefaultTargets="Build"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Change the target framework to 4.5 if using the ".NET 4.5" configuration -->
<PropertyGroup Condition=" '$(Platform)' == '.NET 4.5' ">
<DefineConstants Condition="'$(DefineConstants)'==''">
TARGETTING_FX_4_5
</DefineConstants>
<DefineConstants Condition="'$(DefineConstants)'!='' and '$(DefineConstants)'!='TARGETTING_FX_4_5'">
$(DefineConstants);TARGETTING_FX_4_5
</DefineConstants>
<PlatformTarget Condition="'$(PlatformTarget)'!=''"/>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<!-- Import the standard C# targets -->
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- Add .NET 4.5 as an available platform -->
<PropertyGroup>
<AvailablePlatforms>$(AvailablePlatforms),.NET 4.5</AvailablePlatforms>
</PropertyGroup>
</Project>
Unload your project (right click -> unload).
Edit the project file (right click -> Edit *.csproj).
Make the following changes in the project file:
a. Replace the default Microsoft.CSharp.targets with the target file created in step 4
<!-- Old Import Entry -->
<!-- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> -->
<!-- New Import Entry -->
<Import Project="Compile_4_5_CSharp.targets" />
b. Change the default platform to .NET 4.5
<!-- Old default platform entry -->
<!-- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> -->
<!-- New default platform entry -->
<Platform Condition=" '$(Platform)' == '' ">.NET 4.5</Platform>
c. Add AnyCPU platform to allow targeting other frameworks as specified in the project properties. This should be added just before the first <ItemGroup> tag in the file
<PropertyGroup Condition="'$(Platform)' == 'AnyCPU'">
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
.
.
.
<ItemGroup>
.
.
.
Save your changes and close the *.csproj file.
Reload your project (right click -> Reload Project).
In the configuration manager (Build -> Configuration Manager) make sure the ".NET 4.5" platform is selected for your project.
Still in the configuration manager, create a new solution platform for ".NET 4.5" (you can base it off "Any CPU") and make sure ".NET 4.5" is selected for the solution.
Build your project and check for errors.
Assuming the build completed you can verify that you are indeed targeting 4.5 by adding a reference to a 4.5 specific class to your source code:
using System;
using System.Text;
namespace testing
{
using net45check = System.Reflection.ReflectionContext;
}
When you compile using the ".NET 4.5" platform the build should succeed. When you compile under the "Any CPU" platform you should get a compiler error:
Error 6: The type or namespace name 'ReflectionContext' does not exist in
the namespace 'System.Reflection' (are you missing an assembly reference?)
FYI, if you want to create an Installer package in VS2010, unfortunately it only targets .NET 4. To work around this, you have to add NET 4.5 as a launch condition.
Add the following in to the Launch Conditions of the installer (Right click, View, Launch Conditions).
In "Search Target Machine", right click and select "Add Registry Search".
Property: REGISTRYVALUE1
RegKey: Software\Microsoft\NET Framework Setup\NDP\v4\Full
Root: vsdrrHKLM
Value: Release
Add new "Launch Condition":
Condition: REGISTRYVALUE1>="#378389"
InstallUrl: http://www.microsoft.com/en-gb/download/details.aspx?id=30653
Message: Setup requires .NET Framework 4.5 to be installed.
Where:
378389 = .NET Framework 4.5
378675 = .NET Framework 4.5.1 installed with Windows 8.1
378758 = .NET Framework 4.5.1 installed on Windows 8, Windows 7 SP1, or Windows Vista SP2
379893 = .NET Framework 4.5.2
Launch condition reference: http://msdn.microsoft.com/en-us/library/vstudio/xxyh2e6a(v=vs.100).aspx
I have been struggling with VS2010/DNFW 4.5 integration and have finally got this working. Starting in VS 2008, a cache of assemblies was introduced that is used by Visual Studio called the "Referenced Assemblies". This file cache for VS 2010 is located at \Reference Assemblies\Microsoft\Framework.NetFramework\v4.0. Visual Studio loads framework assemblies from this location instead of from the framework installation directory. When Microsoft says that VS 2010 does not support DNFW 4.5 what they mean is that this directory does not get updated when DNFW 4.5 is installed. Once you have replace the files in this location with the updated DNFW 4.5 files, you will find that VS 2010 will happily function with DNFW 4.5.
From another search. Worked for me!
"You can use Visual Studio 2010 and it does support it, provided your OS supports .NET 4.5.
Right click on your solution to add a reference (as you do). When the dialog box shows, select browse, then navigate to the following folder:
C:\Program Files(x86)\Reference Assemblies\Microsoft\Framework\.Net Framework\4.5
You will find it there."
I have project that have to be build with different framework versions including .net 1.1.
To build project with .net 1.1 I need to change Project's ToolsVersion to 2.0, but for other frameworks it must be set to 4.0
Is it possible to implement such behavior in Visual Studio?
Something like this in csproj file:
<Project ToolsVersion=" if $(Configuration) == DOT_NET1_1 THEN '2.0' ELSE '4.0'">
No. The ToolsVersion attribute is set automatically by the version of Visual Studio used to open the project file. The properties that the ToolsVersion controls are reserved and cannot be modified by msbuild. I don't have experience with compiling in .NET 1.1, so I don't know if this is the most elegant solution, but:
In lieu of constantly changing this attribute, the only thing I can think of is to create two different project files, one for compiling in .NET 1.1 and the other for compiling in the other frameworks. They can both reference the same source files, referenced dlls, etc, just be sure not to have them in the same solution, or Visual Studio 2010 will try to upgrade the project file with the older ToolsVersion.