Sharing Files Between a Website and Cordova Project - visual-studio

We are writing a web application (standard MVC for now) and a companion mobile/tablet application using the new visual studio tools for cordova. Many of the assets, images, css, and even the javascript and HTML can be shared between the applications.
I've tried using the "Add As Link" to add an image that "lives" in the MVC app to the images used by the cordova app. However, when the cordova app is built any files that were included using the "Add As Link" option don't appear in the output.
I'd really rather not have to have some build step copy files around as it could quickly turn into a maintenance headache. Is there some configuration I can tweak to make linked files build correctly in cordova projects?

Currently only the files physically present under project directory is picked for deployment and packaging.

Related

Visual Studio Net Core Web App: No option to output as web app in project properties?

So I made a Net Core Web app project with razor pages and javascript files, as you can see on the right of the first screenshot, but I cannot seem to publish it as a web app, only console app or windows application.
For instance, when I publish it to folder, it does not even publish my razor pages, no index.cshtml at all.
Anyone ran into this issue before?
Project properties screenshot
Published folder
Inside wwwroot folder
Razor pages .cshtml files will be embedded into the web.config file after publishing.
It seems like you are using a regular Linux FTP. Make sure you are using a windows server to publish your app on. Net Core does not work on Linux servers unless you install the Net Core runtime on the server.

Sharing a JSON file between iOS and Android projects

I have inherited a Xamarin project (not Xamarin.Forms) and right now it has three major components.
An iOS project, an Android project and finally a Shared Project (not a PCL and not a .Net Standard project).
Despite the Shared Project, the application reads a json file included within the assets folders of each project. The file is a duplicate. I feel like this file should be in the Shared Project
To clarify, this is the structure:
Shared Project
No Assets
iOS
Resources/test.json
Android
Assets/test.json
I believe the test.json file should exist as one file in the Shared Project. My first step was to make this move and I changed the file to Build Action=Content which worked for the iOS project. It seems however the Android project does not get this file. I cannot find it anywhere in the compiled and archived .apk file.
Is there anything I can do about this, or do I need to accept this design flaw and build a .Net Standard library or PCL? If so, how exactly do you make a .Net Standard or PCL for a non-Xamarin.Forms project.
What is your use case? If you just need to read the test.json at runtime and parse it using .NET code, you can use embedded resources, details here: https://developer.xamarin.com/guides/xamarin-forms/application-fundamentals/files/
If you need the file to go into iOS reosurces / Android assets folder, you can keep the test.json file only once in the solution (either in shared project or as a solution item) and add it as link to both iOS and Android project - here is screen shot how to do it in Visual Studio.
You can do it also in Visual Studio for Mac - right click on the containing folder in solution explorer, choose Add Files and you will get the following prompt - choose Add a link to the file

Missing bin folder in Nuget package

I am deploying asp.net web site via Octopus deploy. In TFS build definition I specified PowerShell script which pack and push Nuget package. Everything working working well except one thing: bin folder is not included in Nuget package.
When I tried to manually packing my web site into Nuget package I noticed that bin folder is included.
I supposed that something happened in TFS build process and bin folder is lost. But I cannot figure out how to solve this.
Any advice?
It sounds like you are trying to build a Website rather than a Web Application. Websites are only supported for legacy and don't get any love in the tooling. You can:
1) manually create your website layout for packaging with a post-build PowerShell script.
2) upgrade from a Website to a Web Application project and feel the love.
To upgrade you can create a new Web Application project in VS and delete all the specifics, like aspx files or other overwrites. Then drop the left over files on top of the Website, and open it in your solution. You will have two entries, one for site and one for app. Fix up the web app errors and build...

"Calls to the web service will fail unless the Silverlight project is hosted in and launched from the same web project"

I have Downloaded demo project from here
I tried to run Silverlight project SkiResult.ThinClient from the “Solution Explorer” I have configured the database nicely as SkiResult.FullClient a WPF Project works fine and display data.
But whenever I have tried to run Silverlight project in my Solution Explorer it shows me following error message.
I have googled so much I have also found one solution that set xyz.WEB project as a Start Up Project but as u can see from below screenshot of my Solution Explorer there is no xyz.WEB project in solution.
Thank you so much.....
Try setting the SkiResult.DataService project to be the startup project. This looks very much a web project created to host a Silverlight application because:
it has a Web.config file (so it is clearly a web project)
it has a Silverlight.js file (some utility JavaScript used with Silverlight),
it has some autogenerated test pages,
it has a ClientBin folder, which is typically where the compiled Silverlight application will be copied to.
When you create a Silverlight project, Visual Studio offers to create a web application project to host the Silverlight application for you. (You don't have to create a web application - VS can generate a test webpage during the build process and use that instead.) If your Silverlight project is called Xyz, then this web application will be called Xyz.Web. However, with the solution you're dealing with above, it seems this project has been renamed from the default.

Why Visual Studio 2010 publish website with source code?

I'm using Visual Studio 2010 with the new website publish dialog. I have a Web Application website. When published, in theory it should compile all the code into an single assembly. However, in both Debug and Release, after publishing the directory always contains source code of page and user controls (even with the untransformed web.config files Web.Debug.config and Web.Release.Config). This is very confusing.
But with package/publish web project configuration and Generate Deploy package context menu item, the Package\PackageTmp directory is clean.
Why doesn't Visual Studio use this Package to publish the website?
Where is the precompile option?
Web.config xml transform seems not work, why does Visual Studio bring this feature to confuse me?
The correct answer is to look in the Package/Publish Web settings (in the web application project properties) and look for the "Items to deploy".
For a web application you'd want "Items to deploy" to have "Only files needed to run this application" which would NOT copy the source code files, since they've been compiled into the DLL in the bin folder.
Note that this setting varies for your current Build type (Debug/Release/etc), so plan accordingly...
Ciao!
You need to understand the differences between Web Application Projects versus Web Site Projects.
To deploy a Web application project, you copy the assembly that is
created by compiling the project to an IIS server. In contrast, to
deploy a Web site project, you typically copy the project source files
to an IIS server.
For Web application projects, you typically build the project in
Visual Studio or by using the ASP.NET batch compiler on a computer
that is not the production IIS server. All code-behind class files and
standalone class files in the project are compiled into a single
assembly, which is then put in the Web application project's Bin
folder. (The .aspx and .ascx files are compiled dynamically in a
manner similar to what is done for Web site projects.)
For Web site projects, you do not have to manually compile the
project. Web site projects are typically compiled dynamically by
ASP.NET (on both the development computer and the production IIS
server). You can choose between batch compilation mode, which
typically produces one assembly per folder, and fixed compilation
mode, which typically produces one assembly for each page or user
control.
In visual studio 2013/2015, select an option "Precompile during publishing"

Resources