Debonlier fabrice

Hello,

I have somes files in my Debug directory (Bin/Debug/Data/Image1.bmp as example)
these files are not add to the resources of the project, so they are not Embedded.

in my Windows1.xaml, I write :

Code Block

<Window (...)
Icon="pack://siteOfOrigin:,,,/Data/Image1.bmp">

(...)

</Window>



But there, I have the error :
Error 1 The file pack://siteOfOrigin:,,,/Data/Image1.bmp is not part of the project or its 'Build Action' property is not set to 'Resource'.

I can launch the application but I can't use the interface CIDER. And I need for him to find and select control easier.
When the application is launched, the picture is visible.

So, What is the probleme

thanks



Re: Windows Presentation Foundation (WPF) SiteOfOrigin, Parse Error

Matt Galbraith

Your syntax is fine. I was able to get this scenario working on my machine. I was also able to reproduce the error/warning by using an invalid bmp for an icon. This oversized or incorrectly formatted bmp will still clip and display AS the icon, but mine (it was 3360x1050 pixels) was an uncommon size for an icon Smile I suggest trying an image at 64x64 or 32x32 to see if this fixes your issue, or just grab any preexisting .ico file on the machine to try.

Since Windows Vista has no problem with my ginormous icon though, I will follow up with the Cider team about this. There's either a perfectly good reason for this behavior or it's a bug.

A couple points:

- What are the compilation settings for your image to include For SiteOfOrigin, it should be "Content" type with "Copy if Newer" set

- Do you need the icon to be loosely packaged You can simply include the image as type "Resource" and rebuild the project. Then Cider will let you set the window's icon using the property UI (pretty cool) and you wont need to loosly include the icon.

Hope this helps,

Matt Galbraith






Re: Windows Presentation Foundation (WPF) SiteOfOrigin, Parse Error

Debonlier fabrice

thanks for your reply.
The picture is loose because I have about 30 pictures (16*16) and few other picture size. My .exe grow to 12 Mo !
If I add the picture to the project and I set a relative source, the problem is for another picture.

ex:
Code Block

<Image Source="pack://siteOfOrigin:,,,/Data/Picture29.png" />

doesn't work anyelse

@What are the compilation settings for your image to include For SiteOfOrigin, it should be "Content" type with "Copy if Newer" set
If you mine, Property of the picture (right clic, property), it's not possible because they are not add to the project. Maybe I must to add the pictures and as you says, set Build Action to Content, and Copy at "Copy if newer"
in this case, I place the repertory Data next my .sln and resource will be copied automatically in bin/debug/
@
Do you need the icon to be loosely packaged You can simply include the image as type "Resource" and rebuild the project. Then Cider will let you set the window's icon using the property UI (pretty cool) and you wont need to loosly include the icon.
Not especially. But if I want to change the picture Quickly... And picture will be not the only one loose resource. I want to make losse xaml to selet a theme or an other and use these xaml in other application. I don't understand very well for Cider and the property UI. I will see tomorow at office.


I hope you understand. I read better English than I write them








Re: Windows Presentation Foundation (WPF) SiteOfOrigin, Parse Error

Matt Galbraith

Ah, I think I understand your issue here. The other bug you caused me to find is just a bonus then Smile

Unfortunately, for Cider to work correctly, it needs to know about all the resources accessed by the application. As you said before, the application runs correctly, you just lose the designer. Including the images as loose content with "Copy If newer" or "Copy Always" is an easy way to work around this. The folder structure seen in the Solution Explorer is preserved in the output folder, so just make sure you see your pictures under "Data", include them as content to be copied, and your siteoforigin syntax should work w/ Cider.

One issue you might hit is if you are using ClickOnce to deploy your application (i.e. generating a .application file for app deployment). In this case, if you want to change these images later the application will be invalidated, since it will check the hashes of any file included as content. If so, then simply include them as content until you finish developing the app, then remove them as content when publishing the final version so the hash is unimportant. If you are simply running an executable, this caveat doesnt matter.

-Matt






Re: Windows Presentation Foundation (WPF) SiteOfOrigin, Parse Error

Debonlier fabrice

I don't use ClickOnce (if it's what I think).
I will try tomorow to add to the project and set the resources at "Content". I hope Cider will be better in the final version. I have an other curious bug but it's maybe more Orcas than Cider..It's an other story...
I come back next the test ...
thanks




Re: Windows Presentation Foundation (WPF) SiteOfOrigin, Parse Error

Debonlier fabrice

Hi
I've been a test.

If I add the bin/degug/Data/... directory to the project, it doesn't work.
if I add the Projects/MyProject/Data/... it works but, the resource are embedded even if I set Build Action to Content, or Resources. (my .exe(168ko) grow to 7,24Mo)
I don't understant what I must do to not embedded resources

Else, I can work without Cider, there are only a little more 500 lines of XAML in the main file.




Re: Windows Presentation Foundation (WPF) SiteOfOrigin, Parse Error

Matt Galbraith

Hi,

You definitely shouldn't ever need to add bin\debug to your project. This is a dynamically generated path, and should you change your compilation type to release, the project will fail (this assuming that could work in the first place)

As for why you're seeing resources be embedded when specifying content, I cannot repro that on this side. I have a project with a 10 Mo bitmap which binplaces to an 8 K exe with a loosely included bmp.

One idea:

- Close VS and open the .*proj file for your project with notepad. Search for your referenced images... you should see entries like this:

<Content Include="foo.png" >

<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>

</Content>

If you see any entries for your images with type resource or EmbeddedResource, delete them. It's fully possible to accidently include the same content as embedded and loose content.

If this still doesnt work, I'd love to see the project if that's possible. Perhaps you can start a clean new project to see if you can repro the issue all by itself...






Re: Windows Presentation Foundation (WPF) SiteOfOrigin, Parse Error

Debonlier fabrice

Hello, This morning it's working.

I have set Build action to content and Copy at Copy if newer.

There were maybe some problem friday with the csproj but now it's ok.

Maybe because I have closed and re-opened VS

thank you very much