-
Notifications
You must be signed in to change notification settings - Fork 124
"Add as Link" missing from Visual Studio #147
Comments
@Daniel15 thanks for the note, we have it on our backlog but have not started on it yet. I'll reply here when we do. |
TFS:121783 |
Some scenarios are covered with the solution stated in aspnet/dnx#550 (using "shared files" in project.json (https://github.com/aspnet/Home/wiki/Project.json-file#shared-files) But when you need to have the same file on several projects, that it's not a compilable one, that does not work. A common usage would be to have a shared config.json file shared between several projects on the same solution. ¿Is there any way to achieve that without linked files? |
You don't have to use shared files: More data here: https://docs.asp.net/en/latest/dnx/projects.html?highlight=working#including-excluding-files |
@davidfowl - Do files added like that appear in Solution Explorer? Can I add them via the "Add as Link" option in the UI? Not seeing the files in the solution explorer is a pretty big issue - How am I meant to know exactly which files are being included via the |
We don't show those files today but we are planning on adding support to show them. |
Any ETA on this? I get that I can do it today but it's kind of black magic without seeing this file in solution explorer. |
What if I want to share non cs file resources? While in active development, it is simple to add existing common js and less files as links and then have any modification within a project update the original source. The only alternative is to use a client-side package manager like bower, but while in active development this is too time consuming. |
Is the shared files approach still supported? Links were removed or moved to a different place, getting 404s. Would be nice to have the ability to add files as links tho. |
+1 I just needed this feature to share some Angular2 components with another application and couldn't use it. Any ETA on this? Thanks! |
If you only need it for a file or two, a simple work-around is to edit your <ItemGroup>
<Content Include="..\..\Some\Common\Project\file-to-be-shared.json">
<Link>linked-copy.json</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup> The only downside is that it does not work when using the |
Is there a simpler way to workaround this issue other than manually adding each one to the |
@tom-corwin It's hacky, I know. I'd create a powershell script or two depending on your use case. If it's the same file (or few files) that must get copied to many projects then just make a simple CLI script to batch update all project files. The second script would just open a file picker and allow the user to select a file, then update the |
I will try to throw one together later, but if you do make sure to post it here for everyone! |
@JimmyBoh I will try to create one, but it will probably be a |
@davidfowl The links that you provided isn't working. Can you please provide the updated link? |
Would appreciate the tooling allowing for adding files as links sooner rather than later. I am having to manually add in linked files by editing the xproj which isn't very productive. |
Any ETA on this one? Its open for more than a year with two updates to Visual Studio 2015 in the mean time. I am trying to share same source across .Net Core (1.0) and classic 4.5, and this is a dead end. |
@mvadu - I've found the least error-prone way of doing that is to move the code into the .NET Core project, and "Add as Link" from the classic 4.5 project. This will make it appear in both projects in the solution explorer. If you need any conditional bits of code, you can use preprocessor directives. |
Just adding support for the "Add as link" in Visual Studio. Huge efficiency gains to be created in agile development and multi-refactoring where shared source can be tested across development instances. Is there a specific MS developer VS feature statistical report on how many developers rank which feature requests at what importance level. GitHub would be a good place to show this metric providing some real time visibility to what is important across the tooling environment. |
Support for this will becoming in the next release when we move to .csproj. |
+1 for needing this functionality. Makes a huge difference in ensuring no code duplication is necessary. |
Chiming in to add my vote for this feature. |
Linked files are supported in the latest version of VS2017 RC. @riiight have you tried with VS2017 RC and had issues? |
vs2015 update 3 .. |
This will be fixed with the new csproj tooling in VS 2017 |
Is there a way to add multiple directories/files as links at once? |
Based on @JimmyBoh 's idea, I added below lines to .xproj,
It worked and I could also see linked file in SolutionExplorer. |
I also wanted to know this. Thanks, this issue helped me |
Classic project types (eg. ASP.NET 4, Console Application, Class Library) have an "Add as Link" option in the "Add Existing Item" dialog. This allows one file to be shared across multiple projects, by adding the file to the project without physically copying the file to the project directory. This button is missing from the Add Existing Item dialog for ASP.NET 5 projects.
It appears you can achieve something similar through the
shared
section inproject.json
. However, files added this way do not appear under the project in Solution Explorer.The text was updated successfully, but these errors were encountered: