Skip to content
This repository has been archived by the owner on Nov 3, 2022. It is now read-only.

Is GetProjectReferences broken? #1

Closed
djanosik opened this issue Sep 18, 2017 · 14 comments
Closed

Is GetProjectReferences broken? #1

djanosik opened this issue Sep 18, 2017 · 14 comments

Comments

@djanosik
Copy link
Contributor

I've tried to use Automaty to replace Scripty, but it fails to load project references. The referenced assembly is loaded from bin/Debug/Assembly.dll, but it's in fact located in bin/Debug/net451/Assembly.dll.

@Dresel
Copy link
Owner

Dresel commented Sep 18, 2017

I'm sorry but as stated in the description only .NET Core based projects are supported (targeting netstandard or netcoreapp).

@djanosik
Copy link
Contributor Author

djanosik commented Sep 18, 2017

.NET Core (SDK) based projects targeting full framework are not supported? Why?

@djanosik
Copy link
Contributor Author

I have created a sample project and I see that SDK based projects targeting full framework are supported. It works quite well, but there is a problem with projects targeting multiple frameworks. In that case the path to referenced project assembly is not resolved correctly.

Sample project: Fiddle.zip

@djanosik
Copy link
Contributor Author

djanosik commented Sep 18, 2017

Also it looks there is an issue when the referenced project targets netstandard2.0.

Could not load file or assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.

@Dresel
Copy link
Owner

Dresel commented Sep 18, 2017

I did not test it with multiple framework targets, but it seems additional logic has to be added to GetProjectReferences to support this.

To support 2.0 I have to deploy a new version of Automaty.DotNetCli which also targets netcoreapp2.0.

@djanosik
Copy link
Contributor Author

Ok, do you have time to fix it? Or should I send PR?

@Dresel
Copy link
Owner

Dresel commented Sep 19, 2017

Updating Automaty.DotNetCli to netcoreapp2.0 should be no problem, but I'm happy if you have some time to investigate the multiple framework target problem because that's something I can't fix within the next days as I'm busy (don't know how important this feature is for you).

This is the place to start with, you have to deal with the MSBuild api, read TargetFrameworks and somehow decide which target to use. Debugging Automaty is quite cumbersome though.

@Dresel
Copy link
Owner

Dresel commented Sep 20, 2017

Thanks for your contribution, I've merged your pull request and already uploaded a new version of Automaty (Core and DotNetCli). Let me know if this works for you.

May I ask what you are going / trying to implement with Automaty? Is it going to be open source?

@djanosik
Copy link
Contributor Author

djanosik commented Sep 21, 2017

It works now, thank you!

I will probably use it in https://www.dotvvm.com/ and related projects. I want to replace T4 templates and Scripty. T4 templates don't run on build and Scripty is not compatible with .NET CLI. Automaty looks really promising. But I am not sure whether it's good idea to use plain C# files. Generators are "build-time" and should not be compiled into project assembly.

@djanosik
Copy link
Contributor Author

Now I see why full .NET is not supported. Not all dependencies are loaded from NuGet packages and therefore are not available during compilation of generators. Eg. you can't use System.Linq in generator on full .NET framework. This should be mentioned in docs.

@djanosik
Copy link
Contributor Author

djanosik commented Sep 21, 2017

@Dresel Would it make sense to always import NETStandard.Library?

@Dresel
Copy link
Owner

Dresel commented Sep 21, 2017

Generators are "build-time" and should not be compiled into project assembly.

Well you could set Build Action to None but I'm open for other suggestions.

This should be mentioned in docs.

I thought that It supports (only) .NET Core based projects is enough but we can add a more detailed explanation here.

@Dresel Would it make sense to always import NETStandard.Library?

You mean for .NET support?

@djanosik
Copy link
Contributor Author

Exactly. If you import some set of standard libraries, it would work much better with full .NET.

@djanosik
Copy link
Contributor Author

Hmm, Automaty works without issues in projects targeting .NET 4.7, but not in projects targeting .NET 4.6. Maybe because .NET 4.7 references all assemblies included in NETStandard.Library?

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

No branches or pull requests

2 participants