Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installing on Linux #72

Closed
proffalken opened this issue Apr 13, 2018 · 10 comments
Closed

Installing on Linux #72

proffalken opened this issue Apr 13, 2018 · 10 comments

Comments

@proffalken
Copy link

Hello, I'm working on getting this working on Arch Linux and have currently undertaken the following steps:

  1. Install dotnet core and dotnet sdk
  2. Update global.json to use the installed SDK version (2.1.103 in my case)
  3. Migrate to a csproj-version instead of xproj using dotnet migrate
  4. Exported the appropriate variable so that I'm using the correct version of the framework in Mono ( export FrameworkPathOverride=/usr/lib/mono/4.5)
  5. Export the correct value for dotnet to run on the commandline (export TERM=xterm)
  6. Executed the dotnet build command

All of the above leads to the following error repeated for each component:

/opt/dotnet/sdk/2.1.103/Sdks/Microsoft.NET.Sdk/build/Microsoft.NET.TargetFrameworkInference.targets(96,5): error : The TargetFramework value 'dnx451' was not recognized. It may be misspelled. If not, then the TargetFrameworkIdentifier and/or TargetFrameworkVersion properties must be specified explicitly. [/home/mmw/Projects/DevOps/Socioboard-Core-3.0/src/SocioboardDataServices/SocioboardDataServices.csproj]

and an additional number of errors like the following which all appear to be related to the System.Runtime library missing:

Controllers/IndexController.cs(1051,66): error CS0012: The type 'ValueType' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. [/home/mmw/Projects/DevOps/Socioboard-Core-3.0/src/Socioboard/Socioboard.csproj]

Does anyone know how to solve this?

@obusher
Copy link

obusher commented May 7, 2018

