-
Notifications
You must be signed in to change notification settings - Fork 255
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
Question: Correct way to set up a SG project, which has a dependency to other projects/libs, to work in VS #774
Comments
@egil It's your global.json I believe. If you add a version all the errors go away, e.g. {
"sdk": {
"version": "3.0",
"rollForward": "latestMajor",
"allowPrerelease": false
}
} I don't know why - you're not supposed to need a version with latestMajor, but it's something to do with VS and the way it handles SDKs I guess. |
Gah, of course. Thanks @SQL-MisterMagoo. I'll give it a go when I get home. |
@SQL-MisterMagoo it didnt fix bit for me unfortunately. If you ran a This is the output of my
|
@egil You are right, I hadn't tested far enough, but I have now. If you make the change to global.json, you resolve the problem with .NET5 dependencies in VS 2019. If you also downgrade your Again, I don't know why - but the error I was getting was that it couldn't load Microsoft.Extensions.DependencyInjection.Abstractions, Version=3.1.0.0 - this made me think maybe something is forcing a downgrade, which led me to try downgrading to 3.1.0, which worked. |
There are some limitations for SG when running from VS The issue is different, but I remember there are other issues that point out, that VS is not using .Net Core yet. |
That makes sense. Did you get the sample working by referencing the genzor project directly? If so, how? |
@SQL-MisterMagoo Confirmed it also works on my computer. The trick was to set the versions to 3.1.0. I am still getting a bunch of Anyway, ill close this issue and check for related issues to |
I have a source generator project that uses Blazor under the hood to generate the code. It does this via genzor.
The SG works perfectly from the command line (dotnet build/dotnet run), however, doesn't work within Visual Studio 2019 (16.10.0 Preview 1.0 nor 16.9.2).
I should have all dependencies set to with netstandard2.0/netcoreapp3.1, but I still get these warnings when I try to build in VS:
The user (csproj) of the SG's look like this:
The SG csproj looks like this:
The referenced package
genzor
s csproj (hosted on GPR)looks like this:
The sample sample project is here: https://github.com/egil/genzor/tree/main/samples
I feel like I might be missing something obvious, but hope one of you can point me in the right direction 🙏
The text was updated successfully, but these errors were encountered: