Including a .targets file in the universal app shared project to include a custom build action - windows-8.1

In separate Windows 8.1/Windows Phone 8.1 projects, including the SharpDX.targets file from the SharpDX repo includes all of its content build actions in each project. Doing the same in the shared project in a universal app doesn't work (project reloads successfully but tools are no in the Build Action list).
Is there an alternate solution to keeping the content in the shared project rather than keeping copies in each of the W8.1/WP8.1 projects just because there is no centralized way of building it?

No, a shared project in a universal app is never really built. It's merely a container of files to be shared into each of the specific projects. If you have custom build actions, you need to include them in each specific project (that requires them).

Related

How to publish solution with class library projects in IIS

I have an Asp.Net Web Api solution with 3 class library projects that are referenced from the main project. I have published the main project to another server on site - MySite/Main. I am unable to figure out how to publish the class library projects to location like so -
MySite/CL1
MySite/CL2
MySite/CL3
This shall enable the main project to reference them properly. How should I go about it?
When you build your web project all the referenced libraries are being copied to the bin folder (check for yourself). This folder is also being published.
If you use IIS it will automatically look for assemblies in the bin folder so you shouldn't worry about making the folder structure to be the same as in your local environment.
So the only thing you should worry about is referencing libraries properly.
The website project is the only one which should be published. You don't need to publish class libraries (I don't think you can do this using Visual Studio)

Packaging requirejs optimized files in war

In a large web application, I'm using requirejs amd modules so that the scripts themselves are modular and maintainable. I have the following directory structure
web
|-src
|-main
|-java
|-resources
|-webapp
|-static
|-scripts
|-styles
|-images
|-static-built //output from r.js. not checked into git
|-WEB-INF
During build js and css are optimized using r.js into static-built folder. Gradle is the build tool.
Now the problem: The jsps refer to the scripts in static/scripts folder and this is how i want when working locally. However when building war, I want the static files to be served from static-built folder. The important thing is the source jsp should not have to change to serve the optimized files from static-built folder.
Two options that I have are: a) the gradle build while making war should include static-built instead of static. b)include static-built in addition to static and using tuckey urlrewrite pick the resouce from static-built rather than static.
What best practices are the community following in similar scenarios?
We've setup the server to have a runtime profile (dev, qa, prod, etc) read from a system property which determines some settings based on it. When running in production profile we serve the optimized files from the WAR. In development we serve the non-minified and non-concatenated files directly from the filesystem outside the application context.
Files are structured according to the official multipage example.
Configuring serving files depends on your chosen backend solution. Here's an example for spring.
Alternatively, r.js can generate source maps and those will help with development as well.
Not sure if this question is outdated already, but I had a kind of similar problem.
I had similar project structure, but with the only difference - I've split the project into 2 modules:
one of them (let's call it service) was java-module for back-end
the second one contained only js and other stuff related to front-end (let's call it ui).
Then in Gradle build 'assemble' task of the service depends on 'assemble' task of ui AND another custom task called 'pre-assemble'. This 'pre-assemble' task was copying the optimized js files to place where I wanted them to be.
So, basically, I've just added another task that was responsible for placing all the optimized js files in the proper place.

Auto compiling a dependent project without having a dependency on it

I'm developing ASP.NET MVC with extensive usage of Spring.net.
I have lots of services implemented in different assemblies. The purpose of using Spring and abstract interfaces is to decouple the application from the implementation of services. For example, the Data Access Layer is currently implemented by NHibernate, but the solution is designed to allow this to change.
So I have defined lots of Spring objects from foreign assemblies e.g.
<object id="RepositoryFactory" type="Org.Zighinetto.MyApp.NHibernateBasedRepositoryFactory, Org.Zighinetto.MyApp,NHibernate" />
As we all know, this works as soon as Org.Zighinetto.MyApp.NHibernate.dll example assembly either
Is in GAC
Is in bin directory
As of today, in order to allow quick debugging by hitting F5, I have set a dependency from the main project to all projects it depends on. As we all know, Spring is designed to allow us to cut the dependency between projects, but in this case I use dependencies only to tell Visual Studio to compile and deploy the DLL automatically, otherwise I would have to copy the right DLLs every time I want to debug my project.
The question is straightforward: given that I want to compile, at least in Release mode, my DLLs without unneeded dependencies, how can I make sure that Visual Studio, when I hit F5, automatically compile and deploys all of the Spring-required DLLs (which can be hardcoded by me somewhere, e.g. in a post-compile script) into bin directory?
In the Org.Zighinetto.MyApp example above, I want that once Org.Zighinetto.MyApp.dll gets compiled, VS compiles and deploy also Org.Zighinetto.MyApp.NHibernate.dll without having an explicit reference from .MyApp to .NHibernate
The dependency in you project file does not make the resulting assembly in any way dependent on these referenced files. You can safely have the dependencies there during development and compile your project.
The resulting output will still work when you swap out the assemblies that contain the implementation.

monotouch bindings project to framework

What are the correct steps to creating a bindings project for a Framework versus a library? (Yes, they are close to the same thing, but NOT the same, the framework is a directory structure with header files, library and resources). These are what I've come up with, note that none of the Framework specific steps are documented as far as I can tell at the Xamarin web site (please prove me wrong).
Create the bindings project via MonoDevelop wizard.
Generate the ApiDefinition.cs and StructsAndEnums.cs files with btouch or by hand.
Copy the file from the root of the framework directory to lib.a (e.g., ArcGIS to libArcGIS.a) and add it to the project. It is important to note that the file without any file extension in the framework directory is in fact a library file.
?? Include framework resources ??
You'll notice that I get foggy at the third step. How to you add these resources to the bindings project? The large part of the bindings project links and runs fine, but I think it crashes at times because it is missing an expected resource.
You must (a) create a C# contract that describes the Objective-C contracts and how you want your projection into C# to look like, and (b) statically distribute the library with your project.
To kick the automatic population of the linkwith.cs you must rename the framework library (for example MyFramework) to use the library pattern (in this case, "libMyFramework.a")
Resources you have to select and flag as resources, they will be bundled directly into your app, and extracted when the library is consumed.

Why can BuildProvider be used only with ASP.NET website projects?

I was going to try Subsonic, you can generate DAL with buildProvider element in an ASP.NET website project. But I get curious why Web applications or windows applications do not support BuildProvider.
PS: I know for Subsonic there is one other option to use it with other than BuildProvider, but I just get curious.
It doesn't work because of the different way things are compiled in web application projects vs. website projects. From what I read on MSDN, it has to do with the fact that in web app projects, all your code files are compiled into a single assembly using MSBuild before deployment, but Build Providers are used to generate code that is compiled at runtime (from your App_Code folder).
In website projects, all of your code is compiled at runtime so it all plays nicely together.
You could possibly hook it into your pre-build event, and call the sonic.exe with the proper command line.

Resources