dnx451 seems to be deprecated and is replaced by net451.
(Source: https://stackoverflow.com/questions/31539341/project-json-definition-dnx451-vs-dotnet-4-51)

The error vanishes if you replace all dnx451 strings with net451, but there are still many assembly-reference-errors.

Use grep --exclude-dir=backup/ -rnw '.' -e 'dnx451' in the socioboard directory to show all files which hold a string dnx451.

To replace dnx451 with net451 use grep --exclude-dir=backup/ -rl '.' -e 'dnx451' | xargs sed -i 's/dnx451/net451/g'.

@obusher
Copy link

obusher commented May 8, 2018

  1. Install .NET SDK (https://www.microsoft.com/net/learn/get-started/linux/ubuntu16-04)
  2. Update global.json to use actual .NET SDK-Version (2.1.105)
  3. Run dotnet migrate
  4. Run dotnet restore
  5. Run msbuild Socioboard.sln
  6. Replace dnx451 strings with net451 (See post above)
  7. Run dotnet restore and msbuild Socioboard.sln
  8. Add <Reference Include="System.Web" /> in src/Api.Socioboard/Api.Socioboard.csproj and src/SocioboardboardmeDataServices/SocioboardboardmeDataServices.csproj.
  9. Run msbuild Socioboard.sln
  10. Add <Reference Include="System.Web.Extensions" /> in src/Api.Socioboard/Api.Socioboard.csproj .
  11. Adding public string userPrimaryEmail; in Socioboard-Core-3.0/src/Domain.Socioboard/Models/Mongo/FacebookPasswordChangeUserDetail.cs
  12. Run dotnet restore and msbuild Socioboard.sln and it should build without errors! (8 warnings)

@proffalken
Copy link
Author

Wow, thanks, I'll give this a go shortly.

@obusher
Copy link

obusher commented May 9, 2018

Building the solutions works fine, but publishing does not work yet. (dotnet publish)

The FrameworkPathOverride issue seems to be a little tricky. I am thinking about using a NuGet package which contains reference assemblies, mentioned in dotnet/sdk#1406 and https://stackoverflow.com/questions/44770702/build-nuget-package-on-linux-that-targets-net-framework/44773795#44773795

@RCheesley
Copy link

Probably worth mentioning for those on 18.04 you might have some issues installing dotnet. More details here: dotnet/core#1400 (comment)

@RCheesley
Copy link

Following the steps above (as a newbie to dotnet & with basic CLI experience, be kind!) I got a bit stuck.

Firstly, I was getting an error of 'command msbuild not found' - presume it needs to be invoked as a sub-command of dotnet?

If that's the case I'm getting some errors :

/usr/share/dotnet/sdk/2.1.300-preview2-008533/Microsoft.Common.CurrentVersion.targets(1179,5): error MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.5.1" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend. [/home/myhome/applications/Socioboard-Core-3.0/src/Socioboard.Google/Socioboard.Google.csproj]

Below is the contents of the file mentioned (after following the steps above)

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net451</TargetFramework>
    <AssemblyName>Socioboard.Google</AssemblyName>
    <PackageId>Socioboard.Google</PackageId>
    <NetStandardImplicitPackageVersion>1.6.0</NetStandardImplicitPackageVersion>
    <GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
    <GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
    <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
  </PropertyGroup>

  <ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
    <PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.3" />
    <Reference Include="System.Data" />
    <Reference Include="System.Xml" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System" />
    <Reference Include="Microsoft.CSharp" />
  </ItemGroup>

</Project>

Did I miss a step somewhere along the way? Any help gratefully received!

@obusher
Copy link

obusher commented May 9, 2018 via email

@obusher
Copy link

obusher commented May 15, 2018

I tried to build the whole project with the MonoDevelop IDE and it works (https://www.monodevelop.com/). Furthermore there is no MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.5.1" were not found. - error if you run the solution, but it seems the Arguments of the Run-Configuration of the solution (project) are not set properly.

Exception:

"  at System.IO.Path.Combine (System.String path1, System.String path2) [0x00003] in /build/mono-5.10.1.47/mcs/class/corlib/System.IO/Path.cs:101 \n  
at Api.Socioboard.Startup..ctor (Microsoft.AspNetCore.Hosting.IHostingEnvironment env) [0x00084] in /workspace/Socioboard-Core-3.0/src/Api.Socioboard/Startup.cs:38 \n  
at (wrapper managed-to-native) System.Reflection.MonoCMethod.InternalInvoke(System.Reflection.MonoCMethod,object,object[],System.Exception&)\n  
at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00002] in /build/mono-5.10.1.47/mcs/class/corlib/System.Reflection/MonoMethod.cs:661 \n
--- End of stack trace from previous location where exception was thrown ---\n  
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /build/mono-5.10.1.47/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152 \n  
at Microsoft.Extensions.Internal.ActivatorUtilities+ConstructorMatcher.CreateInstance (System.IServiceProvider provider) [0x000bc] in <4033675c36524cc598581b8c5269c528>:0 \n 
at Microsoft.Extensions.Internal.ActivatorUtilities.CreateInstance (System.IServiceProvider provider, System.Type instanceType, System.Object[] parameters) [0x000af] in <4033675c36524cc598581b8c5269c528>:0 \n  
at Microsoft.Extensions.Internal.ActivatorUtilities.GetServiceOrCreateInstance (System.IServiceProvider provider, System.Type type) [0x0000b] in <4033675c36524cc598581b8c5269c528>:0 \n  
at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.GetServiceOrCreateInstance (System.IServiceProvider provider, System.Type type) [0x00000] in <4033675c36524cc598581b8c5269c528>:0 \n  
at Microsoft.AspNetCore.Hosting.Internal.StartupLoader.LoadMethods (System.IServiceProvider services, System.Type startupType, System.String environmentName) [0x0002c] in <355690494f4c4a0da00c09dcc85b6e89>:0 \n  
at Microsoft.AspNetCore.Hosting.WebHostBuilderExtensions+<>c__DisplayClass1_0.<UseStartup>b__1 (System.IServiceProvider sp) [0x00014] in <355690494f4c4a0da00c09dcc85b6e89>:0 \n  
at Microsoft.Extensions.DependencyInjection.ServiceLookup.FactoryService.Invoke (Microsoft.Extensions.DependencyInjection.ServiceProvider provider) [0x0000b] in <e111ec867dbc409e995ecdac6ef9df88>:0 \n  
at Microsoft.Extensions.DependencyInjection.ServiceProvider+ScopedCallSite.Invoke (Microsoft.Extensions.DependencyInjection.ServiceProvider provider) [0x00026] in <e111ec867dbc409e995ecdac6ef9df88>:0 \n  
at Microsoft.Extensions.DependencyInjection.ServiceProvider+SingletonCallSite.Invoke (Microsoft.Extensions.DependencyInjection.ServiceProvider provider) [0x00000] in <e111ec867dbc409e995ecdac6ef9df88>:0 \n  
at Microsoft.Extensions.DependencyInjection.ServiceProvider+<>c__DisplayClass12_0.<RealizeService>b__0 (Microsoft.Extensions.DependencyInjection.ServiceProvider provider) [0x00033] in <e111ec867dbc409e995ecdac6ef9df88>:0 \n  
at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService (System.Type serviceType) [0x00017] in <e111ec867dbc409e995ecdac6ef9df88>:0 \n  
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService (System.IServiceProvider provider, System.Type serviceType) [0x0002e] in <4033675c36524cc598581b8c5269c528>:0 \n  
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T] (System.IServiceProvider provider) [0x0000e] in <4033675c36524cc598581b8c5269c528>:0 \n  
at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureStartup () [0x00009] in <355690494f4c4a0da00c09dcc85b6e89>:0 \n  
at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureApplicationServices () [0x00008] in <355690494f4c4a0da00c09dcc85b6e89>:0 \n  
at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication () [0x00000] in <355690494f4c4a0da00c09dcc85b6e89>:0 \n  
at Microsoft.AspNetCore.Hosting.Internal.WebHost.Initialize () [0x00008] in <355690494f4c4a0da00c09dcc85b6e89>:0 \n  
at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build () [0x00061] in <355690494f4c4a0da00c09dcc85b6e89>:0 \n  at Api.Socioboard.Program.Main (System.String[] args) [0x00001] in /workspace/Socioboard-Core-3.0/src/Api.Socioboard/Program.cs:15 "


@proffalken
Copy link
Author

FWIW, I've given up with this and I'm currently working on a very simple Social Media Management tool that will integrate with Mautic, Saelos, and SHLink.

If it gets to a point where I think it's worth publishing, I'll release it as open source.

This looks like an amazing project, but I don't have the time to invest in getting it running on Linux right now. :(

@RCheesley
Copy link

RCheesley commented May 16, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants