Migrate from .net Framework to .NET v8
Suggestion / Request Please migrate from .net Framework v4.x to .NET v8 so that development can also happen in Linux or other OS
I tried to do restore and build the vedastro project with the .NET CLI in linux ( with dotNET v8 installed including .NET SDK, runtime etc ) but get the following errors when running in project folder
$ dotnet restore ..../vedastro/VedAstro-master/VedAstro.sln : Solution file error MSB4249: Unable to build website project "Demo". The ASP.NET compiler is only available on the .NET Framework version of MSBuild.
$ dotnet build MSBuild version 17.8.5+b5265ef37 for .NET ..../vedastro/VedAstro-master/VedAstro.sln : Solution file error MSB4249: Unable to build website project "Demo". The ASP.NET compiler is only available on the .NET Framework version of MSBuild.
Build FAILED.
..../vedastro/VedAstro-master/VedAstro.sln : Solution file error MSB4249: Unable to build website project "Demo". The ASP.NET compiler is only available on the .NET Framework version of MSBuild. 0 Warning(s) 1 Error(s)
Time Elapsed 00:00:00.16
in ..../vedastro/VedAstro-master/VedAstro.sln mentions the target framework as ".NETFramework,Version%3Dv4.8"
.....
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "Demo", "Website\wwwroot\Demo\", "{2F09E7A5-58C0-4EFD-BD22-71678744D513}"
ProjectSection(WebsiteProperties) = preProject
TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.8"
.....
Debug.AspNetCompiler.PhysicalPath = "Website\wwwroot\Demo\"
.....
Release.AspNetCompiler.PhysicalPath = "Website\wwwroot\Demo\"
.....
SlnRelativePath = "Website\wwwroot\Demo\"
EndProjectSection
EndProject
.....
on a side note - you can change the name of the website from 'Demo' to 'VedAstro' as its no longer a demo but a well functioning website
I believe the project targets the closed source .net framework v4.x, migrating to opensource .NET (core ) v8 with help of visual studio can solve this problem so that the project can become compatible for work in Linux environment, and I ( or anyone ) can try to make some contribution to project
We can have a different a git branch for this .NET version and gradually making this 'main' branch and current git 'master' branch be made 'legacy-dotnet' in time.
Some info related to migration / porting https://learn.microsoft.com/en-us/dotnet/core/porting/ advises to use upgrade-assistant https://learn.microsoft.com/en-us/dotnet/core/porting/upgrade-assistant-overview https://www.nuget.org/packages/upgrade-assistant#versions-body-tab
All is .net 8 or 7, no v4 in use. The demo project is just for testing purposes, it's not ment to be built. You just need Library project to build. Don't build the sln file, target the Library folder instead which contains the cproj file
Your advice to build by targeting particular folders worked
$ dotnet build ./Library
$ dotnet build ./Website
and runnig the website as
$ dotnet run --project ./Website
which worked fine
But when tried to build ./API similarly it initially gave error
Could not copy the file ".API/local.settings.json" because it was not found.
copied and renamed the file .API/local.settings.sample.json
I also learned that this is something to do with azure functions and installed azurite for local developement and started azurite with only --location and --debug flags
$ azurite --location ./data/azurite/ --debug ./debug/azurite/
and then it required dotnet 7 to be installed when ./API was run, which I also installed.
Now when run ./API, throws some more errors which I dont know how to solve
$ dotnet run --project ./API
Unhandled exception. System.InvalidOperationException: The gRPC channel URI 'http://:' could not be parsed.
at Microsoft.Extensions.DependencyInjection.GrpcServiceCollectionExtensions.GetFunctionsHostGrpcUri(IConfiguration configuration) in D:\a\_work\1\s\src\DotNetWorker.Grpc\GrpcServiceCollectionExtensions.cs:line 97
at Microsoft.Extensions.DependencyInjection.GrpcServiceCollectionExtensions.<>c.<AddGrpc>b__1_3(GrpcWorkerStartupOptions grpcWorkerStartupOption, IConfiguration config) in D:\a\_work\1\s\src\DotNetWorker.Grpc\GrpcServiceCollectionExtensions.cs:line 72
at Microsoft.Extensions.Options.ConfigureNamedOptions`2.Configure(String name, TOptions options)
at Microsoft.Extensions.Options.OptionsFactory`1.Create(String name)
at Microsoft.Extensions.Options.UnnamedOptionsManager`1.get_Value()
at Microsoft.Azure.Functions.Worker.Grpc.GrpcWorkerClientFactory..ctor(GrpcHostChannel outputChannel, IOptions`1 startupOptions) in D:\a\_work\1\s\src\DotNetWorker.Grpc\GrpcWorkerClientFactory.cs:line 29
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
at System.Reflection.ConstructorInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitIEnumerable(IEnumerableCallSite enumerableCallSite, RuntimeResolverContext context)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.CreateServiceAccessor(Type serviceType)
at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider provider)
at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)
at API.Program.Main(String[] args) in /media/daniel/Work/sourcecodes_langlibfwdb/tools applications/astrology/vedastro/VedAstro-master/API/Program.cs:line 13
at API.Program.<Main>(String[] args)
searched online for why error like ' The gRPC channel URI 'http://:' could not be parsed. ' is happening found advices that installing the following nuget packages solved error Microsoft.Azure.Functions.Worker.Sdk Microsoft.Azure.WebJobs.Extensions But the above packages were already installed in my the system when doing 'dotnet restore'
Some error are confusing like the reference to a file path in D: drive - D:\a_work\1\s\src\DotNetWorker.Grpc\GrpcServiceCollectionExtensions.cs I run a linux machine, there are no C, D drives in my harddisk. I searched for any reference ( for DotNetWorker ) in the repo, but couldnt find any, not sure where dotnet is picking the path from !!
Some help would be nice here. You could also write some notes in readme section on how to do the development setup for this project to contribute
( on side note - I'm trying to learn C# and dotnet in the past weeks, so that I could contribute back something )
@ar-daniel Kudos! π I did not expect anyone to come this far with Linux. Since that was never the intended target platform. But I could not be happier! π We should make a new repo titled "Vedic Astrology for Linux", with a readme & files dedicated for that setup. Too much stuff in 1 repo, confuses beginners especially. I'm sending you invite to the org, please accept & start a new repo for linux if your hearts desires itπ.
As for the error you're seeing it is just missing API KEYS... You'll need several API keys to make it start kicking.
- Azure & Google Geolocation API (we need 2 because one is good at timezone the other is good at location names),
- Azure Data Tables API key (caching is the secret, the speed & crazy cheap cost of VedAstro API, is because it is built in so deep with so much of the structure to remove would be worse, meaning technically you don't need it but, you need to seriously modify the code)
Having said that.....the point is to help everybody run their own servers ASAP at 0 cost so. Contact me in (Slack PM/Google Meet) if you're super serious about hosting your own server, I'll pass you the keys at no cost. But only for temp development purposes.
Also there is a reason why we have super cheap hosted Public API still. Because the Azure & Google API costs are high, ppl don't realize until the bill comes. So if you use the Public API, 90% of the API cost has already been paid by users before you. Hence every user gets a much cheaper price per call by sharing from a common data pool.
π€ If you're wondering how cheap the Dedicated Server is? only $1/month for 1 million requests π€― (even if you host your self at home on solar panel βοΈ you won't get this price π)
π https://buy.stripe.com/5kA8y67nVchNdqw4gx
Thank you for the invite and I've joined.
Having a single repo by functionality is good. than having one separate for linux, ( we can however move the reference materials/ books to separate repo and keep only the code here ) and can have development instructions for each OS in same repo.
as for targeting linux desktop, it miight not be possible as dotnet MAUI to build for linux desktop application is not being supported by Microsoft, at least currently. https://learn.microsoft.com/en-us/dotnet/maui/supported-platforms?view=net-maui-8.0 though linux desktop apps with dotnet is possible with UNO https://platform.uno/uno-platform-for-linux/# I'm planning to use linux for development purpose with dotnet and contribute for now we ll have to use web based or console based application for linux
I'm trying run the API server locally in my computer, for both development and personal use, ( not intending to host my own server. )
So, for running locally I still need ?
- Azure Geolocation API key,
- Google Geolocation API key,
- Azure Data Tables API key ( will Azurite not take care of this ? as it is meant for local development ) https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azurite?tabs=npm%2Ctable-storage
so in local.settings.json, could you please advise on the necessary changes
{
"IsEncrypted": false,
"Values": {
"AzureMapsAPIKey": "xxx", // <- Azure Geolocation API key goes here ?
// and where does Google Geolocation API key go ?
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated",
"WEBSITE_STORAGE": "xxxx", // what goes here ?
"BING_IMAGE_SEARCH": "xxxx",
"API_STORAGE": "xxxx", // <- Azure Data Tables API key goes here ?
"WEB_STORAGE": "xxxx", // what goes here ?
"AutoEmailerConnectString": "xxxx",
"SLACK_EMAIL_WEBHOOK": "xxxx",
"IpDataAPIKey": "xxxx" // what goes here ?
}, // I think the other fields like emailer string, bing search and slack webhook
// are not needed for essential operation, that is to make API.csproj running
...
}
and I don't understand what is the Public API your are referring to
So, for running locally I still need ?
Yes and no, only some astro calls for time and location parsing API key is required. If you code it, then it is possible.
and I don't understand what is the Public API your are referring to
Public API --> https://vedastro.org/APIBuilder
please kindly clarify what the different fields in the local.settings.json file represent ( ones that Ive commented ), Thanks
so in local.settings.json, could you please advise on the necessary changes
{ "IsEncrypted": false, "Values": { "AzureMapsAPIKey": "xxx", // <- Azure Geolocation API key goes here ? // and where does Google Geolocation API key go ? "AzureWebJobsStorage": "UseDevelopmentStorage=true", "FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated", "WEBSITE_STORAGE": "xxxx", // what goes here ? "BING_IMAGE_SEARCH": "xxxx", "API_STORAGE": "xxxx", // <- Azure Data Tables API key goes here ? "WEB_STORAGE": "xxxx", // what goes here ? "AutoEmailerConnectString": "xxxx", "SLACK_EMAIL_WEBHOOK": "xxxx", "IpDataAPIKey": "xxxx" // what goes here ? }, // I think the other fields like emailer string, bing search and slack webhook // are not needed for essential operation, that is to make API.csproj running ... }
I am facing the exact same issue on macOS. Pls help @sengiv
Also I am not able to donate and get server at Ko-fi with error as "Non complaint recurring Transaction" as per RBI rules in India, Pls provide any alternate way
please kindly clarify what the different fields in the local.settings.json file represent ( ones that Ive commented ), Thanks
@ar-daniel your comments looks good to me π
i'm sorry forgotten the keys and their purpose, i would just search the keys by name in the code and check. π§ Lost interest in opening VS these days, so I can't check now. If i get info will inform you.
I am facing the exact same issue on macOS. Pls help @sengiv
ππ thanks for reporting
Ok, now i know the demand for this increasing.
π‘Easy solution is to just publish an .exe or dmg of the API Server.
then you guys can just double click and run it without VS build process and the KEY issues π (@ar-daniel would you prefer this as well?)
π§ the idea has been brewing for the past few days, but no motivation ram it out yet. Will see π
Also I am not able to donate and get server at Ko-fi with error as "Non complaint recurring Transaction" as per RBI rules in India, Pls provide any alternate way
Thanks for thinking to donate...means alot πππ
Dedicated API Server βΉ200/month --> https://buy.stripe.com/3cs9CaeQnepVeuA00l
Indian UPI Customers
ππ thanks for reporting Ok, now i know the demand for this increasing. π‘Easy solution is to just publish an
.exeordmgof the API Server. then you guys can just double click and run it without VS build process and the KEY issues π (@ar-daniel would you prefer this as well?)
That would be a temporary fix, though it is nice to have Since .exe and .dmg wont work with linux, you would need to build a linux executable ( these generally don't have extensions ) As permanent fix, there needs to be a way to build ./API folder directly in linux, so that development and testing can be done before sending pull request ( you can also share build scripts you use building executable in linux )
While you are at it. you may want to change the target framework from .NET 7 to 8 for ./API and ./Library among others as .NET 7 has reached end of life as of May 2024 and also for uniformity in code base guessing this could also be cause for the build errors
meanwhile, as you suggested, I will try searching for field names in local.settings.json in the code repo to get idea of its usage
@ar-daniel I've got a linux build, to test if it works. I need you to run and send me back screen shot? files are to big to paste here, pls contact via WA/telegram if you're serious to work this out ---> +601113395387
Telegram says - the no you mentioned is not on telegram. Could please try updating your Telegram app
alternatively you can also try following to send files
https://mega.io/share 20 GB free storage
https://www.mediafire.com/ https://app.mediafire.com/myfiles 10 GB free storage
https://safenote.co/upload-file 20MB transfer limit
https://www.file.io/ 2 GB transfer limit
Telegram says - the no you mentioned is not on telegram. Could please try updating your Telegram app
try this telegram link --> https://t.me/vedastro_org
I am also interested in running this repo in linux system.
Also, can we deploy this in AWS or Google cloud?
@namelessperson0 thank you for bring up this issue....since I don't run linux, there has been 0 motivation for me to work this out.
Technically it should work, last i remember @ar-daniel got API & Library project to build. Then you install .NET 8 and Azure Function Tools. Then you should have a basic API server running, you'll run into GRPC/Key errors when resolving location names, but if you type in coordinates directly instead of location (35.65,139.83), it should work.
Also as mentioned above the best step is to make a new repo dedicated for Linux.....@namelessperson0 if you're up for this, I'd be better able to help you. π since it would be more systematic.
Almost forgot, Docker is also an option, there is a dockerfile in the repo somewhere (not 100% sure if working)
PS: remember there is Python library available and a free unlimited API....so that this linux headache can be put aside. π And you can focus more on front end then back end....don't forget for full backend API server, you need API keys from Google and Azure....all that is taken care of if you use the "Free & anonymous API" π π
@namelessperson0 thank you for bring up this issue....since I don't run linux, there has been 0 motivation for me to work this out.
Technically it should work, last i remember @ar-daniel got
API&Libraryproject to build. Then you install .NET 8 and Azure Function Tools. Then you should have a basic API server running, you'll run into GRPC/Key errors when resolving location names, but if you type in coordinates directly instead of location (35.65,139.83), it should work.Also as mentioned above the best step is to make a new repo dedicated for Linux.....@namelessperson0 if you're up for this, I'd be better able to help you. π since it would be more systematic.
Almost forgot, Docker is also an option, there is a dockerfile in the repo somewhere (not 100% sure if working)
PS: remember there is Python library available and a free unlimited API....so that this linux headache can be put aside. π And you can focus more on front end then back end....don't forget for full backend API server, you need API keys from Google and Azure....all that is taken care of if you use the "Free & anonymous API" π π
I am quite happy to hear your response.
I can create new repo for linux. But, as you suggested, I would prefer to use python library for now.
Thanks again.