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

AssemblyInfo.fs not present in F# .NET Standard 2.0 and .NET Core 2.1 projects #5309

Closed
BentTranberg opened this issue Jul 8, 2018 · 6 comments

Comments

@BentTranberg
Copy link

BentTranberg commented Jul 8, 2018

Found a trivial issue while migrating to .NET Standard / Core.

I have created one F# .NET Core 2.1 Console Application and several F# .NET Standard 2.0 Class Library, using Visual Studio 2017.

Problem: None of the new projects contain AssemblyInfo.fs after creation.

Is this a deliberate design decision, or something missing?

Expected behavior

AssemblyInfo.fs should be present in new projects, like we're used to with F# .NET Framework projects in VS 2017.

Other

VS 15.7.4

@BentTranberg
Copy link
Author

BentTranberg commented Jul 8, 2018

I just now created the first C# .NET Standard 2.0 Class Library in that solution, and I see that this project does not have AssemblyInfo.cs. This very much strengthen my suspicion that this is by design, also for F#. (I should have thought of checking this before reporting.) In other words, this is probably not an issue.

@saul
Copy link
Contributor

saul commented Jul 9, 2018

AssemblyInfo is now auto generated - you can specify AssemblyVersion etc in your project file now.

@BentTranberg
Copy link
Author

BentTranberg commented Jul 9, 2018

Slightly bad news for me, because it breaks backward compatibility with the way I've been doing stuff.

I have used two common files for the entire solution. They are named SharedAssemblyInfo.cs and SharedAssemblyInfo.fs. They have been linked into all projects in the solution, and adds to the local AssemblyInfo.cs/fs. The purpose of this has been that the build script need modify only those two files in order to set the version. This I have done in order to minimize the logic needed in the build script.

With .NET Framework, this worked out very well for C#, because the compiler will complain about duplicate entries, so I only had to remove duplicates from the initial AssemblyInfo.cs according to error messages. In F# not quite that well, because the compiler didn't complain about duplicates, but took the last one. I reported this in another issue here. But it works.

With .NET Core I have not found a way to continue this way of doing it - having the version in a centrally located file. I get compile errors that I don't understand what to do with when I try the above. I admit I haven't yet had the time to fully investigate. (edit: I think the error message(s) complained about duplicate entries - yet there were none.)

@saul
Copy link
Contributor

saul commented Jul 9, 2018

What are the exact errors? You could either disable automatic AssemblyInfo generation, or include a common props file in a central location which has the AssemblyVersion attribute. In fact I think you don’t even need that - just build your solution with:

msbuild Foo.sln /p:AssemblyVersion=1.2.3.4

There are about three ways to skin this cat :)

@BentTranberg
Copy link
Author

Thanks a lot. I'll try the first option for now, and the other two will both be useful in time.

Since this was by design, and I no longer seem to have a problem with it, I'll close the issue.

@BentTranberg
Copy link
Author

Ilja Nosik mentioned the possibility to disable automatic AssemblyInfo generation in another issue I also started about AssemblyInfo files.

#3548 (comment)

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

2 participants