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

Using Paste to add files to an F# project causes the order of files in the project and on the UI to get out of sync #104

Closed
KevinRansom opened this issue Jan 26, 2015 · 6 comments · Fixed by #379
Labels

Comments

@KevinRansom
Copy link
Member

Repro:
1.Create a new F# Console Application
2.Create 3 F# source files (.fs) on disk
3.Select all three files using windows explorer and paste them on to the F# project in Solution Explorer, note the files are appended to the project in the display.
4.select program.fs
5.use alt+down arrow to move it to the bottom of the source file list
Image
6.build project and note the build error similar to:

C:\Program Files (x86)\Microsoft SDKs\F#\3.1\Framework\v4.0\fsc.exe TypeThree.fs TypeTwo.fs Program.fs TypeOne.fs

c:\temp\ConsoleApplication1\ConsoleApplication1\Program.fs(4,1): error FS0222: Files in libraries or multiple-file applications must begin with a namespace or module declaration, e.g. 'namespace SomeNamespace.SubNamespace' or 'module SomeNamespace.SomeModule'. Only the last source file of an application may omit such a declaration.
On close inspection of the command line you will see that TypeOne.fs appears after program.fs even though in the ui, TypeOne,fs is at the top and program.fs is at the bottom

qh1w8cd

comments

ovatsus wrote Jun 28, 2014 at 11:35 AM [x]
I get this all the time. I copy paste a file to create a new one, and half the times things won't compile until I unload and load the project again and fix the ordering.

@latkin latkin added the Bug label Jan 26, 2015
@rojepp
Copy link
Contributor

rojepp commented Feb 23, 2015

I seem to be completely unable to get EnableOpenSource.vsix running on my machine today, so just some notes here. I'm fairly sure this is caused by handling just one file. Indeed, I can not repro when there is one file instead of three.

A simple change like below might work (files may need to be reversed)

                addFilesNotification <- Some(fun files -> 
                    for absoluteFileName in files do
                        let relativeFileName = PackageUtilities.MakeRelativeIfRooted(absoluteFileName, fshProjNode.BaseURI)
                        move relativeFileName)

@enricosada
Copy link
Contributor

i'll try to fix this bug, assign it to me (or to you @latkin as usual 😄 )

@latkin latkin self-assigned this Apr 22, 2015
@enricosada
Copy link
Contributor

smaller repro:

  • create a project
  • copy 3 files ( File1.fs, File2.fs, File3.fs ) from windows explorer or another vs project
  • select project node
  • paste
  • now on video is

image

  • click save on project node
  • the msbuild is
    <Compile Include="File2.fs" />
    <Compile Include="File3.fs" />
    <Compile Include="Program.fs" />
    <None Include="App.config" />
    <Compile Include="File1.fs" />

@xenoputtss
Copy link

I am currently getting this issue. I am using VS2015.

To Reproduce my issue i am able to do this
start with a a project with 3 files. Select one of them in solution explorer and copy/paste (should create a "copy of selected file" file) rearrange files how you think the should be. Build.

@tjaskula
Copy link

tjaskula commented Jun 6, 2016

Hi, I have the same problem in VS2015.

@mariomeyrelles
Copy link

I also had this problem using VS2017 today. I copied a file instead of adding the file...

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

Successfully merging a pull request may close this issue.

7 participants