I have a very standard silverlight app running under an ASP.NET host. On all dev machines it compiles fine, but on our CI serve, we get this error:
No Silverlight project specified for Silverlight output
But if I log into CI and compile manually with VS2010 it works fine! This is Silverlight 4, .NET 4.0
As I just spent 2 days trying to figure out why this was happening in a Silverlight project I work on, I figured I'd post it here.
In my case, the problem was caused because one of the <ProjectReference> in website's .csproj had a project GUID which didn't match the actual GUID of the project (due to a code reorganization which had occured earlier).
This had nothing to do with the silverlight application or any of its settings. I have no idea why, but somehow this bad reference causes the "CopyFilesToFolders" MSBuild task to get a the same files listed multiple times in the "SourceFiles" list. This causes the first set of copys to succeed followed by a set of "No Silverlight project specified" errors.
Simply removing the bad project reference and re-adding it fixed the GUID and solved the build issue.
A very very bad error message indeed.
Thanks to MerickOWA for posting here, I am sure it saved me hours with the same problem.
I have created a PowerShell script to find the mismatched GUIDs for all projects in a solution. It may save someone else even more hours.
To run it, copy the code below into a text file in the same folder as your solution, rename to .ps1, start up the Powershell console, navigate to the folder containing you solution, then run the script. It will list mis-matched project references, if any.
To fix, open the solution in Visual Studio then remove and re-add the mismatched Project Reference(s).
function validateSolution([string]$slnFileName) {
"Validating solution: " + $slnFileName
# Extract all the c# projects from the solution file
$solutionProjects =
Get-Content $slnFileName | Select-String 'Project\(' | ForEach-Object {
$projectParts = $_ -Split '[,=]' ;
New-Object PSObject -Property #{
Kind = $projectParts[0].Replace('Project("', '').Replace('") ','');
Name = $projectParts[1].Trim('" ');
File = $projectParts[2].Trim('" ');
Guid = $projectParts[3].Trim('" ');
};
} | Where-Object { $_.Kind -eq "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" } # Kind = C# project
# Output list of C# projects to console
# $solutionProjects
# Create HashTable keyed on project GUID
$solutionProjectGuids = #{}
foreach ($project in $solutionProjects) {
$solutionProjectGuids.Add($project.Guid, $project)
}
# Loop through each c# project in the solution
foreach ($project in $solutionProjects) {
[xml]$projectXml = Get-Content $project.File
$projectReferences = $projectXml.Project.ItemGroup | Where-Object { $_.ProjectReference -ne $null }
# Loop through each ProjectReference
foreach($reference in $projectReferences.ChildNodes | Where-Object { $_.Project -ne $null } ) {
# Check the project reference GUID exists in hash table of project GUIDS; if not write error
if (!$solutionProjectGuids.ContainsKey($reference.Project)) {
""
"Bad ProjectReference: Project GUID not found in solution "
"Solution: " + $slnFileName
"Project: " + $project.File
"Reference: " + $reference.Name
"Bad GUID: " + $reference.Project
}
}
}
"Completed solution: " + $slnFileName
}
foreach ($solutionFile in ls *.sln) {
validateSolution $solutionFile
}
If you take a look at the log file that is generated by your build server, you will probably see something like this...
CopySilverlightApplications:
Copying Silverlight applications
Copying <Path>.xap to <Path>.xap
MSBUILD : error : Copying file <Path>.xap failed. No Silverlight project specified for Silverlight output <Path>.xap. [<Path>.csproj]
CopySilverlightApplications is a target that is defined in the following file.
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\WebApplications\Microsoft.WebApplication.targets
It includes this condition which explains why you are not having the problem when building with Visual Studio.
Condition="'$(BuildingInsideVisualStudio)' != 'true'"
I have two build definitions where each builds a different configuration. One of the builds was OK (Release) but the other (Nightly) had the problem that you describe. When I looked at the project file for the silverlight application using an XML editor, I saw that although there was a property group with a condition that evaulated to true for Release - there was none for Nightly.
I manually edited the file by taking a copy of the property group for Release and adjusted the condition and the OutputPath to suit the Nightly build. This resolved the issue.
I noticed afterwards that if I navigated to the Properties page for the Silverlight project in Visual Studio and swapped to the Nightly configuration using the dropdown in the toolbar, that a new PropertyGroup element was automatically generated for that configuration. This would probably also resolve the issue.
I had the same problem. The project built just fine in Debug and Release configuration but I got "No Silverlight project specified for Silverlight output" in the web-project. I also noticed that it was trying to copy the .xap-files from ./bin/Release/ instead of ./bin/Production/.
After removing all Silverlight Applications (tab in project Properties) from the web-project and adding the ClientBin folder as the output path (suggested here) I got a better error message. The problem was that some projects referenced by the web-project were missing the selected configuration. After adding the configuration I could add the Silverlight Applications to the web project again and return the Output path to bin/$(Configuration)/ and still build the solution.
I seemed to be getting duplicate xap file names being generated within the CopySilverlightApplications task which were causing this error. I was able to resolve this issue by making the modification below to the following file. Note the introduction of a new ItemGroup and the reference to it from the SourceFiles attribute in the CopyFilesToFolders Task.
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\WebApplications\Microsoft.WebApplication.targets
<ItemGroup>
<_UniqueSilverlightXapFiles Include="%(_SilverlightXapFiles.FullPath)" />
</ItemGroup>
<!--Copy the outputs to the target folder-->
<CopyFilesToFolders SourceFiles="#(_UniqueSilverlightXapFiles)"
SilverlightApplications="#(_SilverlightApplications)"
ConfigName="$(Configuration)"
Condition="'#(_SilverlightXapFiles)' != ''">
<Output TaskParameter="DestinationFiles" ItemName="_WebApplicationSilverlightXapFiles" />
</CopyFilesToFolders>
To further confuse the matter, I added 2 new projects to our existing solution (a new library and it's associated test project) and the CI build failed with the no silverlight project specified for silverlight output error, which was succeeding 2 days prior. The 2 new projects didn't have the configuration being used by the other projects.
Adding the missing configuration to the 2 new projects via the Solution Configuration Manager fixed it.
Why this would affect the Silverlight projects, which have no relation to these 2 new projects, I have no idea.
I had the same problem. I was making build script, running msbuild on solution.
I was building solution in "Test" configuration, but web project that referenced Silverlight projects kept looking in target bin\Release folder for binaries.
I tried re-adding Silverlight projects, problem was still there.
It turned out problem was to specify Platform in msbuild arguments.
Solution configuration "Test|AnyCPU" and "Test|MixedPlatform" is no same. You will find that both Configuration and Platform has to be equal to same pair defined in project file. I don't know what Platform was msbuild taking by default, but I know it jumped to Release folder instead.
Anyway, I added /p:Platform="Any CPU" to msbuild arguments.
After carefully reviewing the configuration that was being built for CI, I found that one of the projects being referenced by my web project was set up to build with a wrong configuration. My CI build was set up to build for Staging (Any CPU) and one of my .projects that was being referenced by the Web project was set up to build using Release configuration. Once I updated the Configuration to be Staging, the CI build completed successfully
Related
As the title says, I'm having trouble getting Fody, and the plugin Fody.PropertyChanged, to work in .NET Core 3.0, or any .NET Core version. Reading the issues on the respective GitHub pages doesn't answer my question, nor am I able to find any relevant answers.
Once installed I cannot run my WPF project anymore and I am given the following error:
The target process exited without raising a CoreCLR started event.
Ensure that the target process is configured to use .NET Core.
This may be expected if the target process did not run on .NET Core.
The program '[21820] CalculationToolsApp.exe' has exited with code -2147450749 (0x80008083).
Any suggestions?
EDIT: I found out that I (maybe) cant use "Fody.Costura" with "Fody.PropertyChanged" like this in the FodyWeavers.xml file:
<Weavers>
<PropertyChanged />
<Costura />
</Weavers>
Which shouldn't be a problem because with .NET Core I can create a single file application anyway. Removing the Costura reference from the FodyWeavers.xml solved my problem!
It should work. Fody is compatible with .NET Standard.
Create a new WPF app using the WPF App (.NET Core) template in Visual Studio 2019 or using the dotnet new wpf command
Install the Fody and PropertyChanged.Fody NuGet packages
Add a file named "FodyWeavers.xml" with the following contents to the project:
<Weavers>
<PropertyChanged />
</Weavers>
Build
If you then decompile the assembly using a decompiler such as for example dotPeek, you should see the injected code as expected, e.g.:
public string GivenNames
{
// Method get_GivenNames with token 06000009
get
{
return this.<GivenNames>k__BackingField;
}
// Method set_GivenNames with token 0600000A
set
{
if (string.Equals(this.<GivenNames>k__BackingField, value, StringComparison.Ordinal))
return;
this.<GivenNames>k__BackingField = value;
this.<>OnPropertyChanged(<>PropertyChangedEventArgs.FullName);
this.<>OnPropertyChanged(<>PropertyChangedEventArgs.GivenNames);
}
}
Costura didnt work in wpf with .net core 3.1 for me either.
In .net core 3.1 you can use this instead:
Build -> publish -> create profile -> Edit "Configuration"
Target Runtime = win-x64 (or what ever target system you want, but NOT "portable")
expand "File Publish Options"
check: Produce single file
save
When you now choose build -> publish -> publish button it will create the single file.
It seems to be that they stopped the costura project because of the "Single-file executables" feature of .net core. Though this feature is still behind costura because you have to set a target runtime.
https://github.com/Fody/Costura/issues/442
In dotnet core 3 there are two new features
Single-file executables
Assembly linking
With these features included in the dotnet tool set, the value
proposition of Costura is greatly diminished. With that in mind I
think long term Costura should cease to be used as people transition
over.
Please comment with any input.
Plan:
disable issues
PR will still be accepted but only for bug fixes
add note to readme
add note to nuget description
write a warning in
update for .NET 5:
for .NET 5 and the current visual studio version 16.10.2 the wizard changed. I could not get this to work with the wizard anymore though i checked the options for single file etc.. But using the console worked: tools -> command line -> developer command prompt -> enter this:
dotnet publish -r win-x64 --self-contained true -p:PublishSingleFile=true -p:IncludeAllContentForSelfExtract=true
.NET 5 not compiling to single file executables
I'm facing a problem right now and I don't really know how to get more informations about it.
I've converted a desktop application through Microsoft's Desktop App Converter, made some manual modifications about the visual assets, and rebundled it through "makeappx.exe". Then I signed it.
Everything went fine. Except that when I double click the appx to check it, I have the following window:
Appx Error
Which roughly translates as "Couldn't open the appx or appxbundle file" and "Reason: Failure caused by an unknown reason".
This does not helps me a lot :/
However, if I try to install the package through a simple "Add-appxpackage MyPackage.appx", it works perfectly fine.
Could anyone help me find some leads on what's happening here? I've already checked the event viewer as explained here but I couldn't find anything unusual.
Thanks,
Skefrep
It seems the Microsoft team has taken notice of this problem and investigated this appropriately.
-Here is their solution-
The problem can be because when you convert an app with DesktopBridge the resources are signed with the manifest info and store that info in the .pri files you found in PackageFiles folder. Later, when you change something like the Publisher or the Name this signature doesn't match. To fix this you only need to recreate the .pri files.
rm *.pri. Remove the old .pri files.
cd C:\foo\PackageFiles\. Change current directory to the PackageFiles folder. This step is important for the next step.
makepri createconfig /cf priconfig.xml /dq en-US. Create a configuration file for the resources.
makepri new /pr "C:\foo\PackageFiles" /cf "C:\foo\PackageFiles\priconfig.xml". Generate the new *.pri files.
Then you can make the package as usual: MakeAppx, etc.
You can find more information about this problem in "Failed due to unknown reasons" error when you try to sideload a Desktop Bridge app - App Consult Team.
After adding Catel implementation to one of my views(mainPage) in my project I have a bug that crashes my Silverlight project. The only indication I have is :" A first chance exception of type 'System.NullReferenceException' occurred in Catel.MVVM " (just about after setting the RootVisual~) - I can't find what I'm doing wrong, and since I am planing on a long-term relationship with Catel I thought that stepping through Catel code might come in handy, so I tried and failed in all the following steps (any help will be appreciated.. because currently I'm stuck and can't find anything):
downloaded catel 3.9 source files (same as my nuget package) and tried building it.. failed with this error :
E:\Dev\Catel-3.9.0\src\Catel.Core\Catel.Core.SL5\Fody.targets(51,5): error MSB4036: The "Fody.WeavingTask" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with in the project file, or in the *.tasks files located in the "E:\WINDOWS\Microsoft.NET\Framework\v4.0.30319" directory. - trying to search and figure the reasons and overcome this, lead me to nowhere. :(
i have followed this "Stepping through the code" instruction in Catel documentation but noting really happened (I'm using VS2010..is this an issue ?? )
I read this article & readme.md at : https://github.com/GeertvanHorrik/GitHubLink about using GitHubLink to help you stepping through Catel code while debugging. I downloaded the release GitHubLink 1.3.0 from https://github.com/GeertvanHorrik/GitHubLink/releases/tag/1.3.0 ... but running this even with just the githublink.exe -help flag had thrown a exception..
I downloaded the Githublink-master source files but 0 projects were loaded (the GithubLink project file is incompatible with the current version of VS - I'm using VS2010)
can anyone help me either shade some light or:
overcome the build error I receive for catel (no.1)
instruct me how to set & step into catel ?
share the pdb files for Catel libs
It completely depends on the version you are using. If you are using the latest official one (3.9), stepping through the code is only possible by cloning the master branch and building the PDB files yourself.
In the latest prerelease versions via NuGet (the upcoming 4.0 version) you only have to enable the source server checkbox.
Note that you should never have to use GitHubLink yourself, that is for developers only (we run it during the build of Catel).
About the Fody task: it looks like the NuGet packages have not yet been restored on your side. In the lib folder there is a RestorePackages.bat which you can run to restore the packages.
I tried debugging on VS2012 and using Catel 4 pre-release (from Nuget)..
although I believe I did all the right things & settings in VS, I didnt get much further..
So I Opened (using a bin editor) the pdb file that was pulled by Nuget with the DLL, and took a look at the bin file.
the file have strings pointing to the source files at this directory :
C:\ci_ws\WS\1629\source\catel\src\catel/mvvm\catel.mvvm.shared..
So I have created a tree that starts with
c:\ci_ws\ws\1629\source
and downloaded the catel folder to that dir, renamed it from
"Catel-Develop" to just "Catel" in order to feet the location the pdb pointed.
To get things going I also had to add a "Symbol File(.pdb) location" in VS
option-> settings->Debugging->Symbols..(location/server list) to where the nuget download the packages.
in my case.. SolutionFolder\Packages\Catel.MVVM.3.9.0.1406062245-beta\lib\sl50..(I'm using Silverlight)
and then I was able to load the symbols and step/break into the code successfully ..
Maybe I missing something and there is a better way, but this the only way that worked for me..
The only question that still remains for me now is : What is the name of the Catel Github source branch that is matching the pre-release dll and pdb that Nuget is publishing at the moment (3.9.0.1406062245) ?
(I unchecked the general debug settings of : require source files to exactly match the original version)
Let's say I have a WPF Control that I want to deploy as source code transformation via NuGet.
The control has 2 files associated with it: UserControl.xaml.cs and UserControl.xaml.
When I deploy it via NuGet I get the files in the target project, but they don't have the hierarchy structure in the solution explorer. This is due to the fact that NuGet does not know how to add the DependentUpon property in the .csproj file.
Is there a workaround? Is this feature in the roadmap of NuGet?
Thanks
Tal
The answer is Powershell, specifically the Install.ps1 file that will execute automatically upon install if placed within a /tools folder in your NuGet package. Here's code that should do the trick:
param($installPath, $toolsPath, $package, $project)
$buildProject = #([Microsoft.Build.Evaluation.ProjectCollection]::GlobalProjectCollection.GetLoadedProjects($project.FullName))[0]
$file = $buildProject.Xml.Items | Where Include -eq "UserControl.xaml.cs"
$propertyToEdit = $file.Metadata | Where Name -eq "DependentUpon"
if (!$propertyToEdit)
{
$file.AddMetaData("DependentUpon", "UserControl.xaml") | Out-Null
}
$project.Save()
You may not see the change immediately in the Visual Studio interface, but if you unload/reload or close/open the project, you'll see it.
I am unable to build my Web Application (not Web Site) in our build environement. We use DMAKE in our build environment (this unfortunately is non negotiable, therefore using MSBUILD is not permitted ) and when invoking the asp.net precompiler through
C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_compiler -d -nologo -p Site -f -fixednames -errorstack -v / Debug
We get the following error
error ASPPARSE: Could not load type 'X.Y.Admin.Site.Global
If I compile from the ide it is successful. If i then compile with aspnet_compilier it is successful. So i only get a successful compile with aspnet_compiler when the target dll i am trying to compile is in the bin of the web application i am compiling.
I keep running into postings that talk about solutions using MSBUILD which unfortunately I cant try.
Any help would be appreciated
We had the same problem on our web application:
error ASPPARSE: Could not load type '...'
The problem was that we had the file on disk (on the project folder) but it wasn't included in our application project (in the .csproj file). We solved the problem by including the file in the project :)
I ran into a similar problem using NANT. The trick was to compile the web applications code files into a dll then include that when using aspnet_compiler.
use the command line compiler,either csc.exe (c#) or vbc.exe (visual basic), to compile your web application with an output of type library. This will create a dll that you can use in your aspnet_compiler task
Have you tried specifying the path using -p? Sounds to me like it can't find that type / assembly.
http://msdn.microsoft.com/en-us/library/ms229863(VS.80).aspx
For web applications, you have to build the .vb files into a dll and put that in the bin folder before you run the aspnet compiler. Check the output window in visual studio and you'll see the command line for the VB compiler. Run that first before you run the aspnet compiler, and the asp pages should be able to find the missing types.
This problem was resolved for me by simply deleting all bin and obj folders. Seems like they were in a bad state somehow. I also deleted the the .sou file, but I don't think that was the issue.
I received the same problem.
I fixed it by copying my webapp's DLL from the OBJ/DEBUG folder to the BIN folder.
I just had this error and found 2 ways to fix it, either:
Change the Codebehind attribute in the global.asax file to CodeFile and add "partial" to the class declaration
In the deployment project's property pages, set "Version output assemblies" and provide a version number
I don't really know why either worked, but it did.
solution :
-p Site path must have the directory path of .csproj file location.
ex :-
aspnet_compiler -p D:\Projects\MGM\mgm\mgm -v / D:\Projects\MGM-deploy\mgm_compiled