I have a Visual Studio 2010 solution file with a number of projects in it. There is a mix of Silverlight projects (acting as modules), the Silverlight Shell project and a number of RIA services.
When using TFS 2010 to perform the build, it always fails because the proxy classes generated by the RIA services have not been built first. The only solution I have seen so far is to manually change the build order in my .sln file. No thanks, there are loads of projects.
Rather than break the solution up in to client side and server side solution, I'd like to find a better solution.
Apparently MSBuild 4 ignores the build order in the .sln file.
Does anyone have any ideas/suggestions?
Thank you,
The simplest way I've found is to declare explicitly the dependency between Silverlight project and the project that is hosting RIA service.
You have to open in a text editor your Silverlight project file and add a fragment to it:
<ItemGroup>
<ProjectReference Include="..\Path\Your.Hosting.Project\Your.Hosting.Project.csproj">
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
This will tell msbuild to build your web service before building your Silverlight app. And it will work only when building with msbuild, VS will throw an error.
To get it built in Visual Studio also, you have to wrap this fragment in a Target and add it to InitialTargets in Project node:
<Target Name="MySpecialReferences">
<ItemGroup>
<ProjectReference Include="..\Path\Your.Hosting.Project\Your.Hosting.Project.csproj">
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
</Target>
<Project ... InitialTargets="MySpecialReferences" ... >
Visual Studio 2010 will skip this target now but msbuild will use to change built order of projects.
This definitely doesn't seem to be the "proper" solution, but as an interim option what about checking in the generated Generated_Code\*.g.cs files for your RIA services present in your Silverlight projects? If people check in the up-to-date version along with the matching updates to their DomainService classes, all should build as expected.
Below is a sample from an MS Build script that we're using in our project. Basically, we've labelled our web project (containing the RIA services) as a priority project and are building it first.
Please note that the 1st XML tag should be located somewhere in the environment setup stage.
<ItemGroup>
<!-- use this collection to control project build order, projects listed in this array are removed from the current build queue and pushed in the front before compilation-->
<InitialBuildProjects Include="MyProject.Web.RiaServices" />
</ItemGroup>
<ItemGroup>
<PriorityProjects Include="$(ProjectRootDirPath)\Sources\%(InitialBuildProjects.Identity)\%(InitialBuildProjects.Identity).csproj" />
<RemainingSourceProjects Include="$(ProjectRootDirPath)\Sources\**\*.csproj"
Exclude="#(PriorityProjects)" />
<SLTestProjects Include="$(ProjectRootDirPath)\Tests\*.Web\*.Web.csproj" />
<BuildQueue Include="#(PriorityProjects);#(RemainingSourceProjects);#(SLTestProjects)" />
</ItemGroup>
Works for us in private builds + on our TeamCity server.
Does this help ?
Related
I found that the windows visual studio extension is targeted to .net framework and only .net framework (which seems not clearly described in the docs?), after switching our custom mono debugger extension to .net 7.0, with framework not compatible (between vsix project's .net framework 4.8 and debugger project's .net 7.0) error when building the vsix project.
If I switch the debugger project target back to .net framework 4.8 then I can build the extension along with the debugger and create a vsix bundle them togeter successfully.
I tried the previewing visual studio extensibility tools: the out-of-process solution, but the out-of-process way seems not have access to the dte object, thus no way to send the debug adapter launch command. If I use the in-process solution, then we head back to the .net framework target :(
The mono debugger extension is a "3rd party executable file" that launched by visual studio debug adapter. If I manually paste the .net 7.0 version mono debugger to the extension install location, the extension can still work with the debugger. I manage the debugger project and the vsix project within a solution is for easier project management only, in fact they are not referenced directly in code.
I switched our mono debugger project to .net 7.0 is for trying to upgrade our toolset to the newest unified framework (every other tool in our team are upgraded to .net 7.0).
TL;DR, how can we bundle a none .net framework targeted project along with a windows visual studio extension, which is targeted to .net framework only? Or how can we integrate/bundle/add built exe,dlls into the vsix container?
There are some solutions from other stackoverflow answers such as add dlls using vsixmanifest, but it can only add dll file, and the way it handle asset file seems not quite right, it just copy the dll to vsix project folder once, meaning it won't get updated when the dll's project rebuild.
Here I managed to bundle the files in a wonky way:
I create a publish folder under vsix project folder,
then copy the published debugger project file to it, add them as existing file to vsix project, and configure them as vsix content, copy to vsix,
then add a pre-build event for the vsix project, publishing our debugger project and output to this publish folder.
With process above, I can package the published file into vsix when trigger vsix project build.
For anyone have similar issue, you can have a try.
My solution is a net 5 solution. I've been through all of the nuget packages to make sure they are all 'net5' compatible and checked that all the .csproj target frameworks do indeed say net5.0 yet when I go to package my application (MyProj.Installer - Windows packaging application) it shows me a warning:
Warning NU1702 ProjectReference 'C:\Users\rich-\source\repos\MyProjGit\MyProj\MyProj.csproj' was resolved using '.NETCoreApp,Version=v6.0' instead of the project target framework '.NETFramework,Version=v4.5.1'. This project may not be fully compatible with your project. MyProj.Installer C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets 1718
I have no idea where it is getting .NETFramework,Version=v4.5.1 from as the oldest version my project has ever been is 4.7.2 but more to the point it thinks it is a net6 application when it is a net5 application.
It goes through and packages the app as an msix file and I can install it after signing of course however the app fails to launch and I believe the reason is down to the warning I describe above. Am I missing any steps for packaging a net 5 application? I've taken the exact steps I have for a net framework application that have worked in the past.
So the app not loading was two fold. The app primarily didn't load as Entity Framework core 5 is referencing the wrong version of SQL Client. See https://github.com/dotnet/SqlClient/issues/652.
The second reason why the app wouldn't load was because the msix was trying to access a file I had open on another networked computer. See the section common problems https://learn.microsoft.com/en-us/windows/msix/packaging-tool/tool-known-issues.
Still no idea why the packaging project think it is net6 howwever.
I'm trying to use a library project with my Google AppEngine project as a project on build path.
Is there a way to get that included in the AppEngine project without having to copy the entire source or make a jar ?
I only use a small portion of the library so it seems like overkill to copy the whole jar and a lot of work to find the dependencies within the source to get only the parts I'm using.
I added an ant project builder that copies the class files from the dependent project.
The ant file resides in the gae project and copies the class files from the referenced project.
Here's the ant:
<?xml version="1.0" encoding="UTF-8"?>
<project name="CommonsCopy" default="copy" basedir=".">
<target name="copy">
<copy todir="war/WEB-INF/classes">
<fileset dir="../Commons/bin" includes="**/*.class">
</fileset>
</copy>
</target>
</project>
I named it 'CommonsCopyBuilder.xml' as it copies code from a commons project.
This will copy the files to the appropriate location just before running the project.
You are not going to like this answer, but No.
In order to include the library as a dependency in the project once deployed the required library must be found in your WEB-INF/lib directory as a jar. This is going to require you to you to create a jar based on the library you want to use. The other option is to do just as you said pull the dependent source into your project and use it from there.
During development you can make the library project a dependency of your app engine project by doing the following:
Under Project->Properties->Java Build Path->Projects Tab
select the "Add.." button to add a subproject to your build.
Note: This will not address the the running in a production environment.
I managed to do this by creating the libary project is a "Web Fragment Project" and adding it to the "Deployment Assembly" in the project properties of the app engine project.
However, the app engine project does not seem to work with non-trivial dependency structures. In my case, I had two app engine modules within an EAR, both depending on the libary project. However, the Google plugin only bundled the library project with one of the modules, never with both at the same time despite identical configurations. Obviously a bug.
My work-around was to add a linked source folder to the app engine projects, pointing to the source folder of the library project. Ugly, but it does the job.
I have the SL Control toolkit installed on my machine and I have added a reference to the toolkit DLL (System.Windows.Controls.Toolkit.dll)
I like to have all my external dependencies in a lib folder under the SL project, so I copied over the DLL from the installation dir of the control toolkit to the lib folder, but if I try to add reference to the DLL from this location, VS is still picking up the reference from the installation dir.
What gives?
I ran across this problem everyday. The easy (it feels that way after some time) solution is to unload the project (right click>Unload Project) then right click again en select Edit. Find a reference that is point to another assembly in your lib folder, copy that Xml element and change the 'Hint' path to your assembly.
It will look something like:
<ItemGroup>
<Reference Include="Ninject">
<HintPath>..\..\Ninject.dll</HintPath>
</Reference>
<Reference Include="System" />
<!-- other references removed for breviti-->
</ItemGroup>
The installed DLLs are always searched first, even if you add the DLL by browsing. The path in the properties window (for your added reference) would have shown the "installed" version instead immediately after adding the reference to your copy.
A build machine would not have the toolkit installed. You could uninstall the toolkit and organise the DLLs yourself if you really need that sort of behaviour.
We have a VS 2010 solution that includes a few class library projects, a SQL Server 2008 database project and a Wix setup project. We are trying to get to a point where the following happens in the order specified:
Build the class library projects and the database project
Deploy the database project to generate the deploy .sql script
Build the Wix setup project.
The reason for the desired order is that the setup project requires the deployment .sql scripts as it will use these to generate/update the database on the machine that the msi is run.
It seems that there is no way within a Visual Studio solution file to create this type of build/deploy/build order. Is this correct?
Thanks
You could change the BeforeBuild target of the Wix project (*.wixproj) to deploy the database project before the build:
<ItemGroup>
<DatabaseProject Include="../Database1/Database1.dbproj"/>
</ItemGroup>
<Target Name="BeforeBuild">
<MSBuild Projects="#(DatabaseProject)"
Targets="Deploy"
Properties="Configuration=$(Configuration);Platform=$(Platform)"/>
</Target>
How are you building it? You can change the build order in a solution from Visual Studio, granting you build it from Visual Studio. In Solution Explorer go to Build Order or so.
If you do it from command-line/MSBUILD you can build the first, then the second and the last project, easy, just call MSBUILD on each project, in the desired order. Thought there should be a finer control, I don't remember.
EDIT: It's called "Project Build Order", under the the solution node, it activates when you have more than 1 project in the solution.
I have tried this and get an error when I tried to reload the project after editing. However ignoring the error and reloading the project again worked fine and indeed building the Wix project triggers a deploy of the database project.